fix(worker): harden CLI injection, stuck-Running, chain wedge, and Fail guard
1. ArgumentList (fix injection): ClaudeArgsBuilder.Build() now returns IReadOnlyList<string>; ClaudeProcess populates ProcessStartInfo.ArgumentList instead of Arguments, so values like system prompts are never shell-split. DailyPrepPrompt, RefinePrompt, and WeekReportService migrated similarly. All IClaudeProcess fakes updated. 2. ContinueAsync exception guard: wrap RunOnceAsync in try/catch matching the RunAsync pattern so an unexpected exception never leaves the task stuck in Running status. 3. Planning chain cascade: OnChildFinishedAsync now calls CancelAsync on the immediate blocked successor when a child fails or is cancelled, triggering a recursive cascade that clears the entire remaining chain instead of leaving it wedged. 4. FailAsync guard: restrict valid source states to Running and Queued; WaitingForReview -> Failed is now rejected, preventing an invalid transition that could corrupt the review workflow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,8 +19,10 @@ public class DailyPrepPromptTests
|
||||
public void Build_args_allows_only_the_two_tools()
|
||||
{
|
||||
var args = DailyPrepPrompt.BuildArgs(maxTurns: 30);
|
||||
Assert.Contains("--output-format stream-json", args);
|
||||
Assert.Contains("--max-turns 30", args);
|
||||
Assert.Contains("--output-format", args);
|
||||
Assert.Contains("stream-json", args);
|
||||
Assert.Contains("--max-turns", args);
|
||||
Assert.Contains("30", args);
|
||||
Assert.Contains("--allowedTools", args);
|
||||
Assert.Contains("mcp__claudedo__get_daily_prep_candidates", args);
|
||||
Assert.Contains("mcp__claudedo__set_my_day", args);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PrimeRunnerTests : IDisposable
|
||||
}
|
||||
|
||||
public async Task<RunResult> RunAsync(
|
||||
string arguments,
|
||||
IReadOnlyList<string> arguments,
|
||||
string prompt,
|
||||
string workingDirectory,
|
||||
Func<string, Task> onStdoutLine,
|
||||
|
||||
Reference in New Issue
Block a user