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:
co-authored by
Claude Sonnet 4.6
parent
763732a9b3
commit
33bdff8a6e
@@ -69,7 +69,12 @@ public sealed class WeekReportService : IWeekReportService
|
||||
// alphanumerics, dashes and dots only.
|
||||
var safeModel = new string(model.Where(c => char.IsLetterOrDigit(c) || c is '-' or '.').ToArray());
|
||||
if (safeModel.Length == 0) safeModel = "sonnet";
|
||||
var args = $"-p --output-format stream-json --verbose --permission-mode auto --model {safeModel}";
|
||||
IReadOnlyList<string> args =
|
||||
[
|
||||
"-p", "--output-format", "stream-json", "--verbose",
|
||||
"--permission-mode", "auto",
|
||||
"--model", safeModel,
|
||||
];
|
||||
var result = await _claude.RunAsync(args, prompt, Path.GetTempPath(), _ => Task.CompletedTask, ct);
|
||||
if (!result.IsSuccess)
|
||||
throw new InvalidOperationException(result.ErrorMarkdown ?? "Claude could not generate the report.");
|
||||
|
||||
Reference in New Issue
Block a user