/agent-traffic-control:parallel-pr-scope-overlap-tiebreaker-delta-checkfrom agent-traffic-control
Before applying a handoff prompt's tiebreaker default ("merge the first-mover", "the clean-against-main one", "the one with reviewer APPROVE") to pick a winner between two parallel PRs that implemented the SAME scope, run `gh pr diff` on BOTH and audit for substantive deltas. Use when: (1) a session prompt or handoff doc surfaces a parallel-PR collision and recommends a tiebreaker, (2) two PRs targeting the same issue / same fix area are open simultaneously authored by different sessions, (3) the prompt's recommended winner is the older / cleaner / single-reviewer one — exactly the conditions under which "first-mover" rules can ship the inferior implementation, (4) you're tempted to skip the delta-check because the diffs "are probably substantively equivalent" or the prompt already analyzed them. Symptom of having skipped this check: weeks later a follow-up PR re-implements a correctness improvement that was already in the loser's diff. Sister to `synthetic-id-collision-rebase` (same-id register collisions; mechanism is namespace, not scope), `parallel-pr-template-fork-duplicates-moved-section` (semantic duplication via mover/forker — different files, same block ends up in two places), and project memory `feedback_coordination_framing_for_parallel_artifact_collisions.md` (what to do AFTER picking a winner — neutral close framing). Defends against the trap that prompt-writer's tiebreaker rules optimize for merge mechanics (first-mover, clean-against-main, mergeable=CLEAN), not for correctness; the better implementation can lose on those axes and still be the right choice.
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.
Two parallel sessions independently opened PRs targeting the same issue (same fix scope, same files, same goal). A session-handoff prompt later asks a third session to pick a winner. The prompt's recommended tiebreaker is some combination of:
These rules are about merge mechanics, not implementation quality. They can — and do — ship the inferior PR while the better implementation gets closed.
ALL of the following must hold:
Closes #N; same files touched; same fix
intent).co-authored-by chains).gh pr diff <A> and gh pr diff <B> side-by-side
to compare implementations.If those conditions hold and you're about to merge based on the prompt's recommendation alone, STOP — run the delta check first.
A prompt authored hours ago may cite stale state (e.g., "PR #X is CLEAN, PR #Y is CONFLICTING"). Main may have advanced; the relative state often flips by the time the next session runs.
gh pr view <A> --json state,mergeable,mergeStateStatus,statusCheckRollup,additions,deletions,createdAt,headRefName
gh pr view <B> --json state,mergeable,mergeStateStatus,statusCheckRollup,additions,deletions,createdAt,headRefName
Watch for these signals that a PR may have already merged:
state: MERGED (obvious)statusCheckRollup includes post-merge workflow names (e.g., Deploy <service>: SUCCESS, Auto-deploy ...: SUCCESS, Publish ...,
Release ...) — these workflows fire on pull_request: closed and
cannot appear before mergegit log origin/main matching the PR's titleIf one PR has already merged, the "decision" is moot — focus on closing the other with coordination framing.
# Show full diff for each
gh pr diff <A> > /tmp/pr-A.diff
gh pr diff <B> > /tmp/pr-B.diff
# Or if the PRs are large, slice to the load-bearing files
gh pr diff <A> | sed -n '/diff --git.*<load-bearing-path>/,/diff --git/p'
For repos where gh pr diff returns too much output, save to file and
grep for substantive markers:
# Look for new function definitions (correctness or feature deltas)
grep -E '^\+.*(def |function |func )' /tmp/pr-A.diff | head -20
grep -E '^\+.*(def |function |func )' /tmp/pr-B.diff | head -20
# Look for new error/warning paths
grep -E '^\+.*(WARNING|ERROR|fail|catch|except)' /tmp/pr-A.diff | head -20
grep -E '^\+.*(WARNING|ERROR|fail|catch|except)' /tmp/pr-B.diff | head -20
# Look for new validation / preflight checks
grep -E '^\+.*(check|validate|verify|guard|preflight)' /tmp/pr-A.diff | head -20
For each addition that exists in one PR but not the other, ask:
| Delta type | Substantive? |
|---|---|
| New error path, retry, or fallback | YES |
| Different default value with different semantics | YES |
| Defensive validation (input range, null check) | YES |
| Different ordering of operations affecting outcome | YES |
| Pinning a value vs deriving / aliasing it | YES (often) |
| Multi-reviewer panel + fixups vs single reviewer | YES (process) |
| Different override-flag NAMING (same semantics) | NO (cosmetic) |
| Different function/variable names (same logic) | NO (cosmetic) |
| Different prose in code comments | NO (cosmetic) |
| Whitespace / formatting | NO |
| One has more / better tests for the same code path | YES (process) |
If the loser PR has ≥1 substantive advantage, override the prompt's default tiebreaker. The merge-mechanics rules don't optimize for correctness; you do.
This is a high-blast-radius decision (which PR's CODE ships to production). Even in auto-mode, ask the user before overriding the prompt's default. Frame it as: "the prompt recommends merging #X, but #Y has these substantive improvements: . Should I (a) adopt #Y and ship #X's docs as a follow-up, (b) cherry-pick #Y's improvements onto #X then merge #X, (c) just merge #X as-is and accept the gap?" Default to option (a) when #Y has real correctness fixes — those should land canonically, not as a port.
The loser's close comment should be neutral coordination framing per
feedback_coordination_framing_for_parallel_artifact_collisions.md and
should explain the substantive grounds for picking the winner — not just
"first-mover lost". This carries the lesson forward and gives the parallel
session credit for the better implementation. Cite the specific deltas.
After the override decision, verify:
git show <merge-sha> -- <load-bearing-files>).notes= field cites the specific deltas that drove
the override — this is the durable record for the next session that
reads the tracker.A handoff prompt asked S156b to pick a winner between PR #542 (first-mover, clean-against-main, single-reviewer APPROVE, wider scope incl. verification + handoff + tracker) and PR #553 (parallel, 31 min later, CONFLICTING-against- main initially, scope: #364 fix only). Prompt's recommendation: merge #542.
Pre-tiebreaker gh pr diff revealed three substantive improvements in #553:
git fetch origin main --quiet with stderr WARN on failure
in the deploy-script preflight. #542 read the behind-count from cached
state — an operator who hadn't fetched got a false "0 behind" and
passed the guard. Real correctness gap.--tag="${IMAGE}:${IMAGE_TAG}" (SHA-tagged primary) and
deploy from the SHA-tagged image. gcloud run revisions describe <rev> --format='value(spec.containers.image)' returns the source
commit directly. #542 deploys from :latest and adds :<sha> only as
a post-build alias, so describe returns :latest and operators have to
resolve the alias separately to answer "what code is in this revision?".--force scanned across $@,
F4 echo includes SHA tag). #542 had a single-reviewer APPROVE.Without the delta-check, the handoff would have shipped #542 and silently
lost all three improvements. With it: closed #542 with coordination framing
citing the deltas, shipped #542's docs as PR #560 (small docs-only follow-
up), captured the lesson in cat7-7fc tracker entry + MEMORY.md.
Don't trust prompt-cited PR state. A prompt authored hours ago may
reference stale mergeable / state values. Always re-poll
gh pr view --json state,mergeable,statusCheckRollup before deciding.
The tiebreaker rules optimize for merge mechanics, not correctness.
git rebase; doesn't predict implementation quality.feedback_multi_reviewer_convergence_fix_in_pr.md.statusCheckRollup is an early signal that a PR has already merged.
If it includes Deploy <X>: SUCCESS or Auto-deploy ...: SUCCESS or
similar post-merge workflow names, recheck state immediately — those
workflows fire on pull_request: closed and cannot appear pre-merge.
Save 5 minutes of "deciding" between two PRs when one is already in
production.
The cost of the delta-check is ~5 minutes (two gh pr diff runs +
classifying each new line as substantive or cosmetic). The cost of
skipping it is potentially weeks: a follow-up PR has to re-implement
the lost improvement, and meanwhile production runs on the inferior
fix. The asymmetric cost says "always do the check".
If both PRs are substantively equivalent, the prompt's default tiebreaker is fine. The check exists to FALSIFY equivalence, not to always reverse the recommendation.
feedback_coordination_framing_for_parallel_artifact_collisions.md
(project memory) — neutral framing for the loser-PR close comment after
this skill's delta check has picked a winnerfeedback_multi_reviewer_convergence_fix_in_pr.md (project memory) —
multi-reviewer convergent findings are stronger than single-reviewer
APPROVE; one of the substantive deltas this skill's classifier looks
forsynthetic-id-collision-rebase — same-ID register collisions in
append-only files (different mechanism: namespace, not scope)parallel-pr-template-fork-duplicates-moved-section — semantic
duplication after parallel PRs ship (different mechanism: structural
duplication via mover/forker, not scope overlap)The base skill assumes two OPEN PRs you pick between. Higher-stakes variant: one fix is already MERGED + DEPLOYED to a shared live pipeline while a parallel session built/committed a DIFFERENT fix for the same issue. Two extra moves beyond the delta-check:
main, not your branch. Grep the
actually-deployed file (+ its deployed SHA / revision) for each fix's distinctive markers to learn
which fix is live. Don't reason from "my PR merged" — a parallel session's different fix may be
the live one, or neither may be deployed. (S266b: checked Dataform main resolvedGitCommitSha +
grepped the served .sqlx for IN UNNEST vs carry-forward markers → confirmed mine live, theirs
unmerged.) Sister: version-fix-check-read-source-not-materialized-table.(S266b 2026-06-22, the-project-repo: #1271 full-key-set status_code flicker fix was
live + verified when a parallel session asked to deploy a competing carry-forward fix for the same
flicker. Verified the live serving artifact + relayed a stand-down instead of a blind deploy.)
the-project-repo repo, working through the PR #542
vs PR #553 collision on issue #364 (deploy script git-state guard).
See docs/handoffs/session_156b_finalize_s155_handoff.md (PR #560
merge commit 0b8cee93) for the full session record.feedback_review_before_merging_prs.md
(always run a code-reviewer pass before merging) — the marginal cost
is small, the marginal benefit when it catches something is large.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.