You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When orchestrated-coder is interrupted mid-dispatch — most commonly on max_turns exhaustion for a multi-task plan — no change-summary artifact is produced. The coder writes its single summary file only at the end of the invocation, so a cutoff response leaves the orchestrator with:
a partially-modified working tree,
no durable record of which plan tasks the coder had completed vs. abandoned,
no structured handoff to a continuation coder or a recovering orchestrator.
Observed during orchestrated run 20260420-044834Z (ticket williamthorsen/node-monorepo-tools#245): two orchestrated-coder dispatches each hit ~114–124 tool_uses against max_turns: 80, returned an agentId: marker rather than a structured return block, and burned ~229K tokens of work that produced no artifact. The orchestrator recovered by direct tree inspection — reliable here because the run happened to complete the code changes before the cutoff, but in general the recovery path is fragile and expensive.
The same interruption pattern applies to the coder's review-response mode, where a cutoff leaves reviewers and the orchestrator with no record of which findings were addressed.
Context
The summary is the orchestrator's primary state-transfer channel. Review cycles, holistic review, and re-dispatched coders all read the change-summary. Losing it forces the orchestrator into ad-hoc recovery.
max_turns can legitimately be hit. Raising the ceiling helps at the margin, but it does not eliminate the failure mode — plans can always grow. The artifact-write policy must be robust to it.
Partial summaries are strictly more useful than no summaries — even a summary listing tasks 0–4 complete, task 5 in-progress, tasks 6–7 unstarted gives a human reviewer or a continuation coder enough to act on.
The coder's Write/Edit tools can overwrite or patch the summary file at any time. There is no technical constraint against flushing incrementally.
Per-task boundaries are already named in plans (Task 0, Task 1, …) and per-finding IDs are already used in review response (F1, F2, W1, …). Both modes have natural scaffold boundaries.
Both modes write to the same {NN}_coder_change-summary.md path. Implementation and review-response share the artifact slot; only the content shape differs.
Churn is acceptable. Writing the summary file N times during a dispatch is cheap; the artifact store is not performance-sensitive.
Approaches considered
A. Status quo — coder writes full summary at end
Pros: simple. Cons: all-or-nothing against interruption.
B. Scratch progress log, synthesize summary at end
Pros: append-only progress log is interruption-safe. Cons: two artifacts; consumers of the change-summary still see nothing on interruption.
C. Write summary after each task, overwriting in place (chosen)
Coder writes the change-summary file immediately with a scaffold (one section per plan task or per finding, all marked "pending"). After each unit, it overwrites with updated sections. At the end, it fleshes out aggregate sections.
Pros: a valid, useful change-summary exists after every transition. Interruption at any point leaves a partial but structurally-complete artifact. No new artifact types. Cons: coder prompt needs restructuring.
D. Emit explicit task_progress MCP events
Pros: machine-readable progress stream. Cons: doesn't solve the summary-file interruption problem; adds a new event type.
Solution
Adopt approach C — incremental in-place writes of the change-summary by the coder — and apply it to both operating modes (implementation and review response). Bundled with this change, raise orchestrated-coder's turn budget from 80 to 150 to reduce the frequency of hitting the ceiling.
Body prose "You have 80 turns" → "You have 150 turns"
Keep the "Reserve your last 3 turns" gate, but reframe: the reserved turns finalize Quality gates, Deferred items, and the aggregate status line in the already-written scaffold — not a full artifact from scratch.
Implementation mode (multi-task plans only)
First tool use after reading the plan is a Write of the change-summary scaffold:
Add a Recovery from coder interruption subsection: when a coder Task returns without a structured return block, the orchestrator reads the partial change-summary at the canonical path and uses it to seed continuation or populate the run summary — no working-tree inspection fallback.
Incremental-write discipline for reviewer artifacts — tracked in Have reviewers write findings incrementally for interruption resilience #452. Reviewers have the same interruption problem but a structurally different scaffold (findings are discovered, not enumerated upfront), so they warrant their own ticket.
Acceptance criteria
Implementation-mode incremental write is specified in orchestrated-coder.md: scaffold as first tool use (multi-task plans), overwrite per plan task, finalize aggregate sections at end.
Review-response-mode incremental write is specified in orchestrated-coder.md: scaffold listing all finding IDs as first tool use, overwrite per finding.
Example scaffolds for both modes are present in the agent definition.
orchestrated-coder turn budget is 150 in all six locations: agent frontmatter, agent body prose, SKILL.md Turn budgets table, SKILL.md Phase 3 dispatch, review-cycle.md initial fix round, review-cycle.md simplifier fix cycle.
SKILL.md documents the recovery path for missing structured return blocks: read the partial summary rather than inspect the working tree.
Test criterion: N/A — all changes are to agent instruction content (prose consumed by Claude at runtime); no code paths with existing test coverage are modified. Falls under the testing-conventions carve-out for content/prose updates.
References
Run that surfaced the issue: ~/ai-artifacts/projects/node-monorepo-tools/tickets/245/20260420-044834Z/ (see 17_orchestrator_run-summary.md Insights and 18_analyst_savings-analysis.md for quantified impact).
Problem
When
orchestrated-coderis interrupted mid-dispatch — most commonly onmax_turnsexhaustion for a multi-task plan — no change-summary artifact is produced. The coder writes its single summary file only at the end of the invocation, so a cutoff response leaves the orchestrator with:Observed during orchestrated run
20260420-044834Z(ticket williamthorsen/node-monorepo-tools#245): twoorchestrated-coderdispatches each hit ~114–124tool_usesagainstmax_turns: 80, returned anagentId:marker rather than a structured return block, and burned ~229K tokens of work that produced no artifact. The orchestrator recovered by direct tree inspection — reliable here because the run happened to complete the code changes before the cutoff, but in general the recovery path is fragile and expensive.The same interruption pattern applies to the coder's review-response mode, where a cutoff leaves reviewers and the orchestrator with no record of which findings were addressed.
Context
max_turnscan legitimately be hit. Raising the ceiling helps at the margin, but it does not eliminate the failure mode — plans can always grow. The artifact-write policy must be robust to it.{NN}_coder_change-summary.mdpath. Implementation and review-response share the artifact slot; only the content shape differs.Approaches considered
A. Status quo — coder writes full summary at end
Pros: simple. Cons: all-or-nothing against interruption.
B. Scratch progress log, synthesize summary at end
Pros: append-only progress log is interruption-safe. Cons: two artifacts; consumers of the change-summary still see nothing on interruption.
C. Write summary after each task, overwriting in place (chosen)
Coder writes the change-summary file immediately with a scaffold (one section per plan task or per finding, all marked "pending"). After each unit, it overwrites with updated sections. At the end, it fleshes out aggregate sections.
Pros: a valid, useful change-summary exists after every transition. Interruption at any point leaves a partial but structurally-complete artifact. No new artifact types. Cons: coder prompt needs restructuring.
D. Emit explicit
task_progressMCP eventsPros: machine-readable progress stream. Cons: doesn't solve the summary-file interruption problem; adds a new event type.
Solution
Adopt approach C — incremental in-place writes of the change-summary by the coder — and apply it to both operating modes (implementation and review response). Bundled with this change, raise
orchestrated-coder's turn budget from 80 to 150 to reduce the frequency of hitting the ceiling.Coder agent changes —
packages/agents/content/subagents/orchestrated-coder.mdTurn budget
maxTurns: 80→maxTurns: 150Implementation mode (multi-task plans only)
First tool use after reading the plan is a
Writeof the change-summary scaffold:After each plan task completes, overwrite the file: update that task's section (files changed, outcome, notes) and bump
## Status.Before the final return block, flesh out
Quality gates,Deferred items, and set the final aggregate status.Single-task plans keep the existing "write once at the end" behavior.
Review-response mode
Same pattern, scaffolded by finding IDs:
Writeof a scaffold listing all findings (F1, F2, W1, …), each marked— pending.Status(FIXED | NOT_FIXED | ALREADY_RESOLVED) andAction.Quality gates.Orchestrator changes —
packages/agents/content/skills/orchestrate/SKILL.mdorchestrated-coderrow80→150.max_turns: 80→max_turns: 150.Review-cycle module changes —
packages/agents/content/skills/orchestrate/modules/review-cycle.mdmax_turns: 80→max_turns: 150.Out of scope
{NN}_coder_change-summary.mdnaming pattern.SendMessage-based resumption of interrupted coder dispatches — tracked in Enable SendMessage-based resumption for interrupted orchestrated-coder dispatches #450. Incremental writes (this ticket) provide durable state recovery for all failure modes;SendMessageis a cheaper recovery path when the agent is still resumable.Acceptance criteria
orchestrated-coder.md: scaffold as first tool use (multi-task plans), overwrite per plan task, finalize aggregate sections at end.orchestrated-coder.md: scaffold listing all finding IDs as first tool use, overwrite per finding.orchestrated-coderturn budget is150in all six locations: agent frontmatter, agent body prose, SKILL.md Turn budgets table, SKILL.md Phase 3 dispatch, review-cycle.md initial fix round, review-cycle.md simplifier fix cycle.References
~/ai-artifacts/projects/node-monorepo-tools/tickets/245/20260420-044834Z/(see17_orchestrator_run-summary.mdInsights and18_analyst_savings-analysis.mdfor quantified impact).packages/agents/content/subagents/orchestrated-coder.md,packages/agents/content/skills/orchestrate/SKILL.md,packages/agents/content/skills/orchestrate/modules/review-cycle.md.