Skip to content

Fuse pre-merge pr_state gate into Merge and close host PR tool bypasses - #229

Merged
sreejithraman merged 3 commits into
mainfrom
docs/improve-merge-skill-wording
Nov 22, 2026
Merged

sreejithraman merged 3 commits into
mainfrom
docs/improve-merge-skill-wording

Conversation

@sreejithraman

Copy link
Copy Markdown
Owner

Summary

Rewrites skills/merge/SKILL.md from scratch and updates skills/pr/references/watch.md and skills/pr/references/publish.md so host PR tools (such as T3's pull_request_* tools) cannot implicitly bypass pr_state.py, review-fix-loop, or provisional-PR stops when landing changes.

Root cause: Under host prompts that prefer pull_request_* over gh, agents skipped pr_state.py and called pull_request_merge (which enforces expectedHeadSha but does not check review-fix-loop commit statuses or provisional blocks), while skills/merge/SKILL.md previously buried the review check in a separate step above Land.

Key changes:

  • skills/merge/SKILL.md:
    • Hoists ## Shared rules once up front: pr_state.py is the sole readiness/merge gate (host PR tools do not run or replace it), and caller-owned repair mode handles stops first before returning gaps without repairing.
    • Orders stop handling and armed-landing cancellation ahead of repair dispatch in Step 2 (Bring to ready), terminates cleanly on stops, moves Preserve local files into Step 2 where local history edits occur, and requires posting the review-fix-loop status on clean review.
    • Fuses the readiness check and merge execution into one gated Step 3 (Land) with a runnable pr_state.py --head pre-merge checklist aligned with watch.md#ready-or-blocked, requiring the agent to name each PR's exact verified head SHA and passing review-fix-loop status before submitting any merge.
    • Uses exact-head single-PR merges (pull_request_merge with expectedHeadSha and without auto: true, or gh pr merge --match-head-commit), disallows single-PR auto-merge and pull_request_merge stack: true, states plainly that stack merges require landing-branch protections enforcing current-head review on every layer, and passes --head <verified head> to post-merge confirmation so moved-head detection triggers.
  • skills/pr/references/watch.md: States in Read the state that host PR tools do not replace pr_state.py because they skip review-fix-loop, provisional checks, and complete paginated readiness.
  • skills/pr/references/publish.md: Prefers host PR tools or the GitHub connector for PR creation/updates while retaining gh for missing capabilities, current-branch discovery, and cross-repo heads.

Evidence

  • Repository checks (local, commit c98fc839e0a1d956775a312e3cc1016134b2638c): python3 scripts/check.py passed — 63 skills checked (frontmatter, Markdown links/anchors, skill link hygiene, whitespace) and 564 tests across 26 files passed (exit 0).
  • Independent multi-model review (rfl-merge-gate-20261122, 3 passes): Wave 1 (Primary Antigravity Gemini 4 Neon High, Ponytail Claude Opus 5.5 High, Thermo Codex GPT-6.2 Sol High), Wave 2 Adversarial (first discovery, Claude Opus 5.5 High), and Pass 2/3 Primary repair & cumulative verification (Antigravity Gemini 4 Neon High) converged with zero remaining issues on c98fc839.
  • Plan-only fresh-session behavioral trials (Claude Opus 5.5 & Codex GPT-6.2 Sol): Both passed 3/3 scenarios under T3's pull_request_* host prompt (blocked unreviewed PR via pr_state.py, merged ready single PR via pull_request_merge with expectedHeadSha without auto/stack and confirmed via pr_state.py --head, and reported the branch-protection blocker on an unprotected 2-layer stack).
  • Proof gap: Live forge pull_request_merge execution trials were not run (stubbed T3 MCP harness unavailable; live merge calls risk forge side effects). Enforcement without GitHub branch protection still depends on agents following the skill instructions.

Merge Danger

Two-way door: markdown-only changes to skills/merge/SKILL.md, skills/pr/references/watch.md, and skills/pr/references/publish.md. Reverting the merge commit restores prior skill wording cleanly with no data, schema, or script state affected.

sreejithraman and others added 3 commits November 22, 2026 14:50
Restructure skills/merge/SKILL.md so pr_state.py is explicitly the sole
readiness gate and the pre-merge checklist sits directly above the merge
call in Land, requiring the agent to name each PR's verified head SHA
and passing review-fix-loop status before calling pull_request_merge,
gh pr merge, gh stack merge, or a GitHub connector. Clarify in pr's
watch and publish references that host PR tools do not replace
pr_state.py and that commit statuses still use gh.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…erge guards

- Align Step 3 Pre-merge gate with watch.md#ready-or-blocked so valid
  current-head CI dismissals, filtered stack workflows, user-approved
  review waits, and newly arrived to_settle items are handled properly.
- Order stop handling and armed-landing cancellation ahead of repair
  dispatch and caller-owned repair returns in Step 2 and Shared rules.
- Guard T3 pull_request_merge against auto: true and stack: true,
  requiring explicit deferred-landing and per-layer protections.
- Use the runnable pr_state.py command syntax, restore missing
  verification and status-posting steps in Step 2, and keep publish.md
  focused on PR creation and updates.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… guards, and pass --head on merge confirmation

- Make Step 2 stop handling explicitly terminate without repairing or
  landing, and update Step 3 gate failures so stops terminate rather
  than chaining into repair routing.
- Reorder the Step 3 readiness bullet so to_settle and feedback
  settlement unambiguously apply even with watch.md CI-dismissal or
  user-approved review-wait exceptions.
- Forbid auto: true / --auto on single-PR merges, state plainly that
  neither gh stack merge nor pull_request_merge guards per-layer heads
  at submission (requiring landing-branch protection for stacks), and
  pass --head <verified head> to pr_state.py during merge confirmation
  so moved-head detection actually triggers.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sreejithraman
sreejithraman merged commit 8f661a8 into main Nov 22, 2026
2 checks passed
@sreejithraman
sreejithraman deleted the docs/improve-merge-skill-wording branch November 22, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant