Uh oh!
There was an error while loading. Please reload this page.
feat(pm): approve-gated queue path for the governed surface — guard passes an authorized approval pinned to the exact head - #12755
Merged
Conversation
…uard passes an authorized approval pinned to the exact head merge_group leg: pass iff an APPROVED review by an account in GOVERNED_APPROVERS (single source in the guard script) has commit_id equal to the PR's current head sha; stale/unauthorized/dismissed/superseded never count; unreadable PR head or review list stays a refusal (exit 4). pull_request leg byte-identical, head-read-free. Protocol text gains the second legal landing path and the proactive dual review-push, and the guardrail: an agent seat never submits an approving review on a governed-surface PR, under any account. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnijPVVDakqK2J335JoJtq
This was referenced Aug 27, 2026
os-litant
marked this pull request as ready for review
August 28, 2026 05:14
os-litant
enabled auto-merge
August 28, 2026 05:14
github-merge-queueBot
removed this pull request from the merge queue due to failed status checks
Aug 28, 2026
Uh oh!
There was an error while loading. Please reload this page.
os-zhuang
approved these changes
Aug 28, 2026
This was referenced Aug 28, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#12750
Approve-gated queue path for the governed surface: the Governed Surface Queue Guard's
merge_groupleg now PASSES a governed PR iff an APPROVED review by an authorized account is pinned to the PR's exact current head sha; otherwise it refuses exactly as before. The protocol text gains the second legal landing path, the proactive dual review-push, and the agent-no-approve guardrail.Rulings executed (verbatim, untranslated)
The guard's new decision table (
merge_groupleg)GOVERNED_APPROVERS,commit_id== current head shaGOVERNED_APPROVERSGOVERNED_APPROVERS = ['os-zhuang', 'hotlong']is a frozen constant in the guard script — the single source, theCONTRACT_REVIEW_TIERpattern. The self-test pins the membership to the ruling; every rendering derives its named accounts from the constant; protocol text references the constant and never copies the names.makePullHeadReader— GET on the pull request via the same channel the review read already uses (standard GITHUB_TOKEN REST under the workflow's existingpull-requests: readscope; the workflow file is untouched). Read order per governed PR: head first, then reviews; an unreadable head refuses (exit 4) without ever constructing the review request. Sha comparison is case-insensitive; an empty/unparsable head pins NOTHING (fail closed).pull_request(early-warning) leg byte-identical, including its API surface: no head read, the pre-existing any-approver informational reading, the same rendered lines — pinned by self-test rows (spy counts the head reader's calls: 0; the renderedreview lookup(s)header andAPPROVED review present, by:line asserted verbatim). Known and accepted consequence, bound by the card's byte-identical constraint: the warned forecast sentence still says "carries an APPROVED review by then" without restating the authorized-pinned narrowing; the queue leg enforces the real predicate regardless.Protocol text — per-clause rewrites (clause homes located by grep)
.claude/skills/pm-dispatch/SKILL.md— ACCEPT path-fork, four-piece piece ② (the governed-landing rule): now states the two legal ends — 人工直合即审核记录 (fallback, unchanged) or 授权人工批准钉 head ⇒ 队列放行, with the approver set and the predicate single-sourced at the guard constant (GOVERNED_APPROVERSinscripts/pm/check-governed-queue-guard.mjs; APPROVED andcommit_id== current head; a push after approval expires it). The flip-ready/enqueue/auto-merge prohibition is retained, now conditioned: 未钉批准 ⛔ 不翻 ready、不入队、不挂 auto-merge.Same file, four-piece piece ③ (review-request step): the delivering seat now requests review from BOTH
os-zhuangandhotlongin the same stroke (2026-08-27 「需要批准的主动推送到这两个账户。」 — a proactive push, never waiting to be discovered). The 2026-08-19 push-channel provenance stays (both rulings quoted). The author-identity-422 fallback is generalized to two accounts: the account matching the PR author gets the assign fallback, the other is review-requested normally. Account names appear here because this clause already namedos-zhuang— following the file's existing convention (the dispatch's stated exception); the set's single source remains the guard constant, said in the clause.Same file, Guardrails, governed-merge bullet: gains the dated fourth ruling line (2026-08-27 second path, pointer to the fork — no re-quote, no copied names) and the hard prohibition: ⛔ agent 席位永不以任一账号对受管面 PR 提交批准 review (the authorized set contains an account agent seats also operate, so the technical control is normative — same class as the never-enqueue rule), and the after-the-fact audit line now reads the APPROVER as well as the merger: agent 批准或不认识的合并 = 违规立案回滚.
references/contract-review.md— 清标即落地, the 三样不变 mention: updated so the pointer-level mention matches the fork's two legal ends (人工直合或授权批准钉 head 入队, single source pointed at the main file) and the chain-side echo of the prohibition: 链永不入队亦不代批. Net 0 lines (48/48).references/landing-operations.md: untouched — grep found no governed-landing clause there beyond the main-red 人工直合 exception mention, which stays correct (direct merge remains legal).Cut ledger (zero-headroom ratchets — net 0 per file, surviving homes)
SKILL.md 1005 → 1005 (seam lines 756-765: 10 → 8; Guardrails bullet: 5 → 7). Cuts, each with its surviving home:
update_pull_requestalways sending the draft bit, the reviewers-only incident, the dedicated REST endpoint — all survive in full atreferences/platform-readings.md(the「update_pull_request 不管传不传都发送 draft 位」 entry); SKILL.md keeps the operative rule + pointer.No re-wrap purchases: freed lines come from the content cuts above; the two long quote-spanning lines in the rewritten seam follow the file's existing convention for such lines (the same shape the untouched neighbors already use).
Verification (all at head b5fb638; exit codes captured before any pipe; verdict lines quoted from the gates themselves)
✓ check-governed-queue-guard self-test: 113 cases pass (register-driven verdicts, the queue/PR event split, latest-decisive approval reduction, the 2026-08-27 authorized-approval-pinned-to-head predicate on the queue leg — pass, stale, unauthorized, dismissed/superseded, none — with the PR leg byte-identical and head-read-free, ...)(exit 0, captured asEXIT=0before the file was paged).pnpm check:pm-skill-ratchetper-file:✓ ... SKILL.md is 1005 lines (ceiling 1005; headroom 0)·✓ ... SKILL.md: widest table row is 765 bytes (pin 765; headroom 0)·✓ ... contract-review.md is 48 lines (ceiling 48; headroom 0)·✓ ... landing-operations.md is 80 lines (ceiling 80; headroom 0).✓ check-skill-id-lint: 23 file(s) clean (pattern /#[0-9]{3,}/g).✓ check-governed-prose: 2 instruction surface(s) name all 5 registered governed surfaces (docs/adr/** · .claude/** · skills/** · AGENTS.md · CLAUDE.md) and claim no others.✓ check-skill-frame-sync: 4 copies of the decision frame are structurally isomorphic across 3 files·✓ check-skill-frame-freshness: the decision frame in this tree is current with origin/main (fetched just now).node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack— first stderr line:dispatch-gates: gate list derived from the tree of 'objectstack-ai/objectstack' at commit b5fb6383a. All 17 matched families run green in one os-verify-lock invocation (os-verify-lock: VERDICT command-exit 0), including check:agent-test-spelling, check:bash32-floor, check:cli-command-ids, check:cross-package-test-inputs, check:doc-authoring, check:doc-formula-expressions (afterturbo run build --filter=@objectstack/formulaand--filter=@objectstack/lintcleared its PREREQUISITE NOT MET — not a red, nothing was measured before the build), check:entry-guard, check:parse-guard, check:pm-governed-merges (self-test 206 assertions), check:pnpm-filter-targets, check-ci-filter-parity, check-cross-package-test-inputs. Convention-triggered by the gate-script edit and run green:node scripts/pm/bare-root-worklist.mjs --self-testandpnpm check:pm-dispatch-gates(✓ dispatch-gates self-test: 719 cases pass.). Alsocheck-nul-bytes: OK (scanned 7093 text file(s) ...).scripts/vercel-ignore-docs.sh/.selftest.sh— neither is in this diff's surface; the queue's merge-time re-validation covers the range.--self-testis the suite, run above.merge_grouphalf (a real queue build with the real GITHUB_TOKEN) is CI-only — the end-to-end wiring is exercised in the self-test with injected readers; the workflow invocation is unchanged and untouched.Acceptance replay (the card's four scenarios)
the-pinned-predicate-is-wired-end-to-end-an-authorized-pinned-approval-CLEARS(runGuard, head read + review read, CLEARED exit 0), plus per-login rows for both constant members.the-pinned-predicate-is-wired-end-to-end-a-stale-approval-REFUSES(exit 3) and the render row proving the refusal names both shas.an-unauthorized-account-approval-REFUSES-the-merge-group-with-code-3and its never-counts render row.Notes for the reviewer
--testpredicate, workflow yml, branch-protection assumptions, labels — all untouched.os-zhuang— existing file convention); piece ② and the Guardrails reference the constant without names.Generated by Claude Code
Generated by Claude Code