/agent-traffic-control:auto-merge-rearms-while-agent-live-kill-then-disarm-verifyfrom agent-traffic-control
Disarming 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.
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 want a pull request held. It has auto-merge armed, so you disarm it:
gh pr merge 123 --disable-auto
Minutes later it is merged.
The reason is not a race in GitHub. It is that arming auto-merge is a step in the agent's brief, and your disarm was not addressed to the agent at all. The agent is still alive, still working through its list, and one of its later steps — a retry, a re-check, a "make sure the PR is armed before you finish" line — arms it again. From the agent's point of view nothing unusual happened: it found the PR unarmed and armed it, which is what it was told to do.
This happened twice in one run. Same PR, same disarm, same result. The second time is the informative one: repeating the action that failed, faster, does not help, because the mechanism is not timing.
The general shape is worth naming, because it recurs beyond auto-merge: changing a resource's state does not change the intent of a process that keeps re-asserting it. Any agent-set state — a label, an assignee, a branch protection exemption, a queued merge — comes back if the agent that set it is still running.
MERGED, or autoMergeRequest is non-null again after you
cleared it.Not for: a PR that will not merge and you want it to. That is
gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes
— the opposite problem, with the opposite fix (--auto, not --disable-auto).
A draft pull request cannot be merged. Not by gh pr merge, not by auto-merge, not
by an agent that re-arms it — GitHub refuses with Pull Request is still a draft (mergePullRequest). That refusal is a property of the PR, so it holds against an agent
you did not kill, an agent that restarted, and an agent you did not know existed:
gh pr ready 123 --undo # convert to draft — this IS the hold
gh pr view 123 --json isDraft,autoMergeRequest # expect isDraft: true
Prefer this whenever the hold matters more than the PR's appearance. It is also the one form that does not depend on you having correctly enumerated the agents.
One trap comes with it, and it is already documented: a cleanup routine that deletes
a head branch whenever the branch still exists — rather than when the PR actually
merged — will delete a held draft's branch and close the PR. Gate every branch
delete on mergedAt != null. Full treatment in
gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes
§Fix Failure C.
If the PR must stay ready-for-review, the order is not optional:
PR=123
# 1. KILL THE AGENT FIRST. While it lives, everything below is advisory.
# Identify it, stop it, and confirm it is stopped — a stop you did not confirm
# is the same mistake one level up.
# 2. THEN disarm.
gh pr merge "$PR" --disable-auto
# 3. THEN verify, by reading the state back. A disarm you did not read back
# is not a hold; it is a command you ran.
gh pr view "$PR" --json state,isDraft,autoMergeRequest,mergedAt
# expect: {"state":"OPEN","isDraft":false,"autoMergeRequest":null,"mergedAt":null}
# 4. And re-check after a few minutes. Re-arming is the failure; one read
# immediately after your own command cannot see it.
Step 4 is the one people drop. The failure takes minutes, and the verification everyone runs takes seconds.
If you are publishing a list of PRs on hold, write next to each one what actually stops it, not just that it is on hold:
#123 held — DRAFT (enforced by GitHub)
#124 held — auto-merge disarmed, agent stopped 14:02, re-verified 14:11
#125 held — announced only; no enforcement. Anything may merge this.
The third line is the honest one, and writing it is usually enough to make you go and fix it.
A hold is real when all of these are true, checked in this order:
gh pr view <N> --json autoMergeRequest returns null, or
isDraft is true.mergedAt != null — that closes the PRs you are trying to protect.Across a set of held PRs:
gh pr list --json number,isDraft,autoMergeRequest \
--jq '.[] | select(.autoMergeRequest != null and .isDraft == false)
| {number, WARNING: "armed and not a draft"}'
A pull request needed to be held. Auto-merge was armed, so gh pr merge --disable-auto
was run on it. Within minutes it was armed again and it merged. The PR's agent was
still live and arming was on its list.
The same thing was done a second time, with the same result. Twice. The lesson is in the repetition: the second attempt was not slower or sloppier than the first — the action simply does not do what it appears to do while the process that set the state is still running.
What would have held it, with no ordering to get right and no agent enumeration to get
wrong: gh pr ready --undo. A draft cannot merge.
refs/pull/<N>/head
and reopening. See the sibling skill above.merge-queue-thrash-stop-inflow-and-open-prs-as-drafts.gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes
— the inverse problem, plus the branch-delete-closes-a-draft trap this skill inheritsmerge-queue-thrash-stop-inflow-and-open-prs-as-drafts
— draft-by-default as a CI-cost and queue-control lever rather than a holdsubagent-reports-complete-but-pr-unmerged
— the other direction of the same gap between what an agent reports and PR stategh pr ready (--undo converts to
draft) and gh pr merge
(--disable-auto)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
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.
/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.
/cjk-structured-llm-output-truncates-json-needs-2x-tokensWhen generating LONG Chinese/Japanese/Korean (CJK) STRUCTURED output (a big JSON report, a multi-section
document) from an LLM chat API, the response truncates mid-JSON and your parser throws "no parseable JSON"
/ "Expecting ',' delimiter" / JSONDecodeError — even though the SAME prompt in English worked. Root cause:
CJK is token-heavy (≈1–2 tokens per character vs ≈0.25 for English), so a report that fit your max_tokens in
English overflows it in Chinese. Some models ALSO hard-cap output well below what you request (e.g. qwen-max
caps at 8192) and silently truncate. Use when: a zh/ja/ko structured-generation run fails JSON parsing,
worked in English, or a specific model truncates while others on the same prompt succeed. Covers the ~2×
token budget rule, per-model output caps, and a salvage that recovers the complete sections from a
truncated object.