Skip to content

fix(pm): the governed-merges audit reads the queue's own removal up to 1 s before merged_at as the merge's - #38896

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-38863-queue-removal-window
Dec 1, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/issue-38863-queue-removal-window

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #38863
Refs #34178
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户无感:每周治理合并审计不再把维护者本人经合并队列落地的改动,误报成席位违规。
  • 为治理审计这一车队工具消除误报:合并队列在合并前一秒记下“移出队列”,旧读法把它当成最新的队列事件,读不出是谁把改动放进队列;现在只对队列机器人在合并前一秒之内的那一次移出放行,一秒是十二条误报上全部实测到的间隔。
  • 出错只会让审计报告漏报或继续误报,不影响任何合并;可直接撤回本次改动恢复旧读法。
  • 要你做的:这是须由维护者批准的治理面改动,批准一次即可。

What changes

scripts/pm/check-governed-merges.mjs only (Tier H: an always-H instrument).

Tests

Self-test pins, under node scripts/pm/check-governed-merges.mjs --self-test (1017 assertions, exit 0 on 062ea49f4):

Ablation (fix committed first; every mutation via scripts/ablation-replace.mjs, restored to the HEAD blob)
  • Enqueue leg back to the plain cut: red on 3 pins (the one-second shape, the re-add after an ejection, the split leg's one-second shape). The controls stay green, as expected, because the old reading was already undetermined for them.
  • Actor binding removed: red on the another-actor pin and on the split pin. A first attempt was a no-op: the tool refused because the replacement text already existed elsewhere. It was re-run with a unique replacement.
  • Window widened to 60 s: red on the outside-the-window pin and the pure-reader pin.
  • Last-event binding removed: green at first, which exposed a gap. Added the pin for a queue-bot removal that an add follows (commit 062ea49f4). Re-ablated: red.

Re-run on #34178's rows

Enqueue leg, read on each PR's live timeline and merged_at through the real guard, before (strict cut) and after (timelineAsQueued):

PR queue events (UTC) gap before after
#37072 add os-zhuang 19:16:14 · rem bot 19:34:41 1 s undetermined authorized (os-zhuang)
#36775 add os-zhuang 22:00:38 · rem bot 22:21:05 1 s undetermined authorized (os-zhuang)
#36067 add os-zhuang 17:33:58 · rem bot 18:06:13 1 s undetermined authorized (os-zhuang)
#35673 add os-zhuang 22:28:18 · rem bot 23:03:52 1 s undetermined authorized (os-zhuang)
#35709 add os-zhuang 04:52:39 · rem bot 05:21:36 1 s undetermined authorized (os-zhuang)
#33355 add · rem 09:52:16 · re-add os-zhuang 11:13:10 · rem bot 11:50:11 1 s undetermined authorized (os-zhuang)
#33577 add os-zhuang 02:51:26 · rem bot 04:44:21 1 s undetermined authorized (os-zhuang)
#33589 add os-zhuang 02:50:20 · rem bot 04:44:21 1 s undetermined authorized (os-zhuang)
#33394 add · rem 21:48:10 · re-add os-zhuang 22:52:01 · rem bot 00:44:32 1 s undetermined authorized (os-zhuang)
#32841 add os-zhuang 01:28:50 · rem bot 02:13:54 1 s undetermined authorized (os-zhuang)
#32839 add os-zhuang 23:39:46 · rem bot 00:33:14 1 s undetermined authorized (os-zhuang)
#32313 add os-zhuang 23:44:14 · rem bot 00:13:08 1 s undetermined authorized (os-zhuang)
control #33555 removal == merged_at 0 s authorized (os-zhuang) authorized (os-zhuang)
control #33632 removal == merged_at 0 s authorized (os-zhuang) authorized (os-zhuang)
control #33616 enqueued by objectstack-fleet[bot] 0 s unauthorized unauthorized

End-to-end sweep, the real CLI on both trees with --since 2026-11-24T19:30:00Z --repos objectstack --json. Both runs complete, 228 entries each:

NOT MEASURED: the end-to-end sweep row for the other eleven PRs. A window back to 2026-11-10 timed out at 570 s, and a 7-day window already takes about 8 minutes per tree, so this container's 10-minute foreground limit cannot fit it. Their enqueue-leg reading is in the table above. The weekly audit job will read them on its next run.

Smaller finding: recommendation for the seat to route

Recommendation: enforce the record template where the record is written. Do not widen the reader. This PR changes no recogniser (record-recognisers.mjs is outside the claimed surface).

  • Evidence: the template the reviewer is handed already spells both forms the 8 rows missed (scripts/pm/record-recognisers.mjs lines 2555–2559 on 197e3ff3b): a clean round is written No must-fix, no should-fix., and the delta record names what it closes as S1: closed. The rows wrote must-fix 0 · should-fix 0, S1 closed. and F1 (must-fix on SHA): fixed., which are off-template.
  • Reason: the audit reads records through the queue guard's own reader, so the audit and the queue agree on what a record says. Widening the reader alone would make them disagree. Widening it for both changes what the queue accepts, a contract we own on both ends (AGENTS.md Prime Directive Add comprehensive test suite for Zod schema validation #12: reject off-spec input at authoring, never accept a dialect). A check when the record is written tells the reviewer at once, while the record can still be fixed.
  • After this PR, those 12 rows clear on the enqueue leg, so the phrasing gap no longer decides them. It matters only for seat landings, where the queue already refuses the same phrasing.

Acceptance notes

  • origin/main moved one commit past the base (3c617a28e, packages/spec and ui/ only, nothing under scripts/pm/). It was not merged in, because the diff does not overlap it.
  • For the live sweep, this container's shallow clone was deepened with git fetch --shallow-since=2026-11-02 origin main (additive).

Verification

Read first:

  1. timelineAsQueued and MERGE_QUEUE_REMOVAL_WINDOW_MS (the risk hunk: the three conditions that drop an event).
  2. The one-line change in readLandingClearance.
  3. The WINDOW pins in the pm: the post-merge governed audit has no owner or schedule, and shows a seat landing through the low-risk arm as a breach #33603 battery.

Two-minute check: run node scripts/pm/check-governed-merges.mjs --self-test. Expected: ✓ check-governed-merges --self-test: 1017 assertions, exit 0.

Local gates on 062ea49
  • The derived set is node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, 63 commands. Reconciled with --ran: 63 derived, 61 run, 2 NOT-MEASURED, 0 UNRUN.
  • NOT MEASURED, both left to CI:
    • pnpm check:i18n-coverage: exit 3, PREREQUISITE NOT MET (no CLI or examples build in this worktree).
    • pnpm check:pm-dispatch-gates: killed by timeout at 200 s and again at 280 s on the shared box, so it never reached a verdict.
  • node scripts/check-self-test-workflow-commands.mjs first failed when its spawn timed out (spawnSync node ETIMEDOUT) while the box was loaded. Re-run alone: exit 0.
  • Every other command: exit 0.
  • No changeset: scripts/pm/** is not published (skip-changeset).

Generated by Claude Code

…o 1 s before merged_at

The enqueue leg cut the timeline strictly before `merged_at`, so a
`removed_from_merge_queue` that `github-merge-queue[bot]` stamped one
second before the merge survived the cut and read as the newest queue
event: the maintainer's own enqueue read as undetermined and the row fell
through to the record leg as a seat BREACH (all twelve rows of #34178).

`timelineAsQueued` drops that removal only when it is the last queue
event, its actor is the queue bot, and it sits within
`MERGE_QUEUE_REMOVAL_WINDOW_MS` (1 s, the measured gap) of `merged_at`.
Any other actor, a removal further out, or an earlier removal followed by
a re-add reads as before.

Claude-Session: https://claude.ai/code/session_01WGufzfWWgrLkABDvbRjhAk
Co-authored-by: Claude <noreply@anthropic.com>
…inal queue event

Claude-Session: https://claude.ai/code/session_01WGufzfWWgrLkABDvbRjhAk
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Dec 1, 2026
@github-actions github-actions Bot added the size/m label Dec 1, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfWWgrLkABDvbRjhAk

Final green head: 062ea49f42ede314189541a27d16c21f991a3ef1 (dev report 7308260346 on #38863). Read at 2026-12-01T10:45Z: 26 check-runs succeeded and 27 were skipped, none red or pending; mergeable_state is clean. One file, scripts/pm/check-governed-merges.mjs, +102 −8. Tier H (always-H instrument). Sent to the zone's L1 thread for L1 and a contract-tier L2.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head 062ea49 · 2026-12-01T10:46Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 062ea49f42ede314189541a27d16c21f991a3ef1
Local-runs: none
Scope: scripts/pm/check-governed-merges.mjs + none

Read: card #38863 with its three comments (triage 7304869940, claim 7306497669, os-dev-report 7308260346), the PR body and file list, the net diff against main (one file, +102 / -8, merge base 197e3ff3b), and the check-runs on the head. Read but not reviewed: enqueuerFromTimeline, authorizedEnqueueVerdict, ENQUEUE_EVENT and DEQUEUE_EVENT in scripts/pm/check-governed-queue-guard.mjs, and .claude/skills/pm-dispatch/references/readings-queue.md, all at the head. The timeline readings the docblock cites are taken from the card and the PR body; they were not re-read from GitHub.

① Derived judgments

  • The audit's cleared by enqueue set widens. Right. A landing whose newest queue event before merged_at is a removed_from_merge_queue by github-merge-queue[bot], stamped at most 1 s before merged_at, now reads the enqueuer of the add before it. With an authorized enqueuer the row moves from breach or pass to cleared. This is the reading the queue guard itself took in the merge group, where the newest queue event was the add. The move of docs(skills): the refusal-list teaching names the server its /data facts were read on #38233 from pass to cleared follows from the guard's own leg order (approval, enqueue, then record) and is right.
  • No seat landing gains a clearance. Right. The enqueuer still passes through the unedited authorizedEnqueueVerdict against GOVERNED_APPROVERS. Tried against the tree:
    • A seat enqueue on the one-second shape stays unauthorized.
    • An earlier ejection followed by a re-add leaves the add as the last queue event, so nothing is dropped and the re-add's actor decides. The guard's rule that an earlier enqueue is never carried onto a later entry holds.
    • A removal by another actor, or one 2 s or more out, is the plain cut and stays undetermined.
    • A removal stamped after merged_at is dropped by the strict cut, as before.
    • Guard event names that are not strings drop nothing.
    • The one shape the window cannot tell apart is a queue ejection followed within 1 s by a merge that bypassed the queue, with no re-add. The equal-instant reading on main already has that property, so the diff adds one second to it, and it is accepted.
  • Three new exports: MERGE_QUEUE_BOT, MERGE_QUEUE_REMOVAL_WINDOW_MS, timelineAsQueued. Right. They are module exports of an unpublished fleet script, used by its own self-test. No importer of this file reads them, and ARM_READER_EXPORTS (what the audit asks of the guard) is unchanged.
  • Self-test floors 71 to 77 and 35 to 36. Right. The diff adds six assertions to the pm: the post-merge governed audit has no owner or schedule, and shows a seat landing through the low-risk arm as a breach #33603 battery and one to the pm: after the .claude/** declaration split lands, the relay review plan and the patrol landing row still read the raw Tier S and never ask the maintainer #35612 battery. Lint · scoped · tooling self-tests and Lint · PM dispatch-gates concluded success on the head.
  • The guard is not edited. Right. The queue's accept set is unchanged; only the audit's reconstruction of it moves.

② Semver level

scripts/pm/** publishes nothing. The PR carries skip-changeset and no changeset, and Check Changeset concluded success. Correct.

Clause-②: no. Correct: the diff changes no published accept set and nothing a metadata author can write. Metadata-protocol: none is correct for the same reason.

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • End-to-end sweep NOT MEASURED for eleven of the twelve rows. Accepted. Done-when 3 asks that the os-zhuang enqueues clear on the enqueue leg, and the PR body's table reads all twelve live timelines through the real guard and timelineAsQueued. The end-to-end sweep covers docs(skills): teach the flow step-name and related-list title translation keys #37072. The next weekly audit run is the remaining confirmation; the seat reads governed-merges audit: a BREACH or an unread week on main #34178's rows on it.
  • Two local gates NOT MEASURED (check:i18n-coverage, check:pm-dispatch-gates). Answered by CI: Lint · PM dispatch-gates and Lint · repo & tooling gates concluded success on the head.
  • Smaller finding (eight record-leg rows on off-template phrasing). The card asked for the choice to be stated in the PR body, and it is: enforce the template where the record is written, do not widen the reader. The reasoning holds: the audit and the queue read records through one reader, and widening it changes what the queue accepts. The report marks this "noted, not filed", so it is escalated to the seat to file as a sibling card. No recogniser is touched here, which matches the claim's surface.
  • Deviations. New exports added to a file over 1,000 lines instead of a sibling module: accepted, the claim binds the surface to this one file and the function serves one call site. origin/main not merged in: accepted, the pull reads mergeable_state: clean. The shallow-clone deepening and the trailer form do not touch the diff.
  • SQL push-down. Not applicable: the diff reads no datastore and adds no id materialisation or in-app join.
  • Tier. check-governed-merges.mjs is an always-H instrument, so this record does not land the PR. The maintainer's approval does.

④ Design judgment

scripts/pm/check-governed-merges.mjs, against the guard code it cites and the card's scenario (#37072: added 19:16:14Z by os-zhuang, removed 19:34:41Z, merged 19:34:42Z).

  • timelineAsQueued agrees with its docblock sentence by sentence. The cut is strictly before landed. The three conditions are each in the code: the last queue event via findLastIndex over the guard's two names, the MERGE_QUEUE_BOT actor, and landed - created_at at most MERGE_QUEUE_REMOVAL_WINDOW_MS. Non-string names return the plain cut. A non-array input returns an empty list, which the guard reads as undetermined.
  • It composes correctly with enqueuerFromTimeline. Both rely on GitHub's chronological order and last-wins, so the audit drops exactly the event the guard would otherwise read as newest. The guard then reads the add before it.
  • The card's scenario clears. The removal is the last queue event, by the queue bot, 1000 ms before merged_at, so it is dropped and os-zhuang's add is read as authorized. The controls on the card hold: docs(skills): an owner, assignee or 负责人 in a request is the injected owner_id #33555 and docs(skills): four automation, query and ui evals spell their own must_contain literals #33632 (0 s) clear through the strict cut as before, and feat(pm): a record naming CONTRACT_REVIEW_TIER is written only on a transcript served at the tier #33616 (fleet-bot enqueue) stays unauthorized.
  • Both callers of readLandingClearance (the arm leg and the .claude/** split leg) take the change through the one edited line. No other call site in the file cuts the timeline for the enqueue leg.
  • The window fails toward BREACH. A gap wider than 1 s leaves the row where it was on main: a false BREACH for a person to read, never a false clear. The assertion pins the constant at 1000, so widening it needs a test edit.
  • The pins cover each condition separately: the window (2 s and 60 s), the actor (os-zhuang and the fleet bot as remover), the last-event binding (a queue-bot removal that an add follows), and the re-add after an ejection in both directions.
  • The two docblocks (the readArmLanding header and the fixture comment) now state the measured window. No "shares the merge's instant" claim is left unqualified in the file.

No must-fix, no should-fix.

  • N1 (nit) — the docblock on MERGE_QUEUE_REMOVAL_WINDOW_MS says no gap over 1 s was measured. That is true of the fifteen pulls it lists. .claude/skills/pm-dispatch/references/readings-queue.md line 12 records the removal and merged events arriving "同秒或数秒内", within the same second or a few seconds. If a queue merge with a 2 s gap exists, it still reads as a false BREACH after this PR. The docblock's own rule already says what to do: widen on a measured row. Left as a follow-up: on the next weekly audit, a BREACH row whose queue-bot removal sits 2 s or more before merged_at is that measurement. No change on this head.
  • N2 (nit) — the readArmLanding header reads "Each leg reads ... timeline events strictly before merged_at, less the queue's own terminal removed_from_merge_queue". The subtraction applies to the enqueue leg alone. timelineAsQueued's own docblock says so, and the code agrees. Accepted as is.

Implemented-by: claude/issue-38863-queue-removal-window
Reviewed-by: session_01WGufzhGA3zoCFquQgku4pm

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 review + L2 adoption · PR #38896 (#38863) · head 062ea49 · 2026-12-01T10:51Z

L1: ACCEPT. L2 (contract-review tier, record 7308834667): PASS, no must-fix and no should-fix. N1 and N2 are nits accepted as is. I adopt the record. The file is an always-H instrument, so the PR goes to the maintainer through the seat.

What I checked:

  • l1-face.mjs --pr 38896: CLEAN, with 26 checks success and 0 failed or pending.
  • The diff is one file, check-governed-merges.mjs (+102/−8). timelineAsQueued drops a removal only when all three of these hold:
    • it is the last queue event the strict cut keeps;
    • its actor is github-merge-queue[bot];
    • it is at most MERGE_QUEUE_REMOVAL_WINDOW_MS (1 s) before merged_at.
  • Fail-safe. If the guard's event names are not strings, nothing is dropped, so the reading is undetermined, never cleared. The enqueue verdict is still the unedited guard's authorizedEnqueueVerdict, so no seat gains a clearance.
  • Pins. Each drop condition is pinned separately, and the two battery floors move with the new cases (71 → 77, 35 → 36). The dev reports ablations of each binding going red.
  • Scope. Fixes #38863 / Refs #34178. skip-changeset and Clause-②: no are right, because scripts/pm/** publishes nothing.

For the seat:

  • File the sibling card the PR body recommends: enforce the record template at write time for the eight off-template rows. The dev noted it but did not file it.
  • On the next weekly audit:

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

席位核对

ACCEPT — PR #38896 @ 062ea49f42ede314189541a27d16c21f991a3ef1 (card #38863, zone osa-fleet, claim 7306497669; request on mailbox #38766 comment 7308861275). Checked 2026-12-01T10:53Z against GitHub, not against the reports.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

维护者速读

  • 是什么:修正每周合并审计的一个误报。合并队列在合并前最多 1 秒会自己记一条「移出队列」,审计脚本以前把这条当成最新的队列动作,于是把你亲手入队的合并误判成「未经授权」。governed-merges audit: a BREACH or an unread week on main #34178 上那 12 条就是这么来的;修正后都读成你入队、已授权。
  • 为什么:误报会让你反复去核对其实没问题的合并。
  • 风险:只改审计脚本里一处读法,而且只会把误报纠正过来,不会把真正的违规放过去(别人移出、或时间差超过 1 秒的,照旧按审核记录判)。不发布任何包;可整体撤回。
  • 要你做什么:批准这个 PR(Tier H,审计脚本属于常驻人审面)。契约审核 PASS 7308834667;L1 ACCEPT 7308845825。Head-sha: 062ea49f42ede314189541a27d16c21f991a3ef1。

席位意见:同意落地。ACCEPT → PR #38896 comment 7308882210。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 1, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 1, 2026 10:54
@os-zhuang
os-zhuang marked this pull request as ready for review December 1, 2026 10:55
@os-zhuang
os-zhuang enabled auto-merge December 1, 2026 10:56
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 472d3c5 Dec 1, 2026
61 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-38863-queue-removal-window branch December 1, 2026 11:22
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

2026-12-01T11:22Z · Merged at 2026-12-01T11:22Z after the maintainer enqueued it; pm:awaiting-merge cleared by the seat.

@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check-governed-merges: the maintainer's own queue merges read as seat BREACH rows when the queue removal is stamped one second before merged_at

3 participants