feat(core): fully reset in-review → todo so the task starts over

Previously this transition cleared only transient execution state
(status/error/worktree/blockedBy/workflowStepResults), but kept the
prior branch, baseBranch, baseCommitSha, summary, and recovery
counters. That meant retrying a reviewed task resumed on the old
branch with a stale summary instead of starting fresh. Now those
fields are also cleared on in-review → todo. Other reopen paths
(in-progress/done → todo/triage) keep their existing behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-28 16:21:56 -07:00
parent 4763a3cf8b
commit 3cf07fa413
2 changed files with 25 additions and 0 deletions

View File

@@ -5934,6 +5934,12 @@ Task with acceptance criteria
error: "stale error", error: "stale error",
worktree: "stale-worktree", worktree: "stale-worktree",
blockedBy: "FN-456", blockedBy: "FN-456",
branch: "fn/stale-branch",
baseBranch: "main",
baseCommitSha: "abc123",
summary: "stale summary from prior attempt",
recoveryRetryCount: 2,
nextRecoveryAt: new Date().toISOString(),
workflowStepResults: [{ workflowStepResults: [{
workflowStepId: "wf-1", workflowStepId: "wf-1",
workflowStepName: "Workflow step 1", workflowStepName: "Workflow step 1",
@@ -5949,6 +5955,14 @@ Task with acceptance criteria
expect(retried.worktree).toBeUndefined(); expect(retried.worktree).toBeUndefined();
expect(retried.blockedBy).toBeUndefined(); expect(retried.blockedBy).toBeUndefined();
expect(retried.workflowStepResults).toBeUndefined(); expect(retried.workflowStepResults).toBeUndefined();
// Full reset: prior branch/summary/recovery state discarded so the next
// run starts from scratch.
expect(retried.branch).toBeUndefined();
expect(retried.baseBranch).toBeUndefined();
expect(retried.baseCommitSha).toBeUndefined();
expect(retried.summary).toBeUndefined();
expect(retried.recoveryRetryCount).toBeUndefined();
expect(retried.nextRecoveryAt).toBeUndefined();
}); });
}); });

View File

@@ -2615,6 +2615,17 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
task.workflowStepResults = undefined; task.workflowStepResults = undefined;
} }
// Full reset when sending an in-review task back to todo: discard prior
// branch/summary/recovery state so the next run starts from scratch.
if (fromColumn === "in-review" && toColumn === "todo") {
task.branch = undefined;
task.baseBranch = undefined;
task.baseCommitSha = undefined;
task.summary = undefined;
task.recoveryRetryCount = undefined;
task.nextRecoveryAt = undefined;
}
await this.atomicWriteTaskJson(dir, task); await this.atomicWriteTaskJson(dir, task);
// Update cache if watcher is active // Update cache if watcher is active