/agent-traffic-control:parallel-impl-agent-dies-mid-stream-verify-working-treefrom agent-traffic-control
A dispatched parallel implementation subagent can die mid-stream and leave ZERO durable output while the harness still reports the task "completed". Use when: (1) you fanned out 2+ foreground impl agents (Agent/Task tool) to edit code in one repo, (2) one returns `API Error: Response stalled mid-stream` / an empty or truncated final message, possibly alongside a background "<task> completed (exit code 0)" notification, (3) you're about to integrate or commit their combined work. The "completed" status is a LIE here — the agent may have written nothing (target file untouched, no test created, its self-made todos all still pending). ALWAYS reconcile each agent's CLAIMED work against the actual working tree (`git status`, grep the target file for the expected change) before integrating; the healthy sibling's work is usually intact, so just finish the dead agent's task yourself. Sister to subagent-reports-complete-but-pr-unmerged (work done, integration skipped) and credit-stall-mid-orchestration-revive-collision (stalled then auto-revives and races). Pairs with shared-file-redesign-parallel-author-serial-integrate (the no-commit → serial path-scoped integrate pattern that makes this degrade gracefully). ALSO covers the INVERSE outcome — see "Variant: the agent died but the work SURVIVED" — where a long single-owner pipeline agent commits+pushes per stage, so a mid-stream death leaves finished stages already on the remote. There, redoing the task from scratch duplicates landed work: reconcile against `origin/<branch>` and open PRs BEFORE the working tree, re-dispatch only the missing stages, never `resumeFromRunId` (it re-runs everything downstream), and after the SAME stage dies 3 times do it in the main loop. AND the REVIEWER/ANALYST variant — see "Variant: the dead agent's product was its final MESSAGE" — where the right move is neither redo nor re-dispatch: the agent's transcript survives, the failure notification carries its partial result, and a SendMessage resume ("finalize from what you have; no advisor consults; no re-reading") recovers the complete deliverable in one cheap turn.
Trending skills
7-day visitors to each skill page
Ships in agent-traffic-control. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You dispatch N foreground implementation agents in parallel (disjoint files). One comes
back with API Error: Response stalled mid-stream (or an empty/truncated report), and the
harness may even emit a background " completed (exit code 0)" line. If you trust that
and integrate, you ship a hole: the agent wrote NOTHING — its target route is untouched, no
test file exists, the todos it created for itself are all still pending.
Agent/Task impl agents editing code in one repo.subagent_tokens ~0; a "completed" status.git add/commit or a whole-repo check across both outputs.git status --short
and grep its target for the expected change (e.g. grep -n buildResponse handler.ts).
A missing edit + no new test file = the agent died; "completed (exit 0)" was the harness
reporting the shell wrapper exited, NOT the work landing.tsc
false-positives on half-written files); the orchestrator does path-scoped
git add <exact files> per unit + the full check at integration. So the survivor's work
is clean and committable independent of the casualty.The headline case above is the shared-file orchestration, where agents deliberately don't
commit — so a death means zero durable output. The inverse case is just as common and the
recovery is completely different: a long, single-owner pipeline agent whose stages each
git commit && git push before moving on. When that agent dies mid-stream, the finished stages
are already on the remote. Treating it like the headline case — redoing the task from
scratch — duplicates work and can clobber pushed commits.
So the reconcile step (Solution 1) has to look in the right place. Working-tree-only checks
lie here in the other direction: the agent's worktree may be gone or reset while its commits sit
safely on origin. Check, in this order:
git fetch origin
git log --oneline origin/<branch> # which stages actually landed?
gh pr list --head <branch> --state all # did it get as far as opening a PR?
git status --short # only NOW look at the tree
Then re-dispatch only the missing stages, with a brief that states what's already committed.
Do not use workflow resume. resumeFromRunId re-runs everything downstream of the first
changed call, not just the failed stage — for a checkpointed pipeline that means re-doing landed
work. A targeted mini-workflow covering only the gap is correct.
The 3-strike escalation rule. If the same stage dies three times, stop re-dispatching and do it in the main loop in small, individually-verified steps. Three failures on one stage is evidence the stage is too large for one agent context (oversized payload, long tool chains, big file rewrites), and a fourth dispatch will fail the same way. Breaking the stage into individually verified steps can recover progress without repeating the same oversized dispatch.
Design implication — pick the guardrail that matches the work. Neither pattern is universally right:
| Work shape | Guardrail | Failure mode it buys |
|---|---|---|
| N agents editing SHARED files in parallel | agents do NOT commit; orchestrator integrates path-scoped | death = no output, but no index races or half-written cross-checks |
| ONE agent, long serial pipeline, stall-prone | agent commits + pushes per stage | death = partial-but-durable progress; resume by re-dispatching the gap |
Choose per-stage commits whenever the work is long enough that a mid-stream death is likely and the agent owns its files exclusively.
git status + a grep of each target shows exactly the expected edits from the SURVIVING
agents and nothing from the dead one; after you finish the dead one's task, the full suite +
type-check pass before any commit.
When the stalled agent is a REVIEWER, CRITIC, or ANALYST — its deliverable is a structured final message, not file edits — the impl-agent playbook (verify tree, redo the task) wastes the whole review: there is no working tree to check, and re-dispatching re-pays the full read-and-reason cost. The recovery is different and nearly free:
<result> before deciding anything. A mid-stream
stall often lands AFTER the analysis is done and BEFORE the write-up — the partial result
in the notification can already contain findings that matter to the result.Synthetic example: a reviewer finishes its analysis but stalls while writing
its final report. A finalize-only message to the same resumable agent asks it to
write from its existing notes. This recovers the deliverable without repeating
its reading. This is distinct from resumeFromRunId, a workflow-level operation
that can repeat downstream work.
Sub-variant — interrupted by a session or credit limit: if the platform retains the agent transcript, it may be possible to resume after the limit resets. Inspect the partial result first. Use "finalize" when analysis is complete and "continue" when an identified computation or verification step remains. Specify the missing step and avoid unnecessary re-reading or additional delegation.
If the branch or input artifacts changed during the interruption, state that delta in the resume message. Re-check affected conclusions against the changed inputs. Transcript recovery depends on platform support; when no resumable transcript exists, redispatch only the missing work from the recovered evidence.
disable-model-invocation): recall by grepping lessons/skills
when a parallel agent returns a stall, or via the /name invocation.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub wan-huiyan/agent-traffic-control --plugin agent-traffic-control118 skills in this plugin
/agent-refusal-with-evidence-beats-literal-complianceA dispatched agent that does exactly what you asked can ship a defect you would
have stopped yourself, because it can see something at the worksite that you
could not see when you wrote the brief. Use when: (1) you are writing a brief
that prescribes a specific fix, threshold, wording or value rather than the
outcome you want; (2) an agent reports that it did not do what you asked and
you are deciding whether that is insubordination or judgement; (3) an agent
asserts "this is fine" or "not needed" with no measurement behind it; (4) you
are reviewing overnight output and want to know which decisions were checked
and which were assumed. Two halves, and both are needed: give the agent
explicit permission to satisfy the INTENT of an instruction while refusing its
letter, and REQUIRE the evidence with the refusal — what it built or measured,
what that showed, what it did instead. Evidence is the whole difference between
a refusal you can bank and one you have to re-litigate. Four agents correctly
declined an instruction in a single run; one built the suggested fix, measured
that it turned a silent safe refusal into a permanently red pipeline, and
reverted it unpushed.
/auto-merge-rearms-while-agent-live-kill-then-disarm-verifyDisarming auto-merge on a PR whose agent is still running does not hold it —
the agent re-arms within minutes and the PR merges, because arming is a step in
the agent's brief and disarming is not an instruction to the agent at all. Use
when: (1) you want to STOP a pull request from merging that an agent opened and
armed, for review, for a rethink, or because it is landing into a queue you are
trying to drain; (2) a PR you disarmed merged anyway; (3) you are telling agents
which PRs are on hold and want the hold to be enforced rather than announced;
(4) you are about to run `gh pr merge --disable-auto` and have not decided what
to do about the agent. The order is KILL THE AGENT FIRST, THEN DISARM, THEN
VERIFY the disarm by reading `autoMergeRequest` back — a disarm you did not read
back is not a hold. The stronger form needs no ordering at all: convert the PR
to a draft with `gh pr ready --undo`. A draft cannot merge whatever any agent
does to it, so the hold survives an agent you missed, an agent that restarts,
and an agent you did not know about.
/batch-member-cites-a-path-only-a-non-member-addsYou wrote something correct that the default reader cannot reach: a batch member citing a
path only a NON-member adds, or a rule, ruling or ledger sitting on an unlanded branch.
/batch-merge-subject-is-not-evidence-a-member-landedYou are about to close, delete the branch of, or mark as landed a pull
request because a batch, roll-up or merge-train commit on the target branch
names it in the subject line, and because the member's own commits all
predate that merge by wall clock. Neither of those is evidence. A batch
branch is assembled at some moment BEFORE it merges, so anything the member
pushed after assembly is outside it, and the subject records INTENT at
assembly time rather than CONTENT at merge time. Use before closing a
member, when an ancestry check against a squashed batch says no, or when a
member's branch still shows commits ahead of the target. Compare file
content against the target branch instead, expecting exactly one legitimate
difference: the shared aggregate file every member appends to.
/check-a-stale-branch-is-not-undoing-newer-main-workA branch built on an out-of-date main is about to merge, or has merged, and may undo work
that landed since. Use when a green, conflict-free PR deletes files you never touched,
newer values or a whole redesign vanish after a sibling PR merged, rows of a shared ledger
(tracker, registry, CHANGELOG) disappear or revert, or when `git diff main...HEAD` or a
reviewer says your small PR touches dozens of files you did not change.
/ci-leg-skipping-moves-minutes-it-does-not-remove-themYou are about to propose, price or approve a CI cost saving that works by
making a job or matrix leg SKIP on pull requests — a path filter, a safe
list, a changed-files gate, an exemption list. Check first whether the
pipeline runs a complement or backstop on merge, on push, or nightly:
many do, and then the legs a pull request skipped are exactly the legs some
later run executes, so a branch that goes green once and merges bills the
same total either way and the wall clock does not move at all. Use when
pricing a filter change, when a percentage saving is quoted with no basis,
or when choosing between filtering legs and batching pull requests. The
question that separates money from bookkeeping is whether the change
removes RUNS or merely moves LEGS.