fix(runner): substitute acceptEdits for haiku's silent auto-mode downgrade, fail permission-denial-only runs

This commit is contained in:
mika kuns
2026-08-10 14:35:24 +02:00
parent 6a2a19cc9e
commit db50e710b9
10 changed files with 267 additions and 7 deletions
+18 -1
View File
@@ -457,9 +457,10 @@ public sealed class TaskRunner
private async Task HandleSuccess(TaskEntity task, ListEntity list, string slot, WorktreeContext? wtCtx, RunResult result, CancellationToken ct)
{
var committed = false;
if (wtCtx is not null)
{
var committed = await _wtManager.CommitIfChangedAsync(wtCtx, task, list, ct);
committed = await _wtManager.CommitIfChangedAsync(wtCtx, task, list, ct);
if (committed)
{
await _broadcaster.WorkerLog($"Committed changes in \"{task.Title}\"", WorkerLogLevel.Info, DateTime.UtcNow);
@@ -467,6 +468,22 @@ public sealed class TaskRunner
}
}
// A run can report success (exit 0, non-null result text) while every write it
// attempted was denied by the permission gate — e.g. the claude-cli haiku/"auto"
// downgrade to interactive "default" (see PermissionModeResolver). Left alone this
// lands as a normal WaitingForReview with an empty diff, and a reviewer sees only
// that emptiness with no clue why. Surface it as a failure instead.
if (!committed && result.PermissionDenials.Count > 0)
{
var tools = string.Join(", ", result.PermissionDenials.Distinct());
await MarkFailed(
task.Id, task.Title, slot,
$"All edits were blocked by permission denials ({tools}) and nothing was changed. " +
"Check the run's permission mode (get_effective_run_config).",
result.TurnCount);
return;
}
// Terminal DB write uses CancellationToken.None so the task status
// is never left as 'running' because of a cancel that arrived
// after the Claude run already succeeded.