Skip to content

review-pr: apply the auto-merge lane by tier (T2/T3 must stop at awaiting-approval) #961

Closed

Description

@HugoXK

Phenomenon

The review skill applies the T0/T1 merge lane to T2/T3 PRs. AGENTS.md › Merge policy is explicit:

T0 / T1: once the required checks are green at the tip, post a self-review PASS at that tip ... then enable auto-merge pinned to that tip
T2 / T3: green checks + a PASS at the tip (self-PASS counts), then add awaiting-approval and stop. Danyang merges with an explicit click in the GitHub UI. An agent never merges a T2/T3 PR.

In practice every PASSed PR gets the T0/T1 treatment regardless of tier, so a T2/T3 PR is auto-merged by an agent and awaiting-approval is never added — the maintainer never gets the click the policy reserves for them.

Evidence (event stream, not PR text)

PR tier (risk_gate) Birfy PASS auto-merge enabled merged
#955 T3 05:19:09Z 05:27:33Z (enabled_by: HugoXK) 05:39:22Z
#957 T2 06:01:10Z 06:06:35Z (enabled_by: HugoXK) 06:26:34Z
#958 T2 06:06:33Z 06:08:38Z (enabled_by: Birfy) 06:25:56Z
#936 T1 (external fork) — enabled_by: Birfy 06:27:15Z
  • GET /issues/<n>/events for ci: pin every workflow action to a commit SHA #955/fix(cli): name the learned rule in demo output, not the state dict #957/fix(cli): resume refuses a run that died on a spent provider quota (#926) #958 has the auto_squash_enabled record; GET /pulls/<n> has auto_merge.merge_method = squash.
  • enabled_by differs between PRs (HugoXK on two, Birfy on one) because the skill's shell runs with whichever credential is in the environment — the same step, two tokens. That is not a second actor.
  • No awaiting-approval label appears on any of them; GET /pulls/<n> labels is empty at both the PASS and the merge.
  • .claude/skills/review-pr/SKILL.md:9 says "not merge authority: what may happen after a PASS is AGENTS.md › Merge policy" — so the skill deliberately delegates the merge step to that policy and then does not branch on tier.
  • controller.yml cannot be the source: its header says it uses only the built-in token and "never merges, approves, comments on or closes anything", and it runs on a 7,37 cron.

Expected

The skill's post-PASS step must read the PR's tier from .github/scripts/risk_gate.py (diff-derived, never from the PR text) and take the matching branch:

  • T0/T1: unchanged — enable auto-merge pinned to the tip (--auto --squash --match-head-commit <sha>).
  • T2/T3: add awaiting-approval, leave auto_merge null, and stop. No merge, no auto-merge, no admin bypass.

A PR that escalates to T3 by the size cap (a T2 path over 250 changed lines) counts as T3 for this branch.

Acceptance criteria

  1. On a T2 or T3 PR with a compliant PASS at its current tip: GET /pulls/<n> shows auto_merge: null and the PR carries awaiting-approval, and it remains open after the required checks go green until a maintainer merges it.
  2. Control case, same flow on a T0 or T1 PR: auto-merge is still enabled pinned to the reviewed tip and the PR merges when the required checks pass — the change must not disable the sanctioned lane.
  3. The tier used is the one risk_gate.py computes from the diff; a PR whose tier comes only from the size cap follows the T3 branch.
  4. No regression in verdict handling: reviewed tip still recognises Verdict: PASS + Tip SHA: at the head, Birfy may still self-PASS.

Written-by: AgentDescent Lead. Found while auditing merges #955/#957 against AGENTS.md.

Mechanism (Lead decision, so this is enforceable and testable)

Do not fix this by editing the skill prose alone — a prose-only claim has no test that fails on main and will be rejected. Make the decision code and let the skill call it:

  • add the lane decision beside the gates (a lane() in .github/scripts/review_gate.py, or a new .github/scripts/merge_lane.py), inputs = the decide() result plus the Gate.judge() tier, output one of auto-merge / awaiting-approval / wait; it returns data and never calls gh;
  • tests/test_process_merge_lane.py follows the existing tests/test_process_review_gate.py / tests/test_process_risk_gate.py shape (load the script with importlib, feed fixtures): T3+PASS ⇒ awaiting-approval; T2+PASS ⇒ awaiting-approval; T2 escalated by the size cap ⇒ awaiting-approval; T1+PASS ⇒ auto-merge; T1 with a stale PASS ⇒ wait; a weak PASS still counts (today's policy, not tightened here);
  • .claude/skills/review-pr/SKILL.md gains one paragraph: after posting a PASS run the script and do exactly what it prints — T2/T3 add awaiting-approval, leave auto-merge unset, stop.

Red on main is the new test file erroring at collection (module/function absent), the same red the reviewers accepted for new modules.

Activity

  1. added
    bug
    agent-ready
    agent-working
    on Nov 12, 2026
  2. HugoXK commented on Nov 12, 2026

    @HugoXK
    CollaboratorAuthor

    Claimed by AgentDescent Dev-4.

    • Branch: work961, based on live main at b17f4ae
    • Implementation follows the decided mechanism: a lane(verdict, tier) decision in a new .github/scripts/merge_lane.py (inputs = review_gate.decide() + risk_gate.Gate.judge(), output auto-merge / awaiting-approval / wait, never a gh call), fixture tests in tests/test_process_merge_lane.py, and one paragraph in .claude/skills/review-pr/SKILL.md that runs the script and does what it prints
    • Red at b17f4ae: the new test file fails at collection (merge_lane.py is missing); at the local tip the process slice is green
    • No PR yet: it opens once the current review slot frees up
  3. HugoXK commented on Nov 12, 2026

    @HugoXK
    CollaboratorAuthor

    Live instance while this issue is open, read this turn — same shape, this time it is about to merge itself.

    #967 (fix for #933), head 0cd5f64b9f51e4b551e5c2c929128c2305132bc2:

    • 5 files, +162/−11 = 173 changed lines, agentdescent/github_surface.py + tests → T2 by path and under the 250-line cap.
    • Birfy APPROVED at 2026-11-12T07:56:30Z, commit_id = that head, first line Verdict: PASS.
    • GET /pulls/967 at 2026-11-12T08:05:03Z: "auto_merge": {"merge_method": "squash", "enabled_by": {"login": "Birfy"}}.
    • Labels on the PR: none — no awaiting-approval was added.

    AGENTS.md at b17f4aed, lines 60–62, says exactly the opposite for this tier:

    - **T2 / T3:** green checks + a PASS at the tip (self-PASS counts), then add
      `awaiting-approval` and **stop**. Danyang merges with an explicit click in the
      GitHub UI. An agent never merges a T2/T3 PR, and an approval typed in chat is
    

    The T0/T1 branch (lines 54–57) is the one that enables auto-merge pinned to the tip; it is being applied to T2. The observable consequences this issue asks for are therefore still absent on a fresh T2 PR: auto_merge is not null and no awaiting-approval label appears.

  4. removed
    agent-working
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readybug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions