Repository navigation
Commit ed6f6ff
pm: the governed-merges sweep lists low-risk arm landings apart and judges each on a same-head at-tier PASS record (#33711)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X5SKzXRHQWjMHXgyfyiaqkP)_
Fixes #33603
Clause-②: no
Metadata-protocol: none
domain:skills#1 · os-project-manager · session_01FEkQ5kXwEA8abP4hMhtodW
## 维护者速读
- 改了什么:合后审计 `check-governed-merges.mjs` 现在对每个 skills 合并,用队列守卫自己的 arm
读法和记录读法再读一遍落地提交。按守卫自己的顺序判:合并前有授权批准或授权入队的,算维护者的合并,留在维护者清单并写明谁放行;其余 arm 判为
Tier S 的合并单独列出,每条再查同 head、达档、PASS、出自守卫信任的作者、合并前已存在且未再编辑的复核记录,且该 PR
确实以这个提交落地(`merge_commit_sha`),缺了就标 ⛔ BREACH。另外修了 #33616 评审留下的三处:校验器比对
`advisorModel`、拒收把复核交给子代理的转录,post-stamped 对校验器自测的 spawn 加超时并转出子进程的失败行。
- 为什么改:AGENTS.md 第 14 条把合后审计定为座位落地的补偿控制,但它按路径分类,arm 落地看起来和「Tier H
无批准」一模一样(卡 #33603,评审 6886787995 N3);#33616 的复核记录把校验器残项挂到本卡。
- 风险与回滚:只动三个 `scripts/pm/` 工具文件,审计仍是只报告;读不到时记 NOT MEASURED、整轮
INCOMPLETE(退出 2),不会把未读的合并报成干净。校验器更严:复核会话里调用过 Agent / Task / Workflow /
SendMessage 的转录现在被拒,要传子代理自己的输出。回滚即还原本 PR。
- 先看:`scripts/pm/check-governed-merges.mjs` 的
`readArmLanding`(新,读法全部来自队列守卫)和 `renderReport`
的分列;`scripts/pm/verify-review-tier.mjs` 的 `SUB_AGENT_TOOLS` 判断。
- 两分钟验证:`node scripts/pm/check-governed-merges.mjs --since-ref
objectstack=b937b75f --repos objectstack`,预期 #33668、#33555、#33632 三条
skills 合并都留在维护者清单,各带一行「cleared by an authorized enqueue (os-zhuang)」;没有
BREACH。
- 需要你做的:定合后审计的周期执行人(本 PR 建议:定时 workflow,由席位立卡交你,见下文 Owner);本 PR
本身无,席位落地。
## What changes
**Part 1, the audit (`scripts/pm/check-governed-merges.mjs`).**
- `readArmLanding` reads every skills landing in the sweep again with
the queue guard's own readers on the landed commit (the commit the merge
group judged): `decomposeGovernedWork`, `readLowRiskTier` (the
register's `lowRiskArmVerdict`), `landsOnLowRiskArm`, then
`recordAuthorTrusted`, `recordVerdict` and `lowRiskRecordVerdict`. One
reader: no predicate is restated here; the guard is imported lazily
(`loadArmReaders`, `ARM_READER_EXPORTS`), and a missing export or failed
load is NOT MEASURED.
- Five states. `pass`: the arm reads Tier S and a same-head record that
stands at the tier and reads PASS exists. `breach`: the arm reads Tier S
and no such record exists. `cleared`: the arm reads Tier S, and an
authorized approval or enqueue cleared it first. `tier-h`: the arm reads
H (its reasons are printed under the row), or the landing crosses the
3,000-line human-merge line. `not-measured`: the pull, the timeline or a
comment thread could not be read.
- The legs run in the guard's own order (`entrySatisfied`): an
authorized approval (`authorizedApprovalVerdict` on `makeReviewReader`),
then an authorized enqueue (`enqueuerFromTimeline`,
`authorizedEnqueueVerdict` on the timeline already fetched), then the
record. A landing cleared by either of the first two is `cleared`: the
maintainer's merge, kept on the maintainer's list with who cleared it,
never a BREACH.
- Each leg reads only what existed before the landing. Reviews and
timeline events count strictly before `merged_at`: on a queue merge the
`removed_from_merge_queue` event shares the merge's instant (measured on
#33555, #33632 and #33616), so the post-merge timeline would always read
the enqueuer as undetermined. Comments count only from an author the
guard trusts (`recordAuthorTrusted` on `recognisers.trustedAuthors`, the
#33687 binding: the relay's identity and `GOVERNED_APPROVERS`), and only
when created and last edited (`updated_at`) at or before the landing. So
a record any commenter posted cannot excuse a landing, an untrusted row
cannot shadow a trusted one, and a record written or edited after the
landing cannot excuse it; a BREACH whose only record was edited after
the landing names that comment.
- The record's head is tied to the landed commit: the attribution read
now carries `merge_commit_sha`, and a pull GitHub says is not merged (no
`merged_at`) or merged as another commit is a BREACH with that reason,
never `pass`. A failed attribution read is NOT MEASURED. Reads ride the
channel that attributed the row (`makePullReader`, `makeTimelineReader`,
`makeCommentReader`), and each one counts in the API lookup total.
- The report lists arm landings (`pass` and `breach`) apart, after the
maintainer's list, under their own contract lines; the head counts them
and their breaches. `cleared`, `tier-h` and `not-measured` rows stay on
the maintainer's list with an arm cell. A `not-measured` row makes the
sweep INCOMPLETE (exit 2) and the banner names it. `--json` carries the
reading as `entries[].arm`.
- Neither dispatch awaits at module scope any more (`main().then`,
`selfTest().then`): the guard imports this file at module scope, so an
awaiting dispatch deadlocks the lazy import (exit 13). The two comments
that said the lazy door is shut here were corrected.
- The register header's arm section says what the sweep now does and its
limit: it reads the record, not the run that wrote it. At the seat's
request, the line that called the relay's review plan path-only now says
the plan is not path-only from #33540: `governedReviewPlan`
(`scripts/pm/fleet-write/execute.mjs`) reads the arm with its readers.
#33686 has since merged, so the line holds on main.
**Part 2, the owner.** Proposed below; no workflow and no rule line in
this PR.
**Part 3, the verifier residuals (PR #33616's records 6888257144 N5 and
6888534276 N7 and N10).**
| Residual | Verdict | Where |
|:--|:--|:--|
| `advisorModel` not compared | Fixed. Present and not null, it must
equal the tier. Measured present on every assistant entry of a real
session transcript, equal to the served model. |
`verify-review-tier.mjs`, 2 pin rows |
| A model value with a context suffix refuses an at-tier run | Closed.
Fails closed by design, and measured unreachable here: a session
configured with `[1m]` records `message.model`, `requestedModel`,
`advisorModel` and the identity attachment without the suffix (129
turns). Accepting a suffix would widen the accept set on an unseen
shape. The header says so. | header only |
| A nested sub-agent's transcript is not followed | Fixed by refusing
instead of following: an assistant turn that calls `Agent`, `Task`,
`Workflow` or `SendMessage` (`SUB_AGENT_TOOLS`) refuses, naming the tool
and asking for the transcript of the agent that ran the review, one that
called no other agent (a seat that reviewed in-seat beside unrelated
agents passes the review's own sub-agent file). Following would need the
child's file, which the transcript does not name. |
`verify-review-tier.mjs`, 3 pin rows |
| A delegating session passing its own transcript passes whatever served
its sub-agent | Fixed by the same refusal (a session that spawned its
reviewer is refused). | 1 pin row |
| A cleanly truncated transcript prefix passes | Closed. No honest run
writes a prefix: the record is the final turn's text, so a prefix
without that turn is a copy the seat cut, the dishonest route the card
leaves to the audit. A completeness test would rest on `stop_reason`,
which this session cannot measure for a sub-agent output; a wrong guess
would refuse every at-tier record. Named in the header's boundary. |
header only |
| The verifier self-test spawn has no timeout and hides the child's
failure lines | Fixed. `timeout: 120000`, and `childRunDetail` puts the
timeout or signal, the exit and the child's own failing case lines into
the case's detail. | `post-stamped.mjs`, 1 pin row |
| A raw relay `comment` / `comment_edit` op is not judged for tier | Not
here: it lives in `scripts/pm/fleet-write/` (the relay's door), outside
this card's file surface and on the same files as #33540. Belongs on its
own card. | report |
## Owner of the weekly audit
Proposed owner: **a scheduled workflow**, filed by the seat for the
maintainer (this PR adds none). Reasons:
- The audit is the compensating control for seat landings, and the
skills seat lands most of the arm's PRs. A seat patrol would have the
audited party run its own audit.
- A workflow runs whether or not a seat is staffed; seats go off duty
and a patrol stops with them.
- It needs only an objectstack checkout with history, `--repos
objectstack`, a topological `--since-ref` from the last run's printed
tip (or `--since 8d` for overlap), and a read token. A ⛔ BREACH or
`not-measured` row can be surfaced in the job summary; making the job
red on `entries[].arm.state === 'breach'` would be a reader of `--json`,
not a change here.
The interim, until the workflow lands: the skills seat's patrol runs
`node scripts/pm/check-governed-merges.mjs --since 8d --repos
objectstack` weekly and posts the arm section to the seat post. That
line does not fit
`.claude/skills/pm-dispatch/references/lanes/skills.md`: 35 lines
against a ceiling of 35, headroom 0 (`check-skill-line-ratchet`), so it
is reported here and not added.
## Tests
- `node scripts/pm/check-governed-merges.mjs --self-test`: 728
assertions. New battery `⚖️ #33603: ...` (38 cases, floor 38; roster
floor 37 to 38). It loads the REAL guard through `loadArmReaders` and
drives `readArmLanding` with fake fetchers and a fake git: pass on the
PR thread and on the card; breach for no record, a FAIL record, a record
on another head, a record below the tier, an unsigned record, a record
from an untrusted author, a record posted after the landing, a record
edited after it (the reason names the edited comment), a pull merged as
another commit and a pull closed unmerged; an untrusted FAIL after a
trusted PASS does not shadow it (and a trusted one does); cleared for an
authorized approval and an authorized enqueue on the measured
queue-merge timeline, with controls that a seat-account enqueue, a
post-landing approval and an unauthorized approval clear nothing; tier-h
for a `security` label, `Clause-②: yes`, a path outside the allowlist in
the same commit and an oversized landing; not-measured for an unread
pull, review list, timeline, comment thread or merge, and for readers
that did not load; null without a catalog row or a PR number; the
report's head count, its apart section and a cleared row staying on the
maintainer's list; the INCOMPLETE banner; and a structural pin that
neither dispatch awaits at module scope.
- `node scripts/pm/verify-review-tier.mjs --self-test`: 27 cases across
6 batteries (new battery: advisor, sub-agent spawn, and the refusal's
advice naming the reviewing agent).
- `node scripts/pm/post-stamped.mjs --self-test`: 787 cases across 29
batteries (record-tier battery floor 15 to 16).
- A live sweep on this head, read-only, from `b937b75f`: 8 governed
merges. The three skills landings, #33668, #33555 and #33632, read Tier
S on the arm and were each enqueued by `os-zhuang` before the merge, so
each is `cleared` and stays on the maintainer's list; nothing is listed
apart and nothing is a BREACH; exit 0. (Before the review fix, #33555
and #33632 were listed apart as PASS.)
<details><summary>Ablations, each restored and `git diff` checked empty:
the first five on the first commit, the next six on the first review-fix
commit, the last two on the second</summary>
```text
the merge-time filter on comment rows removed -> ✗ a-PASS-record-posted-AFTER-the-landing-is-a-BREACH
the apart filter in renderReport removed -> ✗ arm-landings-are-listed-AFTER-the-maintainers-list-never-in-it
any non-unreadable record read as pass -> ✗ no-record / FAIL-record / record-on-another-head is a BREACH
the sub-agent spawn refusal disabled -> ✗ 3 verifier cases (nested reviewer, delegating session, other tool names)
the advisorModel comparison disabled -> ✗ an advisor model off the tier refuses
the authorized-approval leg disabled -> ✗ 1 case (an approval before the landing clears it)
the authorized-enqueue leg disabled -> ✗ 1 case (an enqueue clears it)
timeline events counted AT merged_at, not before -> ✗ 1 case (the measured queue-merge timeline)
the merge_commit_sha tie disabled -> ✗ 1 case (a pull merged as another commit)
the not-merged check disabled -> ✗ 1 case (a pull closed unmerged)
the updated_at filter disabled -> ✗ 1 case (a record edited after the landing)
the author binding disabled -> ✗ the untrusted-author cases
the edited-after note disabled -> ✗ 1 case (the BREACH names the edited comment)
```
</details>
## Acceptance notes
- An arm landing the maintainer's account enqueued is the maintainer's
merge by the guard's own reading, whoever prepared it; the sweep follows
that reading and does not second-guess it.
- The record's existence is all the audit adds; it cannot tell a record
from the run that served it (the verifier's boundary). Body and labels
are read as they are now; a removed `security` label is still caught by
the timeline.
- The arm reads today's register, so a skills landing from before the
arm existed (#33632 landed 05:14Z, the arm at 05:57Z) is listed apart
when it qualifies. It had its PASS record, so it is not a breach.
- `contract-review.md`'s rule line on session evidence (「卡线程或席内复核」) does
not yet say that a session which spawned or messaged a sub-agent is
refused; the refusal text says what to pass. Carrier: the skills seat
(the file is at its 63-line ceiling).
- Raw relay `comment` / `comment_edit` ops not judged for tier: carrier,
the skills seat, as its own card (relay files).
## Verification
Gate list `dispatch-gates --commands` on this diff: 35 families, all run
locally; results below. `dispatch-gates --tier`: no path-derived mandate
(floor sonnet, default opus, ceiling fable); 449 changed lines, under
3,000. `check-governed-merges --branch claude/project-thread-sgww6y`:
NOT governed (0 of 3 paths on the register).
On head c48e9f1 (rebased on main `48e69596`, which carries #33686 and
#33687), every derived family ran and exited 0: `dispatch-gates --ran`
reconciles 35 derived, 35 run, 0 NOT-MEASURED. One gate went red on the
first pass of the first round and was fixed in its own commit:
`check:pm-dispatch-gates` refused a helper named like a compound
self-test (`childSelfTestDetail`, not in `COMPOUND_ANCHOR_LEDGER`); it
is now `childRunDetail`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5kXwEA8abP4hMhtodW)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5kXwEA8abP4hMhtodW
<!-- signed: domain:skills#1 · os-project-manager ·
session_01FEkQ5kXwEA8abP4hMhtodW -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8b6c145 commit ed6f6ff
3 files changed
Lines changed: 412 additions & 37 deletions
0 commit comments