Skip to content

Commit 8258383

Browse files
committed
feat(pm): an enqueue by an authorized account is the human review at the queue
The governed queue guard's merge_group leg now passes a governed PR when EITHER an account in GOVERNED_APPROVERS holds a latest-decisive APPROVED review (unchanged, read first) OR that account put the entry in the queue, read as the actor of the newest added_to_merge_queue timeline event. An undetermined enqueuer is never a pass. The size limb follows the same predicate through the sibling's sizeLiftFrom. AGENTS.md Prime Directive 14 names the enqueue as part of the maintainer's hand. Claude-Session: https://claude.ai/code/session_01XDSBMAmqzG7QYwCD7qAGty Co-authored-by: Claude <noreply@anthropic.com>
1 parent d7e1af1 commit 8258383

2 files changed

Lines changed: 83 additions & 10 deletions

File tree

‎AGENTS.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,9 @@ localStorage / auth gotchas.
261261
When a cloud decision's **mechanism half** governs open code here, this repo carries its own ADR — own number, a
262262
`## Provenance` section naming the cloud record and its date, the commercial half left in cloud — and the cloud
263263
record gains a one-line pointer. Files never move between registries and numbers are never reassigned.
264-
14. **⛔ A governed surface lands only the way its tier allows — Tier H by the maintainer's hand or by an authorized
265-
approval, Tier S by the owning seat on a contract-tier review of record; before that record no AI seat merges,
264+
14. **⛔ A governed surface lands only the way its tier allows — Tier H by the maintainer's hand (a direct merge, or
265+
an enqueue from an account in `GOVERNED_APPROVERS`) or by an authorized approval, Tier S by the owning seat on a
266+
contract-tier review of record; before that record no AI seat merges,
266267
queues, or arms auto-merge on a PR whose diff touches one.** The governed surfaces are `docs/adr/**`,
267268
`docs/NORTH-STAR.md`, `.claude/**` (agents, hooks and settings — not only skills), `skills/**`, `AGENTS.md`,
268269
`CLAUDE.md` and `.github/workflows/**`, and under `ui/` `ui/docs/adr/**`, `ui/.claude/**`, `ui/skills/**`,
@@ -280,13 +281,16 @@ localStorage / auth gotchas.
280281
(人合: every register row except `.claude/**`): those four lift only for an
281282
authorized APPROVED review by an account in `GOVERNED_APPROVERS`, on ANY commit and not dismissed; that word is
282283
spent once per PR — the OWNING seat then lands it, later pushes included; the director seat requests the word as
283-
ONE batch of at most five rows, and the click stays the maintainer's. **Tier S** (席内达档复核落地: all of
284+
ONE batch of at most five rows, and the click stays the maintainer's. The maintainer's own enqueue from an account
285+
in `GOVERNED_APPROVERS` is a review record too — the queue guard clears that entry with no approval — for that
286+
entry only: re-entry after an ejection needs the approval or another such enqueue. **Tier S** (席内达档复核落地: all of
284287
`.claude/**`): those four lift once the PR thread or its card carries a `## Contract review` record for the PR's
285288
current head with `Served-tier: CONTRACT_REVIEW_TIER` and a PASS verdict and every check is green — the owning
286289
seat then lands it through the queue; the post-merge audit is the compensating control. A PR whose only governed
287290
paths are register rows the queue leg regenerates byte-exact clears with zero approvals — an uncertified
288291
recompute, drift or a hand-authored sibling keeps it governed. ⛔ **No agent seat submits an approving review on a
289-
governed-surface PR, under any account** — an authorized account is agent-operated too; "CI is green" carries no
292+
governed-surface PR, nor queues or arms auto-merge on one before its record, under any account** — an authorized
293+
account is agent-operated too; "CI is green" carries no
290294
information about a governance change.
291295

292296
**Already armed or queued when you read this?** Disable auto-merge AND convert it back to **draft**, which disarms
@@ -516,7 +520,7 @@ Even inside your own worktree, operate defensively:
516520
so re-read it rather than recalling it); (b) the **Version Packages** PR, or any PR whose merge performs a
517521
release (**Prime Directive #15**); (c) a PR whose **changed lines exceed 3,000** (`additions + deletions`,
518522
generated files included) — it lands the way a Tier H surface does: an authorized APPROVED review and then
519-
the owning seat, or a human merge. Read the PR's file list (`get_files`), **its author and its size** before
523+
the owning seat, or the maintainer's own merge or enqueue from an account in `GOVERNED_APPROVERS`. Read the PR's file list (`get_files`), **its author and its size** before
520524
you arm anything.
521525

522526
**Green means the gate-carrying jobs' `conclusion` is `success`** — not "no failure

‎scripts/pm/check-governed-queue-guard.mjs‎

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,68 @@
141141
* agreed to. It is printed loudly as an informational line so a reader is
142142
* never surprised by it. Widening it is a one-line maintainer decision.
143143
*
144+
* ## The ENQUEUE leg — the maintainer's own enqueue IS the review (2026-10-26)
145+
*
146+
* The maintainer, on the phone, where the button is "Merge when ready" (an
147+
* enqueue) and the queue guard then still wanted a separate Approve — verbatim
148+
* and untranslated (#26066):
149+
*
150+
* > 也就是说推送到我的手机上,以前都是需要我点一下核准,然后再点合并,以后我可以直接点合并是吗
151+
* > 大部分我还是希望入队,但是我想省掉 Approve
152+
*
153+
* and the logins behind that click: 「os-zhuang 或 hotlong」 — both already in
154+
* `GOVERNED_APPROVERS`, which stays the single source and does not grow. So the
155+
* `merge_group` leg passes a governed pull request iff EITHER an authorized
156+
* account holds a latest-decisive APPROVED review (the 2026-09-04 predicate
157+
* above, unchanged and read FIRST) OR the account that put this entry in the
158+
* queue is an authorized one. Everything else stands: an enqueue by any other
159+
* account still needs the approval, Tier S still lands on its record, a fork is
160+
* still lifted by nothing, and the bypass-rules direct merge is still the other
161+
* landing.
162+
*
163+
* ⭐ WHY THIS IS NOT THE ACTOR-FIELD ATTRIBUTION #11704 RETRACTED. That
164+
* retraction refused to read "who pushed or merged" as a review. The ruling
165+
* that founded this regime (2026-08-18, carried in `check-governed-merges.mjs`)
166+
* already named the enqueue as the record — 「人工合并即人工审核:governed PR 的审核
167+
* 记录 = 你按下合并/入队那个动作本身」 — and the identity concern behind the
168+
* retraction is answered for this leg exactly as it is for the approval leg,
169+
* normatively: ⛔ no agent seat enqueues or arms auto-merge on an unapproved
170+
* governed PR, under ANY account (AGENTS.md Prime Directive #14). An entry an
171+
* authorized account made can therefore only be the human's click, as an
172+
* authorized approval can only be the human's review. With this leg that
173+
* prohibition carries the same weight the approval-side one does: it is the
174+
* ONLY thing between an agent seat holding an authorized account and a governed
175+
* landing it cleared for itself, and the post-merge audit reads the enqueuer
176+
* the way it reads the approver.
177+
*
178+
* ⭐ THE READING, MEASURED on this repository on 2026-10-26 (REST): the actor
179+
* of the NEWEST `added_to_merge_queue` timeline event. "Merge when ready" with
180+
* checks pending ARMS auto-merge and the platform enqueues later; the add
181+
* event's actor is then the account that armed it (#26154, #26011). A direct
182+
* enqueue leaves an add event and never sets `auto_merge` (#26166). The pull
183+
* object's `auto_merge.enabled_by` therefore answers the first path only, is
184+
* null on the second and after a merge, and is not read. The timeline route
185+
* answers `X-Accepted-GitHub-Permissions: issues=read; pull_requests=read`, so
186+
* the workflow's existing `pull-requests: read` covers it.
187+
*
188+
* ⛔ UNDETERMINED IS NEVER A PASS, and never a refusal of its own: no add event,
189+
* an add with no actor, an unreadable or truncated timeline (the newest event is
190+
* on the LAST page), and a newest queue event that is a REMOVAL — the entry this
191+
* build judges not yet on the timeline, so the add before it is an entry that
192+
* already left — all leave the approval leg to decide alone, on its own exit
193+
* code. ⚖️ The accepted cost, stated where it is paid: as with an approval on
194+
* any commit, a push made after the click and before the entry lands is not
195+
* re-reviewed here; and the click counts for THAT entry only — a seat's
196+
* re-enqueue after an ejection is a new entry by a seat account, which needs
197+
* the approval or another such click.
198+
*
199+
* ⚖️ THE COST: one timeline read per governed pull request the approval did
200+
* not satisfy — never for one it did (MONOTONE, read SECOND, and a Tier S
201+
* record is consulted only after it). The SIZE leg follows the same predicate
202+
* through the sibling's lift (`sizeLiftFrom`, which reads the enqueue reading
203+
* handed to it beside the approval verdict); an oversized pull request the
204+
* governed leg already read costs no second timeline read.
205+
*
144206
* ## Ordering: the path test runs FIRST, and a clear diff costs zero API calls
145207
*
146208
* ⛔ Fail-open on an API error is WRONG in this file — this guard exists
@@ -429,12 +491,15 @@
429491
*
430492
* 0 CLEAR — nothing governed in the diff (no API call was made), or every
431493
* governed PR carries an authorized APPROVED review (on ANY
432-
* commit — 2026-09-04), or this is the `pull_request`
494+
* commit — 2026-09-04) or was enqueued by an authorized
495+
* account (2026-10-26), or this is the `pull_request`
433496
* early-warning run.
434497
* 3 REFUSED — governed, and at least one governed PR carries no authorized
435498
* APPROVED review (none at all, unauthorized account, dismissed
436-
* or superseded) — and, on the references tier, no review of
437-
* record on its current head either.
499+
* or superseded) and was not enqueued by an authorized account
500+
* (another account, or an UNDETERMINED enqueuer) — and, on the
501+
* references tier, no review of record on its current head
502+
* either.
438503
* Deliberately 3, the same code the sibling's `--test`
439504
* answers "GOVERNED" with, so the two tools agree on the number
440505
* that means "this diff is governed and unsatisfied".
@@ -456,7 +521,8 @@
456521
* `HUMAN_MERGE_LINE_THRESHOLD`, generated files included
457522
* (#19036, the 2026-09-18 ruling) — and NO authorized APPROVED
458523
* review lifts it (none, unauthorized, dismissed/superseded, or
459-
* the review list could not be read; 2026-09-27, #20153). The
524+
* the review list could not be read; 2026-09-27, #20153), nor
525+
* an enqueue by an authorized account (2026-10-26). The
460526
* SIZE leg, not the governed one; its remedies are an authorized
461527
* approval and then the owning seat's landing, or a human merge.
462528
* 9 REFUSED — the SIZE leg could not READ a queued pull request's size (the
@@ -5084,7 +5150,10 @@ export async function selfTest() {
50845150
'drifting back to a bare click, and passing with the reading PRINTED when the field is unreadable — and the ' +
50855151
'queued pull-back: every refusal kind on both legs sends the queued pull request to the maintainer\'s manual ' +
50865152
'removal, disarms it and confirms from the remote, and no rendering claims a DRAFT conversion dequeues it, ' +
5087-
'with a detector control that fires on every listed spelling.',
5153+
'with a detector control that fires on every listed spelling — and the 2026-10-26 ENQUEUE leg: an entry an ' +
5154+
'account in GOVERNED_APPROVERS put in the queue clears with no APPROVED review and lifts the size limb through ' +
5155+
'the sibling, a seat enqueue still refuses, an UNDETERMINED enqueuer (no add, a removal newest, an unreadable or ' +
5156+
'truncated timeline) is never a pass, and the approval is still read first.',
50885157
);
50895158

50905159
selfTestReachedVerdict = true;

0 commit comments

Comments
 (0)