/agent-traffic-control:subagent-reports-complete-but-pr-unmergedfrom agent-traffic-control
Catch the systematic gap between sub-agent "completed" status and the actual end state of a PR-merge orchestration task. Use when: (1) you've dispatched multiple parallel sub-agents (general-purpose or specialist) to open + review + merge PRs, (2) the parent receives `<task-notification>` with `status: completed` but the sub-agent's last action was waiting on CI, addressing a review finding, or pushing a rebased branch, (3) you're tempted to mark the parent task done based on the completion notification alone, (4) the parent has a TaskList tracking PR closure and you'd silently leave PRs OPEN. Root cause: sub-agents naturally terminate when they've kicked off the last asynchronous step (CI watcher, push command, reviewer dispatch), even if their brief required them to wait for that step's terminal state and then perform a follow-up (label, merge, delete-branch). The completion notification reflects sub-agent CONTEXT exhaustion, not orchestration COMPLETION. Observed 4/4 in one session. Fix: parent always runs a "verify PR state" check on each sub-agent completion — query `gh pr view <num>` for state/mergedAt/checks, finish the missing step (poll CI, add label, squash-merge, delete-branch) before marking the parent task done. Brief sub-agents to be more disciplined but DON'T trust them; treat sub-agent "completed" as "handed off to parent for finalization." Sister skills: `superpowers:subagent-driven-development` (workflow), `subagent-pre-existing-misattribution`, `subagent-bash-cd-wrong-worktree`.
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 3-5 parallel sub-agents to open + review + merge PRs that close GitHub issues. Each agent's brief explicitly says "wait for green CI, add auto-deploy label, squash-merge, delete branch, verify issue auto-closes." The agents work, push PRs, then return <task-notification status: completed>.
Several of those PRs are still OPEN. CI was still in-progress when the agent terminated. Or a reviewer found a P1 and the agent fixed it but stopped before re-running CI. Or the agent post-rebased and pushed but didn't merge. The parent, reading "completed," marks its TaskList task done. Hours later you realize 3 of 5 PRs never landed.
This is systematic, not occasional. In one session (scan-bugs-parallel, 2026-05-08, this repo) 4 of 4 sub-agents stopped before final merge:
Apply this skill when:
Agent tool with run_in_background: true to launch sub-agents whose briefs include "open PR + review + merge" as a single unit of work.<task-notification status: completed> arrives, and:
completed purely on the basis of the sub-agent notification.gh pr list --state merged.When a sub-agent reports completed for a PR-merge task, immediately:
gh pr view <num> --repo <owner>/<repo> \
--json state,mergedAt,statusCheckRollup,labels,mergeable
Read it before updating any task or summarizing to the user.
| Stopping point | Sub-agent symptom | Parent recovery |
|---|---|---|
| CI in progress | Agent says "waiting for pytest" | gh pr checks <num> --watch --interval 20, then label + merge |
| Reviewer posted P0/P1 | Agent posted finding then stopped | Dispatch continuation agent OR fix inline; re-CI; re-review; merge |
| Post-rebase push, no merge | Agent's last step was force-push | Verify mergeable, watch CI, label, merge |
| Branch deletion failed | Agent merged but --delete-branch hit gh-pr-merge-worktree-checkout-trap | gh api -X DELETE repos/.../git/refs/heads/<branch> |
Don't dispatch yet another sub-agent for the trivial finalization. The parent has full GH CLI access; finishing one PR is 3 commands:
gh pr checks <num> --repo <owner>/<repo> --watch --interval 20 2>&1 | tail -10
gh pr edit <num> --repo <owner>/<repo> --add-label auto-deploy # if dashboard PR
gh pr merge <num> --repo <owner>/<repo> --squash --delete-branch
gh issue view <issue-num> --repo <owner>/<repo> --json state --jq '.state'
DO dispatch a continuation agent only if the missing step requires substantive work (e.g. addressing a P1 review finding that needs a real code change).
Add this paragraph verbatim to PR-merge sub-agent briefs:
Do not declare completion until
gh pr view <num> --json statereturns"MERGED"with a non-nullmergedAt. If you've kicked off CI watching and your context is filling up, return a status report saying "CI in progress, parent please finalize" — don't returncompleted. If your context is exhausted, the parent will pick up; but DO NOT return success on a PR that's still OPEN.
This reduces but does not eliminate the gap. Always verify in the parent regardless.
Instead of:
Task #4: Wave 2 — B+C#515 bundle [in_progress]
Use:
Task #4: Wave 2 — B+C#515 bundle [in_progress]
description: Agent dispatched (id ac9dcb9d). Awaiting PR open. Will mark
completed only when `gh pr view <num> --json mergedAt` is non-null.
This forces explicit verification before status flip.
End-of-session sanity check:
gh pr list --repo <owner>/<repo> --state merged --search "merged:>=$(date -v-1d -u +%Y-%m-%dT%H:%M:%SZ)" \
--json number,mergedAt,title --jq '.[] | "\(.mergedAt) #\(.number) \(.title)"'
Cross-reference against your TaskList completed rows. Any row marked completed without a corresponding merged PR (or a documented externally-closed reason — e.g. parallel session merged it) is a false positive that needs investigation.
scan-bugs-parallel session (2026-05-08, the-project-repo)Dispatched 4 sub-agents. All 4 returned completed. State at notification time:
Without the verify-then-finish discipline, only #540 would have actually closed its issue. The session total would have been 1/4 instead of 4/4.
Plan skill's review checkpoints partially mitigate by forcing explicit handback; PR-merge sub-agents typically don't use Plan because their flow is linear.gh pr list and reconcile against TaskList. Don't rely on completion notifications alone.the-project-repo 2026-05-08 (scan-bugs-parallel) — closed 8 issues across 6 PRs; 4/4 sub-agents stopped before final merge.superpowers:subagent-driven-development (workflow primer for sub-agent dispatch).subagent-pre-existing-misattribution (different gap class — wrong baseline classification, not premature completion).subagent-bash-cd-wrong-worktree (different gap class — wrong cwd).A session's status claim about its own pull request goes stale the same way, and the direction that escapes checking is the reassuring one. Asked a CAPACITY question by a coordinator — nothing to do with that PR — a session answered "it is still waiting to land" and was reserving budget for it; the PR had merged seven hours earlier. The subject of the sentence (how much context was left) had been measured; the status clause rode along as a PREMISE and was copied from the session's own previous message, which is a copy like any other.
Before any answer that mentions a PR, branch or deploy state in passing, re-read it — not only before answers that are about it:
gh pr view <n> --json state,mergedAt,mergeCommit
The peer caught that one by reading the API itself, which is the only reason it cost nothing.
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.