gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes

gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes is a skill for Claude Code from wan-huiyan/agent-traffic-control. It costs 417 tokens per session (3,036 once invoked), scanned A, original, MIT.

A guide to two GitHub command-line merge situations: a pull request that is ready but waiting for required checks, and a remote branch that can be deleted too early. Branch protection is a repository rule requiring checks or approvals before merging.

In plain words
What is it for?
Use it when `gh pr merge` mentions conflicts or `--auto`, when checks are still pending, and when cleaning up remote branches safely.
Why use it?
It separates a waiting-for-checks state from a real file conflict and explains how deleting a branch can affect an unmerged pull request.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions Claude Code.

Part of the agent-traffic-control plugin — 107 skills shipped together

Good fit Use it when gh pr merge mentions conflicts or --auto, when checks are still pending, and when cleaning up remote branches safely.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add wan-huiyan/agent-traffic-control --skill gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes
Clone the repo
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control

Made for: Claude Code.

Or install agent-traffic-control, the plugin that ships this one along with the rest of its 107 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes

README.md
[![agentmods](https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes/github.svg)](https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes)
Your own site
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes

Your own site · 80×15
<a href="https://agentmods.dev/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes"><img src="https://agentmods.dev/badge/skills/wan-huiyan/agent-traffic-control/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 417 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,036 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00417 $0.03036
Opus 5 $0.00209 $0.01518
Sonnet 5 $0.00083 $0.00607
Haiku 4.5 $0.00042 $0.00304

Measured 12d ago against content hash 7ca1bb3046f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/agent-traffic-control/skills/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes/SKILL.md · 236 lines

How it starts

The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.

gh pr merge UNSTABLE state + branch-delete recovery

Problem

Two adjacent failure modes that read as "merge conflicts" but aren't:

Failure A: gh pr merge rejects with "conflicts" when there are none

You push a clean resolution of merge conflicts, GitHub shows the PR as MERGEABLE, and yet:

$ gh pr merge 915 --squash
To have the pull request merged after all the requirements have been met,
add the `--auto` flag.
Run the following to resolve the merge conflicts locally:
  gh pr checkout 915 && git fetch origin main && git merge origin/main

The first line is the actual hint; the second is misleading boilerplate. The real cause is mergeStateStatus: UNSTABLE — branch protection or CI checks are pending. gh can't merge yet because the repo's rules aren't satisfied, not because of file-level conflicts.

Failure B: PR auto-closes if you delete the remote branch right after Failure A

Common pattern: previous PR on the same branch merged cleanly with gh pr merge <N> --squash. You then do git push origin --delete <branch> to clean up. Habit kicks in for the next PR — you run gh pr merge (gets Failure A above), notice the "conflicts" warning, run git push origin --delete <branch> anyway thinking the merge already landed remotely...

$ gh pr view 915 --json state
{"state":"CLOSED"}   # ← not MERGED — the PR closed because the branch was deleted with the merge un-queued

GitHub treats a deleted-branch PR with no merge in progress as abandoned and closes it.

Context / Trigger conditions

  • gh pr merge --squash (or --merge) returns with the "add the --auto flag" / "resolve conflicts" stderr
  • gh pr view <N> --json state,mergeable,mergeStateStatus shows {state: OPEN, mergeable: MERGEABLE, mergeStateStatus: UNSTABLE} — the UNSTABLE is diagnostic; it means "no real conflicts, but checks aren't passing yet"
  • Or: a PR you just tried to merge is now state: CLOSED rather than state: MERGED, AND the remote branch is missing
  • Repo has branch protection rules (required status checks, required reviews) OR CI workflows that haven't completed yet
  • You're in a multi-PR session where the previous PR merged cleanly, conditioning you to expect the same flow

Read the full file on GitHub · 236 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 236 lines · 417 tokens per session scan A 7ca1bb3046f4

Subscribe to this mod's changes

gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes is a skill published in the GitHub repository wan-huiyan/agent-traffic-control (3 stars, last pushed today), licensed MIT. It adds 417 tokens to every session and 3,036 once invoked, about $0.0021 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories