Skip to content

Specs and plans self-check the most-cited review rules before review - #978

Open
hhff wants to merge 19 commits into
mainfrom
operator/pre-review-selfcheck
Open

hhff wants to merge 19 commits into
mainfrom
operator/pre-review-selfcheck

Conversation

@hhff

@hhff hhff commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Why. Over the last 7 days, first spec and plan reviews were rejected at about the same rate in all five fleets on this box:

  • Plan: 58–84% rejected first time (dd 84%, mm 75%, stacks 58%, sb 80%, web 79%).
  • Spec: 56–93% rejected first time.
  • Cost: spec, plan and planning take 19–41% of each fleet's dollars.

The top blocking rules are the same everywhere:

  • worker.md §4: buildable as written, and each check fails red against its mutant.
  • quality.md §6's TL;DR rule: dd ×38, sb ×24, mm ×19, web ×18.

Lessons didn't fix this. devteam-dev's retro measured two first-pass lessons that left spec/plan at 0.81, retired them, and concluded the fix belongs in "the review prompt or the spec/plan template, not another lesson". #901 (TL;DR bullets cite their task) may have helped: pooled 73% vs 79%, not proven. This PR builds on #901. It doesn't repeat it, and no open PR covers this.

What changes.

  • New devteam.mjs selfcheck <spec|plan>, run by the worker. It reads the draft committed on ticket/<id> (in the records repo), so it checks exactly what the reviewer will read. No model runs.
    • Spec checks:
      • a ## Today (sources) table with at least one row;
      • an acceptance table with a red seen column, where every row has a fails when and either a red run (command → line) or deferred: plan task N. Cells are read with the kit's tableCells, so an escaped \| stays inside its cell;
      • a ## Refusals and edges section.
    • Plan checks:
      • tldrGap (the TL;DR exists and has seven bullets or fewer);
      • every top-level TL;DR bullet ends in (Task N…) or (no task: …) (the reason may hold parentheses), and every cited task exists as a ### Task N heading. A tab or two spaces before the marker nests a bullet, and nested bullets need no citation;
      • every task has a Files: line and a Model: fast|strong line.
    • Checklist: the top 3 of this fleet's reviews.by_stage.<stage>.top_blocking_rules (last 7 days, else all time, else kit-wide: spec worker.md §4; plan worker.md §4, quality.md §6), each with a hint on what to read for. The worker ticks each one with evidence: --tick "1: <what you checked, where>", at least 20 characters.
  • Recorded. A run with ticks writes a phase line carrying selfcheck {stage, ok, draft, rules, failed, ticks} at the sha it checked. draft is git's blob id of the <stage>.md it read. The phase stays as it was. The new field is in log.schema.json, as is the approve act's selfcheck: exactly one of draft or skipped (a oneOf, which the kit's schemaErrors now checks). Draft ids are exactly 40 or 64 hex.
  • Gated at the approval. act --class approve-spec and act --class approve-plan refuse unless a passing selfcheck <stage> read the <stage>.md committed on ticket/<id> now, matched by git's blob id. The refusal names the command to send back. The approve act records the draft it approved (selfcheck: {draft}).
    • One ticket per approval act. approvalOf counts an approve act for each ticket in its refs, while the act's checks (the self-check, one-way doors, door picks, the goal-level door, the TL;DR) read the first. So approve-spec and approve-plan refuse a second ticket id in --refs, directly or through decide then act --decision. Other refs (shas, messages) still ride along. An act that carries selfcheck (every one this kit logs) approves only its first ref in approvalOf and metrics, so an id that becomes a ticket after the act is never approved by it; an older line still approves every ref it names.
    • Each stage stands on its own check. A combined spec-and-plan ask approves the spec on the spec's check and refuses the plan until the plan's own check passes. The phase isn't read, so a ticket that logged build before approve-plan is still checked.
    • A spec re-scoped after its approval is another blob, so approve-spec refuses until a new check passes on it.
    • Approvals already logged are untouched. Nothing re-checks them, and check-ticket still asks only that the acts exist.
    • No kit flow logs an approve act without a worker's draft. Both come only from act, by hand or through decide then act --decision, and the gate covers both. For a draft no worker checked (one the owner wrote, say), act … --no-selfcheck "<why>" (20 characters or more) approves it, and the act records selfcheck: {skipped: <why>}. The kit's own test fixtures, which approve placeholder drafts, use it with "a test fixture: no worker draft to check". That changes the G1 golden by that field and the approvals metrics block (re-recorded).
    • send --kind review-request is not gated. A worker's request for a stage not yet approved, whose committed draft has no passing check, prints note: approve-<stage> will refuse: … on stderr, so the worker hears it before the supervisor does.
    • This replaces review g's send gate, its phase filter and its review ready: exemption.
  • Measured. At spec and plan, metrics reviews.by_stage.<stage> and its last_7d gain self_checked and unchecked (first_passes, rejected, rejection_rate). A first pass counts as self-checked when a passing self-check read the same <stage>.md content as the reviewed commit holds. For a records-in-home ticket, that's the review's - Records: commit, not the code sha in its Verdict. A check without a draft (none exist yet) falls back to the reviewed sha or an ancestor of it. A check logged after a review with a time doesn't count for it. A review dated to the day only can't order a check made that same day.
  • Skips are visible. metrics counts spec and plan approvals per stage as checked, skipped (--no-selfcheck) or unrecorded (an older kit's act), all time and last 7 days (approvals.by_stage, and an approvals (checked / --no-selfcheck / before the check) line in text). When a ticket's latest approval of a stage in the last 7 days skipped the check, its worker had logged phase lines by then, and no passing check read the draft committed now, metrics raises a medium approval-unchecked finding on <ticket> <stage> (one per stage, so an ack of one leaves the other). A later checked approval clears it, and an owner-written draft can be acked with its reason.
  • Docs. worker.md §4 (the intro, the project's-rules bullet, and the spec and plan rows) and operator.md's First passes line now cover the self-check; supervisor.md's approval line and operator.md's First passes line name the per-ticket gate, the approvals counts and approval-unchecked (its 7-day window), and supervisor.md says how to treat a draft reviewed before the self-check shipped (reshape it, or --no-selfcheck "reviewed before the self-check"). quality.md §6 (governance, needs the owner's yes): beside the tldrGap refusal it now says approve-plan also waits for a passing selfcheck plan, which fails an uncited or (T3)-style top-level bullet, a citation of a missing task, and a task with no Files: or Model: line; its "a plan drafted before this rule isn't marked down" clause now holds for the review, and at the approval such a plan is reshaped or approved with a logged --no-selfcheck.

The measure to watch. 7-day first-pass rejection per stage (reviews.by_stage.{spec,plan}.last_7d.rejection_rate), and within it self_checked vs unchecked. Expected effect: the mechanical half (missing red runs, uncited or wrong TL;DR bullets, tasks without Files or Model) is caught before review. I expect plan first-pass rejection to fall from about 75% pooled to under 50% for self-checked drafts within two weeks of adoption, with spec moving less, since more of its rejections are judgement calls. If self_checked doesn't beat unchecked by 15 points or more after 20 self-checked first passes per stage, the checklist half isn't working: move the rules into the review prompt instead.

Tests. New test/pre-review-selfcheck.test.mjs passes (9/9, about 3 minutes under box load):

  • A1 spec checks (an escaped pipe included); A2 plan checks (a tab-nested bullet, a reason with parentheses, a task with no Files: line); A3 the rules source (kit-wide, then the fleet's own last 7 days);
  • A4 the ticks (no ticks records nothing; thin evidence fails; a pass records its sha and draft; log-check accepts the line);
  • A5 the approval gate (approve-spec refused with no check, naming the command; approved after one, with the draft recorded; a re-scoped spec refused until checked again; a combined ask with a broken plan approves the spec and refuses the plan, at phase plan and at build; no committed draft refused; --no-selfcheck with a reason recorded, a bare or short one refused, and refused on other classes; a ticket approved by an older kit untouched; the review request's note; a second ticket in --refs refused, checked or not, directly and through a decision naming both; a door ticket second behind an approvable plan refused; a non-ticket ref (a sha) accepted; an id named second before it was a ticket isn't approved once it is one, in status or in metrics; log-check passes).
  • A6 the metrics split (self-checked by its draft, including a records-in-home review read at its Records commit; an unchecked first pass; and a check logged after a timed review, which doesn't count for it);
  • A8 the approval counts (checked, skipped) in json and text; approval-unchecked raised for a worker's skipped draft, not for an owner's nor for a checked draft re-approved with --no-selfcheck; one finding per stage, an ack of the spec's leaving the plan's; cleared by a checked re-approval;
  • A9 log-check refuses an act selfcheck that is empty or carries both draft and skipped, and a 50-character draft id;
  • A7 the doc text: worker.md §4, quality.md §6's approval sentence and its restated clause, supervisor.md's 7-day window and pre-release guidance.

Each of these mutants turns its test red:

  • send-gate: the refusal disabled → A5.
  • red-seen: the red-run test removed → A1.
  • cite: uncited bullets allowed → A2.
  • rules: last-7-days rules ignored → A3.
  • evidence: the length floor removed → A4.
  • split: never counted as self-checked → A6.

Each of these mutants from review f's fixes turns its test red:

  • cells: the cells split on every | → A1.
  • tab: a tab-indented bullet read as top level → A2.
  • paren: a reason with parentheses not read as a citation → A2.
  • draft: the gate ignores the draft → A5.
  • records: the Records commit ignored → A6.

Each of these mutants from review i's restructure turns A5 red:

  • no-gate: the approve-* gate removed.
  • any-check: any passing check counts, not the one bound to the draft (the re-scoped spec).
  • first-stage: the gate checks the spec's check for approve-plan.
  • skip-free: --no-selfcheck with no reason accepted.

Each of these mutants from review k's fixes turns its test red (source restored and checked with cmp):

  • first-ref: the gate checks only refs[0] → A5 (superseded by review m's one-ticket rule).
  • late-check: a check logged after the review counts for it → A6.
  • no-finding: approval-unchecked never raised → A8.
  • any-skip: raised with no worker phase lines → A8.
  • all-checked: skipped approvals counted as checked → A8.

Each of these mutants from review m's fixes turns its test red:

  • many-tickets: the one-ticket refusal removed → A5.
  • decision-many: the refusal skipped for an act through --decision → A5 ("a decision naming two tickets is refused at its act").
  • checked-now: the finding raised on a draft a passing check read → A8.
  • ticket-subject: the finding's subject the ticket alone → A8.
  • no-oneof: the act selfcheck's oneOf removed → A9.
  • mid-length: the phase draft pattern back to {40,64} → A9.

Each of these mutants from review p's fixes turns its test red:

  • quality-old: quality.md as on main → A7.
  • no-files: the Files: check removed → A2.

Each of these mutants from review n's fix turns A5 red:

  • every-ref: approvalOf honours every ref of a checked act ("the ticket added later reads as not approved").

  • stats-every-ref: only approvalStats does ("and metrics counts no approval for it").

  • Review m's later-ref-count (approvalStats counting only refs[0]) is now equivalent on every act the kit can log. Only an older act could name two tickets, so it is not tested.

Existing suites run here: spec-sections, devteam-mjs-regions and model-tiers pass; after reviews k and m, components (G1 against the re-recorded golden), split-dist-docs, kit.validate and world-contract (which runs schemaErrors) pass; after review n, components and spec-sections pass; after review p, pre-review-selfcheck, spec-sections, split-dist-docs and components pass. validate-parts timed out locally at 900 s with no test finished, under box load. Left to CI.

Not done / risks.

  • Rollout: expect a burst of refused first review requests after release. A fresh reviewer measured the check on drafts already approved on main: 74% of specs and 88% of plans fail it. Most are real breaks of worker.md §4's wording, such as a red-seen cell that points at a probe file, a task with no Files: line, or ### T1. headings. The check stays strict. Each refusal names the command to run, and the worker reshapes the draft and sends again. The supervisor's next approve-spec or approve-plan on a ticket mid-flight when the kit updates is refused until its worker runs the check. Approvals already logged are never re-checked. Measure the extra round trips alongside the rejection rate.
  • An older kit's log-check refuses the new selfcheck field on a mirrored phase line (as with any schema addition), so update the kit in every checkout.
  • Plans not written in superpowers' ### Task N / **Files:** shape fail tasks-buildable until they adopt that shape. worker.md §4 already asks for it.
  • The worker prompt template is unchanged, since it is pinned by the g1 golden. The prompt points at worker.md §4, which now carries the step.

Release note: the pre-review self-check (selfcheck <spec|plan>) gates approve-spec and approve-plan: each approves only the committed draft a passing check read (--no-selfcheck "<why>" for a draft no worker wrote). Expect a burst of refused first requests after release while drafts reshape to worker.md §4. Approvals already logged aren't affected.

Opened by the box operator.

🤖 Generated with Claude Code

hhff and others added 3 commits December 4, 2026 02:08
selfcheck <spec|plan> reads the committed draft, runs mechanical checks
(Today (sources), a red run per acceptance row, Refusals and edges; the
TL;DR's shape and task citations, Files and Model per task), and lists
the fleet's top blocking rules for the stage (last 7 days, else all
time, else kit-wide) for the worker to tick with evidence. A passing run
is a phase line carrying selfcheck; a worker's review request at spec or
plan waits for one; metrics splits first-pass rejection into
self_checked and unchecked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PR adds self_checked and unchecked to each stage's last_7d; the
exact-shape check in review-dates now includes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Merged origin/main in (clean, no conflicts; this PR's test file is new, so nothing to move into kit-1202's split files) and fixed the one red cause.

  • Red: test/review-dates.test.mjs failed in all 4 kit shards (the 5th red job, tests, is the roll-up). It deep-equals reviews.by_stage.spec.last_7d, and this PR adds self_checked / unchecked there. Caused by this PR.
  • Fix: the expectation now includes the split (none self-checked, both unchecked).
  • Local: review-dates and pre-review-selfcheck (7/7) pass.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review f: the pre-review self-check refuses compliant specs whose tables escape a pipe

  • Reviewer: operator-review-f (fresh subagent, claude-opus-5-5), not the author
  • Head: c3fb704
  • Date: 2026-12-05T03:24Z

What I ran vs only read

  • Read the PR body, git diff origin/main...HEAD, quality.md §1 and §3, worker.md §3–4, and the code the diff calls: tableCells, parseReview/ticketReviews (where r.sha is the Verdict sha), recordsRepo/factsRepo/recordsInHomeId, ancestorOf, currentTicketId, writerClass, cmdPhase, TIER_LINE/modelTierStats, and the phase schema.
  • test/pre-review-selfcheck.test.mjs at the head, through testslot with the hub env pointed away: 7/7 pass (452 s).
  • Mutation, one run with two mutants: the cmdSend refusal disabled (if (false && …)) and selfCheckedBefore forced to return false. A5 and A6 went red, A1–A4 and A7 stayed green, as expected. Restored afterwards; git status clean apart from .scratch/.
  • Probe (pure, no fleet): pulled tldrGap and the self-check block out of the head's devteam.mjs and ran selfCheckDraft on edge cases and on every spec.md/plan.md added to main in the last 10 days in five fleets on this box, read-only (511 specs, 512 plans).
  • test/split/split.mjs --at HEAD timed out at 300 s under box load with nothing printed, so I couldn't check the split manifest locally. I left it to CI.
  • CI at the head: test success, box-image success.

Findings

Id Severity Rule Where Finding
F1 Important worker.md §4 (red seen: command → the failing line); quality.md §3 Severity (a real defect with a plausible failure path) docs/devteam/scripts/devteam.mjs mdCells (used by mdTables → selfCheckDraft red-seen) defect: mdCells splits on every | and ignores the escaped | that GFM tables use for a literal pipe. The kit already handles this in tableCells (split(/(?<!\\)|/), then unescapes), but the PR doesn't use it. A row whose check or red-seen cell holds a regex or a shell pipe shifts its columns, so red-seen reports "row N has no red run" for a spec that complies. With the cmdSend gate, that blocks the worker's review request until the spec is reworded. Measured on main: 45 of 511 recent specs fail red-seen only because of an escaped pipe (with | replaced, they pass). Example: mothership app-494-demo-share-list-read-confine/spec.md row C3, -n "/companion#(file|share_list)$/" → …:320: a demo share list names …. No test covers an escaped pipe. Fix: build mdCells on tableCells, and add an A1 case with | in a red-seen cell.

Notes

  • Minor, the gate's reach is wider than its cost suggests. On drafts already approved and on main, selfCheckDraft fails 74% of specs (red-seen 333; today-sources 14; refusals 11) and 88% of plans (tldr-cites-tasks 388; tasks-buildable 130). Most of these break the letter of worker.md §4: a red-seen cell that points at a probe file instead of command → line, a PR/CI task with no Files: line, headings like ### T1. that #{2,4} Task N doesn't match. Reviewers approved them anyway. So the gate will refuse most first requests until the drafts reshape. That's the intent, but expect a burst of refused sends and re-commits after release. Workers mid-ticket at spec or plan are refused too. The error message names the command, so it recovers. Measure the extra round trips alongside the rejection rate.
  • Minor: a tab-indented nested TL;DR bullet counts as top-level and must carry a citation (\t- x matches ^\s{0,3}[-*+] and not ^\s{2,3}). worker.md §4 calls an uncited nested bullet Minor, yet here it blocks. Also, a (no task: …) reason containing parentheses fails CITE.
  • Minor: the gate accepts any earlier passing self-check at that stage, so a draft changed after its check still goes through. The metrics split counts a check re-run at the same sha after a rejection as self-checked. Both match the PR's wording; neither is a governance widening.
  • Minor: for a records-in-home ticket, the reviewer's Verdict sha may be the code repo's, so ancestorOf against home answers null and the pass counts as unchecked, unless the shas are equal.
  • Governance: I found no widening. selfcheck writes a phase line as the ticket, the same way cmdPhase does. The gate applies only to writerClass === 'ticket', so it only adds a step for workers. No owner-only rule is touched.
  • I couldn't check the split-dist manifest locally (timed out). CI's test job is green at the head.

Opened by the box operator.

Verdict: CHANGES c3fb704

hhff and others added 2 commits December 5, 2026 03:25
Review f: mdCells now reads cells with the kit's tableCells, so an
escaped \| stays in its cell (45 of 511 recent compliant specs were
refused for it). A tab or two spaces before a TL;DR marker nests the
bullet, and a (no task: …) reason may hold parentheses. A pass records
the blob of the <stage>.md it read; a review request needs a pass on the
draft as committed now. Metrics reads the draft at a records-in-home
review's Records commit, and a check logged after a timed review no
longer counts for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Fixes for review f (issuecomment-7431037665) at d7f7269, with origin/main merged in (clean).

  • F1: mdCells is now the kit's tableCells, so an escaped \| stays inside its cell. A1 adds a row with a\|b in the check and rg -n "file\|share" in red seen, and it passes.
  • Tab-indented TL;DR bullets: a tab or two spaces before the marker nests a bullet, and nested bullets need no citation. Top level is at most one space.
  • (no task: …) with parentheses: the reason may hold parentheses. Both of these are in A2.
  • Bound to the draft: a pass records selfcheck.draft, git's blob id of the <stage>.md it read. send --kind review-request at spec or plan now needs a pass on the draft as committed now: an edit after the check is refused, with the command to run again (A5).
    • Metrics counts a first pass as self-checked when a passing check read the same content as the reviewed commit. A check logged after a review with a time no longer counts for it. A review dated to the day only can't order a same-day check.
  • Records-in-home: metrics reads the draft at the review's - Records: commit (home's), not at the code sha in its Verdict. A6 covers a review whose Verdict sha the repo doesn't have.
  • Rollout: the PR body now carries the 74% / 88% measurement, a line to expect a burst of refused first requests, and a release-note line. The check isn't weakened.
  • Past a review: a ticket already past its spec or plan review isn't affected. The gate applies only when workStageOf (its last work phase) is spec or plan. A5 now covers a ticket at contract with no check and a non-compliant spec: its request goes through.
  • Mutations, each red exactly where named and green elsewhere:
    • mdCells split on every pipe → A1;
    • a tab-indented bullet read as top level → A2;
    • a reason with parentheses not read as a citation → A2;
    • the gate ignoring the draft → A5;
    • the Records commit ignored → A6.
  • Local: pre-review-selfcheck 7/7.

Opened by the box operator.

The dashboard reads the split for every reviewed first pass; reading
each one's draft blob added a git process per ticket (speed.test: 102
then 118). A pass with no passing self-check is unchecked at once, and
the draft is read only when a check needs comparing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Follow-up at 81c966e: CI on d7f7269 failed speed.test.mjs ("dashboard-data: 102 then 118 git processes; at most two more per added ticket branch"). That was mine: selfCheckedBefore ran git rev-parse for the reviewed draft on every first pass, even with no self-check to compare. It now returns unchecked before any git when there's no passing check, and reads the draft only when one needs comparing. Local: the speed test's git-process case and pre-review-selfcheck (7/7) pass.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review g: the self-check gate reads the ticket's phase, so approved tickets are gated and plans can slip through

  • Reviewer: operator-review-g (fresh subagent, claude-opus-5-5), not the author
  • Head: 81c966e
  • Date: 2026-12-05T06:30Z

What I ran vs only read

  • Read: the PR body, review f (issuecomment-7431037665), git diff origin/main...HEAD, quality.md §1, §3 and §6, worker.md §4 and its owner review-page flow, supervisor.md's message table. In devteam.mjs I read tableCells, recordsRepo/factsRepo/recordsInHome, approvalOf, ancestorOf, git, memo, writerClass, cmdSend and the new selfcheck block.
  • test/pre-review-selfcheck.test.mjs at the head, through testslot, with the hub env pointed away:
    • The first run timed out at 600 s with no test finished, at load average 81 on 12 cores. That is a box timeout, not the PR.
    • Re-run with --file-timeout 900: 7/7 pass (226 s).
  • Mutation run: four mutants applied together, each hitting a different test.
    • cells: mdCells splits on every |.
    • tab: the top-level bullet regex ^\s?, so a tab counts as top level.
    • draft: the gate's draft binding replaced by true.
    • records: at0 = sha, so the Records commit is ignored.
    • A1, A2, A5 and A6 went red; A3, A4 and A7 stayed green, as expected. I restored the file; git status is clean apart from .scratch/.
  • Confirmed review f's items at the head:
    • Escaped pipes: mdCells is tableCells.
    • Tab bullets: a tab or two spaces nests a bullet.
    • (no task: …) reasons may hold parentheses: the greedy cite regex.
    • The gate is bound to the draft: the blob id is compared at send.
    • Home-records ancestry: - Records: is read as at0, with R = home.
    • Git-process cost: selfCheckedBefore returns before any git call when no passing check exists. The per-review selfChecks filter is in-memory only; devteam-dev has 12k phase lines, which is negligible.
  • Probe, read-only and pure node, over the five fleets' project/log/*.jsonl (devteam-dev, mothership, stacks, stacksbot, website): I replayed every ticket's review-request messages against its last work phase (workStageOf's rule) and against the approve-spec/approve-plan acts logged before the message.
  • CI at the head: test success, box-image success.

Findings

Id Severity Rule Where Finding
F1 Important quality.md §3 Severity (a real defect with a plausible failure path); the PR's own claim "Tickets past those reviews aren't touched" docs/devteam/scripts/devteam.mjs cmdSend gate (workStageOf(from)) defect: the gate keys on the last work phase, not on whether that stage is already approved, and in live fleets the phase often lags the approval. (a) Approved tickets are gated. 97 review requests in the five fleets were sent at a last work phase of spec or plan after that stage's approve-* act: devteam-dev 59, mothership 14, stacksbot 10, stacks 7, website 7. Examples: kit-240 at plan, "waiting for your build word (spec and plan approved at 9f219c6)"; kit-90 at plan, "spec and plan approved … waiting for your word"; app-252 at plan, "task 1 done: contract 2.0 committed alone". After release, such a ticket has no passing check, so send dies. selfcheck then fails most approved drafts (review f measured 74% of specs and 88% of plans), so the worker must rewrite an approved spec or plan just to ask for its build or contract word. (b) Plans skip the check. Roughly 190 plan-approval requests (messages naming approve-plan) went out while the last work phase was still spec. Examples: mothership app-23, "plan ready for approve-plan" at spec; website sanctuary-164 likewise. The gate then checks the spec's self-check and passes the plan unchecked, the stage this PR most wants covered. A5 only tests tickets whose phase was moved on by hand. Fix: take the stage from the approvals, not the phase. Gate spec until approvalOf(from, 'approve-spec'), then plan until approvalOf(from, 'approve-plan'), then nothing. Add A5 cases for a ticket at phase plan with approve-plan logged (not gated) and a ticket at phase spec with approve-spec logged (gated on the plan check).

Notes

  • Minor: owner review pages are gated too. worker.md's "When the owner has many rows to decide" step 3 sends review ready: <page> … --kind review-request, and previews and mocks are named in a review request. At spec or plan, the gate refuses these until the stage's self-check passes, even when the spec waits on that very owner decision. The worker can get past it only by writing every row as deferred: plan task N. Exempt review ready: requests, or say in worker.md that they go after the self-check.
  • Minor: the gate sits at the approval request, which worker.md's table and the live messages place after reviews/<stage>-N.md. So it is a backstop, not a pre-review gate: a worker who skipped the check is sent back to edit a draft its reviewer already approved. metrics' self_checked/unchecked split orders by time, so it is honest about this.
  • Minor (as in review f): (T3)-style citations and wrapped bullets block the gate, though quality.md §6 calls a citation in another form Minor. The PR body says the check stays strict.
  • Minor: in A6, sc-10-home runs in a single-repo fixture, so it tests the Records sha but not the repo('home') branch of selfCheckedBefore. I read that branch and found nothing wrong.
  • Governance: no widening. selfcheck writes a phase line as the ticket, like cmdPhase, and the gate applies only to writerClass === 'ticket'. No owner-only rule is touched.
  • Not checked: the split-dist manifest locally (CI's test job is green at the head).

Opened by the box operator.

Verdict: CHANGES 81c966e

hhff and others added 2 commits December 5, 2026 06:41
…e (review g)

The phase lags the approvals in live fleets: 97 review requests went out
after their stage's approve-* act, and about 190 plan requests at phase
spec. The gate now takes spec until approve-spec, then plan until
approve-plan, then nothing, for a ticket whose work is at spec or plan.
A `review ready:` owner page is not gated. worker.md says the gate is a
backstop at the approval request, so the check runs before the review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Fixes for review g at 81c966e. The new head is 8967aff: the fix commit, then origin/main merged in with no conflicts.

  • F1: the stage now comes from the approvals. A new selfCheckStageOf gates spec until approve-spec is logged, then plan until approve-plan is logged, then nothing. It applies only to a ticket whose last work phase is spec or plan:
    • past plan (contract, build and later), nothing is ever asked;
    • a ticket with no work phase has no draft to check. Gating those would also catch messages like responder-contract's worker review request.
  • New A5 cases:
    • At phase plan with approve-spec and approve-plan logged and no self-check ever run, the build word goes through.
    • At phase spec with approve-spec logged, "plan ready for approve-plan" is refused and names selfcheck plan. After a passing plan check it goes through.
  • Minor, owner review pages: a request whose text starts review ready: is exempt (worker.md's many-rows flow). A5 sends one while the plan check is still missing.
  • Minor, honesty: the PR body and worker.md §4 now call the gate a backstop at the approval request, not a pre-review gate, and say to run the check before the review starts. I did not add a check where the reviewer's records are requested. A spec or plan review is run by a subagent the worker starts itself, so no kit command runs there to hang a gate on.
  • Rollout: the body and release note now say that tickets with an approved stage are not gated. Those 97 past requests would go through.
  • Mutants (A5), each red with the source restored (checked with cmp):
    • phase-stage: the gate reads workStageOf again.
    • no-plan-approval: approve-plan is ignored.
    • ready-gated: the exemption is removed. At first this one stayed green, because the review ready: send came after the plan check. I moved it before the check, and it goes red now.
  • Local run: test/pre-review-selfcheck.test.mjs through testslot gave 7/7 before the merge. A5 passes again after the reorder.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review i: the gate checks only the first unapproved stage, so plans asked for with or before the spec still skip their check

  • Reviewer: operator-review-i (fresh subagent, claude-opus-5-5), not the author
  • Head: 8967aff
  • Date: 2026-12-05T07:43Z

What I ran vs only read

  • Read:
    • the PR body, and reviews f and g with their fix notes;
    • quality.md §1 and §3, and worker.md §4 at the head;
    • supervisor.md's review-request row and its approve acts;
    • git diff origin/main...HEAD;
    • in devteam.mjs: selfCheckStageOf, workStageOf, approvalOf, the cmdSend gate, cmdSelfcheck, cmdPhase, logWriter/writerClass and selfCheckedBefore.
  • test/pre-review-selfcheck.test.mjs at the head (testslot, --file-timeout 900, hub env pointed away): 7/7 pass (368 s).
  • Mutation no-work-filter: I deleted selfCheckStageOf's work-phase line (if (!['spec', 'plan'].includes(workStageOf(id))) return null;). A5 went red (6 pass, 1 fail). I restored the file and checked it with cmp. The author's phase-stage, no-plan-approval and ready-gated mutants I only read, not re-ran.
  • Probe test, written in my clone, run at the head, then deleted. It used the same fixture as A5 and shows what the head does today:
    • P1: a ticket at phase plan, with spec.md passing selfcheck spec and a plan.md that fails tldr-shape and tldr-cites-tasks. It sends "spec and plan ready for approve-spec and approve-plan". Accepted (status 0); the plan is never checked.
    • P2: a ticket with approve-spec logged, reopened to phase spec with a rewritten spec and no plan.md. It sends "rescoped spec ready for approve-spec again". Refused: "a review request on a plan follows a passing self-check". selfcheck plan then dies with "no plan.md … commit the draft first". The rewritten spec is never checked.
    • P3: a ticket at phase build with only approve-spec logged and a broken plan. It sends "plan ready for approve-plan". Accepted, with no check.
    • P4: a ticket with no work phase and a broken spec. It sends "spec ready for approve-spec". Accepted, with no check.
  • Read-only replay of the five fleets' docs/devteam/project/log/*.jsonl: devteam-dev, mothership, stacks, stacksbot and website, 5,185 worker review-request messages in all.
    • Method: pure node; nothing under ~/code was written. Each message was judged by this head's rule, using the last work phase and the approve-spec/approve-plan acts logged before it, with review ready: pages exempt.
    • Plan requests at a lagging phase are checked. Every request sent at phase spec after approve-spec and before approve-plan is now gated on plan: 24 such requests, 0 missed. The 369 requests sent after their stage was approved are not gated (devteam-dev 132, mothership 38, stacks 43, stacksbot 62, website 94).
    • Some approved-stage requests are still refused: 7. All 7 ask to re-approve a spec that was already approved (F2): devteam-dev kit-803 and kit-873; stacks stacks-09, stacks-40 and stacks-277 ×2; website inference-109.
    • Tickets with no logged work phase: 0 of the 5,185 requests came from one.
    • Plans approved with no request ever gated on plan: 351 of 1,554 approve-plan acts (devteam-dev 115, mothership 70, stacks 64, stacksbot 59, website 43). Why:
      • 314: every plan request went out while approve-spec was not yet logged. These are combined "approve-spec and approve-plan" asks, or a plan request sent before the spec act landed. Example: devteam-dev kit-201, 2026-11-14T22:12:24Z, "asks approve-spec and approve-plan" at phase plan; approve-spec followed 10 s later and approve-plan 1 s after that.
      • 19: asked for at a phase past plan (build, contract, verify or final-review), e.g. stacks-14 and scripts-41.
      • 6: no request named the plan.
  • CI at the head: test success, box-image success.

Findings

Id Severity Rule Where Finding
F1 Important quality.md §3 Severity (a real defect with a plausible failure path); worker.md §4 as changed here ("a review request sent before the stage's approval (spec until approve-spec …, then plan until approve-plan …) waits for one") devteam.mjs selfCheckStageOf / cmdSend gate defect: the plan still slips past its check. The gate asks for one check only, for the first stage without its approval act. A request sent while approve-spec is missing therefore needs only the spec's check, even when it asks for the plan too. Combined spec-and-plan asks, and plans sent before the spec act lands, go through with the plan unchecked (probe P1). This is how 314 of 1,554 plan approvals in the five fleets came about, so about a fifth of plans would still reach approve-plan unchecked: plan is the stage the PR's own numbers say needs it most (58–84% first-pass rejection). The work-phase filter opens a second hole. A worker who has logged phase build or contract before approve-plan is never gated (probe P3; 19 plan approvals in the replay). The doc text promises a check before every stage's approval, and the code does not do that. Fix: require a passing check bound to the current draft for every stage among spec and plan that is not yet approved and has a committed <stage>.md on ticket/<id>. Gate on whether approve-plan exists, not on the work phase. Add A5 cases for a combined ask and for a plan ask at phase build. (Or hang the plan check on act --class approve-plan, which already refuses a plan with no TL;DR.)
F2 Important quality.md §3 Severity; the PR's claim that "only a stage not yet approved" is refused same defect: re-approving a reopened spec is refused, and for the wrong stage. A spec rescoped after approve-spec (phase back to spec, a new spec-N review, a new approve-spec ask) is gated on plan. Without a plan the worker cannot send at all: selfcheck plan dies "no plan.md" (probe P2). Meanwhile the rewritten spec is never checked. The replay found 7 such requests from 6 tickets in 3 fleets; stacks-277 asked twice (spec-12, spec-16). Fix: fold this into F1's fix. Treat a stage as approved only for the draft its approval saw, or gate each unapproved-or-changed stage that has a draft. At minimum, never gate on a stage whose <stage>.md doesn't exist.

Notes

  • The no-work-phase skip is not a bypass in practice. 0 of 5,185 requests came from such a ticket. A worker who never logs phase spec would skip the gate (probe P4), but the worker flow logs it, and selfcheck itself writes a work phase over starting. The real skip is the past-plan filter in F1. Minor on its own.
  • Governance: no widening. The gate applies only to a ticket writer's review-request. selfcheck writes a phase line as the ticket, as cmdPhase does. No owner-only rule is touched.
  • Not re-run: the author's phase-stage, no-plan-approval and ready-gated mutants (read only), and review-dates.test.mjs (a one-line change; CI's test job is green).
  • Replay limits. It assumes every by that isn't owner, supervisor, responder or plan-* is a ticket in the graph. The intent buckets (plan/spec/word) come from regexes over the message text, so counts are approximate. The structural counts (gated stage, approvals, work phase) are exact.

Opened by the box operator.

Verdict: CHANGES 8967aff

hhff and others added 2 commits December 5, 2026 08:33
…ot send (review i)

Gating the review request checked only the first unapproved stage, so
combined spec-and-plan asks and plans sent before approve-spec reached
approval unchecked, and a spec re-scoped after its approval was gated on
the plan. Now each approve act refuses unless a passing self-check read
the <stage>.md committed now (by blob id), and records the draft it
approved. --no-selfcheck "<why>" approves a draft no worker checked and
records why; the kit's test fixtures use it, and the G1 golden is
re-recorded for that field. send only notes what approval will refuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Restructured for review i at 8967aff (issuecomment-7434351194). The new head is 990252d: the fix commit, then origin/main merged in with no conflicts.

  • The gate is on the approval, not the send. act --class approve-spec|approve-plan refuses unless a passing selfcheck <stage> read the <stage>.md committed on ticket/<id> now, matched by blob id. The refusal names the command, for example: "approve-plan refused: sc-12-both's plan has no passing self-check: the worker runs devteam.mjs selfcheck plan on the committed draft …". The act records the draft it approved (selfcheck: {draft}, added to the schema).
  • F1:
    • Each stage is approved on its own check. A combined ask approves the spec and refuses a broken plan, and the phase isn't read, so a ticket at build before approve-plan is still asked.
    • The send gate, selfCheckStageOf, the work-phase filter and the review ready: exemption are gone.
    • send --kind review-request only prints note: approve-<stage> will refuse: … on stderr when the committed draft of an unapproved stage has no passing check.
  • F2: a spec re-scoped after approve-spec is another blob. Re-approving it is refused until a new check passes.
  • Flows with no worker draft. No kit code logs an approve act by itself; both come from act, directly or via decide then act --decision, and the gate covers both paths. For a draft no worker checked, I added an explicit --no-selfcheck "<why>":
    • The reason needs at least 20 characters, and the act records it as selfcheck.skipped.
    • A bare flag, or the flag on any other class, is refused.
    • The kit's test fixtures approve placeholder drafts with it ("a test fixture: no worker draft to check"). That is 48 call sites in test/, plus 16 in the split overlay's chain.mjs.
    • The G1 golden was re-recorded. Its diff is only that selfcheck field on the two approve acts.
  • Docs: worker.md §4 says the approvals refuse an unchecked draft, so run the check before asking, and a combined ask needs both checks. supervisor.md's approval line and its review-request row say approve-* refuses without the check and name the flag.
  • Tests (A5, rewritten):
    • refused with no check, naming the command, then approved after one, with the draft recorded;
    • a re-scoped spec refused until checked again;
    • a combined ask with a broken plan: spec approved, plan refused, at phase plan and at build;
    • no committed draft refused;
    • --no-selfcheck recorded with its reason; bare, short, or on another class refused;
    • approvals logged by an older kit untouched;
    • the review request's note;
    • log-check passes.
  • Mutants, each turning A5 red, with the source restored (checked with cmp):
    • no-gate: the refusal removed;
    • any-check: any passing check counts, not the one bound to the draft;
    • first-stage: approve-plan checks the spec;
    • skip-free: a short reason accepted.
  • Local runs through testslot, one file at a time: pre-review-selfcheck (7/7), components (G1 against the new golden), multirepo-tickets, kit.validate and merge-main-moved all pass. The chain (kit.test.mjs) and the other fixture files are left to CI.
  • Fleet replay: not re-run. Approval now requires the check whatever the phase or the request's wording, so review i's 314 + 19 plans and its 7 re-scoped specs would all be refused until checked. The rule doesn't depend on any of the message-text buckets the replay measured.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review k: approve-spec/plan checks only refs[0], so a second ticket in --refs is approved unchecked; --no-selfcheck leaves no trace outside the act

  • Reviewer: operator-review-k (fresh subagent, claude-opus-5-5), not the author
  • Head: 990252d
  • Date: 2026-12-05T09:17Z

What I ran vs only read

  • Read: the PR body; reviews f, g and i and the author's replies; quality.md §1 and §3; git diff origin/main...HEAD. In devteam.mjs I read cmdAct (the decision path, refs, the approve-plan block, the new gate), approvalOf (refs.includes(id)), selfCheckGap, selfChecks, draftBlob/ticketDraftRef, recordsRepo/factsRepo/recordsInHome, selfCheckedBefore, cmdSelfcheck, the cmdSend note, currentTicketId/logWriter, every appendLog({ type: 'act' site (none but cmdAct can log an approve-* act whose refs[0] is a ticket; answer --read logs one with refs [qid], which approvalOf never matches to a ticket), the schema and the doc changes.
  • test/pre-review-selfcheck.test.mjs at the head (testslot, --file-timeout 900, DEVTEAM_HUB_PORT pointed at a throwaway port, DEVTEAM_IMAGE_HUB unset): 7/7 pass.
  • Probe test (a scratch file in my clone, run once, then deleted):
    • P1, records in home: the worker runs selfcheck spec from the console code worktree (and from its home records worktree) and gets a pass (exit 0). The supervisor's approve-spec with no flag is then accepted. The draft blob is read from home's ticket/<id> on both sides.
    • P2, records in the link: the worker runs selfcheck spec in console's worktree and gets a pass. approve-spec is accepted. The blob is read from console's ticket/<id> on both sides.
    • P3, single repo:
      • act --class approve-spec --refs mm-01-a mm-02-b, where only mm-01-a has a check and mm-02-b's spec.md is garbage spec, is accepted (exit 0). After it, mm-02-b's status row reads stage: "spec'd", and check-ticket mm-02-b no longer says "spec not approved".
      • decide --class approve-spec --refs mm-03-c, then act --decision <d>, is refused with "no passing self-check". act --decision <d> --no-selfcheck "<why>" is accepted.
      • Nothing in metrics --json mentions skipped, and no finding appears.
  • Mutation 1 (one run, two mutants):
    • selfChecks lost its ok === true filter, so a failing check counts. A5 went red ("the unchecked plan is not approved").
    • selfCheckedBefore's before was forced to true, so a check logged after the review counts. A6 stayed green: nothing tests this.
  • Mutation 2: the cmdSend stderr note removed. A5 went red (the note regex).
  • The file was restored with cmp after each run, and git status was clean apart from .scratch/.
  • Fleet replay (read-only, five fleets' project/log/*.jsonl): 3,194 approve-spec/approve-plan acts (devteam-dev 1,150, mothership 520, stacks 463, stacksbot 442, website 619), 132 of them through --decision. In none was a second ref a ticket id. The other refs were shas, m-, a- and q- ids.
  • CI at the head: test, test-stress and box-image all success.

Findings

Id Severity Rule Where Finding
F1 Important quality.md §1 point 2 (the approve acts are what check-ticket counts); quality.md §3 Severity; the PR's claim that each approve-* "approves only the committed draft a passing check read" devteam.mjs cmdAct: selfCheckGap(refs[0], …) against approvalOf ((a.refs ?? []).includes(id)) defect: a spec or plan is approved unchecked when its ticket is not refs[0]. The gate checks only the first ref. approvalOf, and through it check-ticket and the dashboard's stage, count an approve act for every ref it lists. act --class approve-spec --refs <checked> <unchecked> is accepted, and the second ticket's spec reads as approved (probe P3: a one-line garbage spec reaches spec'd, and check-ticket drops "spec not approved"). decide --refs A B then act --decision goes the same way, because the decision path compares only refs[0]. The act's recorded selfcheck.draft is A's alone, so the record is wrong about B too. None of the 3,194 past acts did this, but supervisors do put extra refs on these acts (shas, messages, acts). Batching two tickets' approvals into one act is a natural shortcut during the refusal burst the PR expects. Fix: in cmdAct, for approve-spec and approve-plan, refuse any ref after the first that is a ticket id ("one ticket per approval"), or run the gate (and the plan's TL;DR and door checks) for every ticket ref. Add an A5 case.
F2 Important quality.md §3 Severity (a real defect or missing check with a plausible failure path); supervisor.md step 8 as changed here (--no-selfcheck is for "a draft no worker checked") cmdAct --no-selfcheck; reviewStats/metrics missing check: the bypass is unbounded and invisible. Any supervisor can approve any worker's real draft with --no-selfcheck "<any 20 characters>". The kit doesn't test the documented condition, though it could: the ticket has a worker's phase lines or failing selfcheck lines. And nothing reads selfcheck.skipped: not metrics (P3), not a finding, not the timeline or dashboard. By the PR's own numbers the gate will refuse 74% of specs and 88% of plans at first. A supervisor told to keep the box hot then has a silent way round it that no daily review, metrics read or operator check-in will ever see. The PR's success measure (self_checked vs unchecked) can't tell "workers skipped the check" from "supervisors waved drafts through". Fix: count approvals per stage in metrics (reviews.by_stage.<stage>.approvals: {checked, skipped}, plus last_7d), and raise a finding, or refuse without --approved <owner qid>, when --no-selfcheck lands on a ticket whose worker has logged phase or selfcheck lines. Test both.

Notes

  • Minor, docs disagree with the code. Several texts still describe the send gate this restructure removed:
    • the selfcheck help line ("a review request on a spec or plan waits for one");
    • the phase selfcheck schema description ("A review request on a spec or plan waits for a passing one");
    • its draft description ("a review request after an edit needs a fresh check");
    • the code comment above SELFCHECK_STAGES ("a review request … waits for one (cmdSend)").
  • Minor, an untested claim. The PR says "a check logged after a review with a time doesn't count for it". Removing that filter leaves A6 green (mutation 1).
  • Minor, pre-existing trust model. A supervisor shell with DEVTEAM_TICKET=<id> can run selfcheck as the ticket and log a pass. No guard stops a supervisor writing as a ticket, the same as for phase and send. It's less visible than --no-selfcheck, and that is one more reason to surface the latter honestly, as F2 asks.
  • Deadlocks: none found.
    • A worker can always run selfcheck on its own committed draft. This holds in single-repo, records-in-home and records-in-link setups (P1, P2).
    • A draft that can't take the mechanical shape has --no-selfcheck.
    • send is never refused.
    • A re-scoped spec needs only its own check, and a plan's absence doesn't block the spec.
    • Still, selfcheck runs a full reviewStats() (every ticket's reviews, now with selfCheckedBefore per first pass) just to choose three rules. It is slow on big fleets, but it runs inside a try, so it can't block.
  • decide then act --decision: gated (P3). The --no-selfcheck class check runs after the class comes from the decision.
  • Governance: no owner-only rule loosened. Approvals stay the supervisor's, and the gate only adds a condition. F2 is about visibility, not authority.
  • Not checked locally: the chain, G1 and split-dist files (CI's test and test-stress are green at the head).

Opened by the box operator.

Verdict: CHANGES 990252d

hhff and others added 2 commits December 5, 2026 09:19
…elfcheck

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elfcheck (review k)

F1: act --class approve-spec|approve-plan (direct or via --decision) now runs
the selfcheck gate for every ticket in refs, since approvalOf counts the
approval for each; it refuses naming the ticket whose draft no pass read, and
the act records each draft (selfcheck.drafts for tickets after the first).

F2: metrics counts spec and plan approvals per stage as checked, skipped
(--no-selfcheck) or unrecorded (older kit), all time and last 7 days
(approvals.by_stage, json and text), and raises a medium approval-unchecked
finding when a ticket's latest approval of a stage in the last 7 days skipped
the check though its worker had logged phase lines by then.

Minors: A6 tests that a check logged after a timed review doesn't count for
it; the selfcheck help line, two schema descriptions and the code comment no
longer describe the removed send gate. G1 re-recorded (the approvals block).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Review k fixes, at e0989d2 (merged origin/main first, at edbd15a)

  • F1 (refs[0] only): cmdAct now runs the selfcheck gate for every ticket in --refs (refs[0], plus each later ref that is a ticket id, deduplicated). It refuses naming the ticket that fails, for example approve-spec refused: sc-14-two's spec has no passing self-check …. The decision path goes through the same code, so decide --refs A B then act --decision is gated too. The act records each draft: selfcheck.draft for the first ticket and selfcheck.drafts: [{ticket, draft}] for the rest. The new field is in log.schema.json.
    • A5 now refuses --refs <checked> <unchecked> directly, and through a decision naming both. Nothing approves the second ticket until its own check passes. Once it does, the act carries both drafts.
    • Mutants: first-ref (only refs[0] gated) turns A5 red. decision-first-ref (only refs[0] gated when the act runs through --decision) turns A5 red at the decision assertion.
    • Not changed: approve-plan's TL;DR and door checks still read refs[0] only. That was already so before this PR, and the brief scoped F1 to the selfcheck gate.
  • F2 (unbounded, invisible skip): metrics gains approvals.by_stage.{spec,plan}: {checked, skipped, unrecorded, last_7d: {…}}, counted for each ticket an act names. In text it is approvals (checked / --no-selfcheck / before the check): spec c/s/u (last 7 days c/s), plan ….
    • A new medium approval-unchecked finding goes on a ticket whose latest approval of a stage, in the last 7 days, used --no-selfcheck even though the ticket's worker had logged phase lines by then. That is a worker's draft that no check read.
    • A later checked approval clears it. An owner-written draft with worker lines can be acked with its reason.
    • New test A8 covers the json and text counts, the finding on a worker's skipped draft and none on a draft no worker touched, and the clearing.
    • Mutants: no-finding, any-skip (no worker-lines condition) and all-checked (skips counted as checked) each turn A8 red.
    • supervisor.md step 8 and operator.md's First passes line name the counts and the finding.
  • Minor, untested claim: A6 now has a review with a time and a check logged after it, and asserts that the check doesn't count for that review. Mutant late-check (before forced true) turns A6 red.
  • Minor, stale texts: these no longer describe the send gate. The approvals refuse instead, and a review request only hears about it.
    • the selfcheck help line;
    • the phase selfcheck schema description;
    • its draft description;
    • the comment above SELFCHECK_STAGES.
  • G1: re-recorded. metrics.txt and dashboard-data.txt gain only the approvals block.
  • Local runs (testslot, one at a time, hub port pointed away, DEVTEAM_BOX=off): pre-review-selfcheck 8/8, components 10/10, split-dist-docs 4/4, kit.validate 3/3. Every mutant run was restored and checked with cmp. The chain and the other fixture files are left to CI.
  • PR body updated for the per-ticket gate, the counts, the finding, the new tests and the mutants.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review m: the per-ticket gate covers the self-check only, so a batched approve-plan still approves a second ticket past its unanswered one-way door

  • Reviewer: operator-review-m (fresh subagent, claude-opus-5-5), not the author
  • Head: e0989d2
  • Date: 2026-12-05T11:40Z

What I ran vs only read

  • Read: the PR body, review k (7435534101) and the fix comment (7436252333), quality.md §1 and §3, and git diff origin/main...HEAD. In devteam.mjs I read:
    • cmdAct: the decision path, refs, the approve-plan door, TL;DR and pick blocks, and the new per-ref gate;
    • cmdDecide's approve-* guard, approvalOf and its readers (status stage at 5471, check-ticket 7183/7185, cmdSend note, review-request answered-by at 35636);
    • every appendLog({ type: 'act' site. Only cmdAct logs an approve-* act whose refs name a ticket. answer --read logs one with refs [qid], which approvalOf and approvalStats ignore. The dashboard only renders approve-* acts in the timeline. No chain or merge path logs one;
    • approvalStats, the approval-unchecked finding, cmdAck and the ack window;
    • selfCheckGap, selfCheckedBefore, cmdSelfcheck, and the worktree to main-kit redirect (line ~243), so a worker on an old branch runs home's kit, and there is no version-skew deadlock;
    • the schema, the G1 golden diffs, and the supervisor.md, worker.md and operator.md changes.
  • Probe (a scratch test in my clone, run once, then deleted; DEVTEAM_HUB_PORT pointed at a throwaway port, DEVTEAM_IMAGE_HUB unset):
    • P1: tickets pm-01-a (normal) and pm-02-door (risk: high, one_way_doors: ['move the data'], no owner answer), both with plans that pass selfcheck plan.
      • act --class approve-plan --refs pm-02-door is refused ("lists one-way doors; the owner answers…").
      • act --class approve-plan --refs pm-01-a pm-02-door is accepted (exit 0). Afterwards check-ticket pm-02-door no longer says "plan not approved".
    • P2: pm-03-big's plan has a 9-bullet TL;DR.
      • --refs pm-03-big --no-selfcheck "<why>" is refused (TL;DR of 9 bullets).
      • --refs pm-01-a pm-03-big --no-selfcheck "<why>" is accepted.
    • P3: a later ref naming a ticket with no ticket/ branch (a dependency cited as context) is refused with "no plan.md for pm-04-dep…". Safe, though the message reads oddly for a context ref.
    • P4: approval-unchecked was raised for pm-05-w (a worker's phase line, then the spec skipped). I acked it, then skipped its worker's plan too. The second skip stays under the 24h ack, because the subject is the ticket id alone.
      • The same run also raised it on pm-01-a, whose plan draft had a passing check, after a later --no-selfcheck re-approval of that same blob.
  • test/pre-review-selfcheck.test.mjs:
    • The whole file through test/run.mjs --file-timeout 600 timed out with no test finished, under box load (cpu busy 64%).
    • Run test by test (node --test --test-name-pattern, testslot): 8/8 pass (A5, A6, A8 singly; A1–A4 and A7 together).
  • Mutations (devteam.mjs restored from a copy and checked with cmp after each; git status clean apart from .scratch/):
    • first-ref: the gate filter i === 0 || tickets().has(r) changed to i === 0 → A5 red ("a second, unchecked ticket in refs is refused").
    • drafts-drop: the act's drafts field dropped → A5 red.
    • any-skip: the worker-lines condition workerBy(…) changed to true → A8 red.
    • no-clear: approvalStats' acts sorted newest-first, so the "latest" approval is the oldest → A8 red (the clearing).
    • later-ref-count: approvalStats counts only refs[0] → A8 stays green. Nothing tests the per-ref counting that the PR says it does (Notes).
  • CI at the head: test, test-stress and box-image all success.

Review k's findings

  • F2 (skip invisible): resolved. approvals.by_stage counts and the approval-unchecked finding work as described (A8, probe P4). Its mutants go red. Minor edges are in Notes.
  • F1 (only refs[0] gated): resolved for the self-check, not for the act. See F1 below.

Findings

Id Severity Rule Where Finding
F1 Important constitution.md §4 (a one-way door needs the owner's answer before its plan is approved); quality.md §6 (TL;DR of seven bullets at most); quality.md §3 Severity; review k F1 and its fix text ("run the gate (and the plan's TL;DR and door checks) for every ticket ref"); supervisor.md step 8 as changed here devteam.mjs cmdAct approve-plan block (const t = tickets().get(refs[0]): doors, door picks, goal-level door, tldrGap) against the new per-ref loop at ~18250 and approvalOf (refs.includes(id)) defect: a second ticket in an approve-plan act is approved past its unanswered one-way door. The fix gates the self-check for every ticket ref, but the act's other refusals still read refs[0] only. approvalOf counts the act for every ref, so act --class approve-plan --refs <ok-ticket> <door-ticket> approves a plan the owner hasn't answered the door for (probe P1: accepted, and check-ticket drops "plan not approved"; alone it is refused). The worker builds after approve-plan, so it can build past a one-way door. With --no-selfcheck the second ticket's TL;DR is unchecked too (P2: 9 bullets accepted, refused alone). Main had the same hole. This PR now documents batching as supported: supervisor.md says "an act naming several tickets in --refs approves each, so each one's draft is checked", next to "the latter also refuses while a one-way door on the ticket is unanswered", which is true only for the first. The PR expects a burst of refusals, when batching is the natural shortcut. Review k's F1 named the door and TL;DR checks in its fix, and the fix comment set them aside. Fix (either): (a) for approve-spec and approve-plan, refuse any ticket id after refs[0] ("one ticket per approval act"; k's replay found none in 3,194 acts), and drop the supervisor.md sentence; or (b) run the whole approve-plan block (doors, picks, goal-level door, tldrGap) for each ticket ref. Add an A5 case with a door ticket second.

Notes

  • Minor, test gap. Nothing tests that approvalStats counts each ticket an act names (mutant later-ref-count stays green). Add a two-ticket act to A8.
  • Minor, ack too coarse. The approval-unchecked subject is the ticket id alone (probe P4). An ack of an owner-written spec also sets aside a later skip of that ticket's worker-written plan, for the 24h window. The skip still shows under acknowledged, but a subject of <id> <stage> would keep the two apart.
  • Minor, false positive. The finding asks only whether the latest approval skipped, not whether the committed draft has a passing check. A --no-selfcheck re-approval of a draft that was checked raises it (probe P4, pm-01-a).
  • Minor, schema. The phase selfcheck.draft pattern is ^[0-9a-f]{40,64}$, which accepts 41–63 characters. The act's pattern is {40}([0-9a-f]{24})?. The act selfcheck also allows {}, or draft and skipped together: neither is required, and they aren't exclusive.
  • Minor, cost. selfCheckedBefore runs git rev-parse once per spec or plan first pass whose ticket has a passing check, on every metrics or reviewStats call in a fresh process. As checks accumulate (hundreds of first passes per fleet), that adds seconds to metrics and to selfcheck's rule pick.
  • Deadlocks: none found.
    • A worker on an old branch runs home's kit (the redirect).
    • send is never refused.
    • --no-selfcheck covers a draft that can't take the shape.
    • A context ticket in refs is refused but can simply be dropped (P3).
  • Old log lines: an act with no selfcheck is counted unrecorded and never re-checked (A5's older-kit line, A8's counts). A phase line without selfcheck is ignored.
  • G1: the golden changes only by the approvals block and the fixture acts' selfcheck.skipped, which matches the engine. CI's test and test-stress pass it.
  • Multi-repo homes: not probed again. Review k's P1 and P2 cover records-in-home and records-in-link, and the gate code there is unchanged since.
  • Governance: apart from F1 (a refusal on an owner-only rule that the code doesn't do for every ref), no authority widened. --no-selfcheck is the supervisor's and is now visible.

Opened by the box operator.

Verdict: CHANGES e0989d2

hhff and others added 2 commits December 5, 2026 11:18
…elfcheck

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tighter schema (review m)

F1: approve-spec and approve-plan refuse a second ticket id in --refs,
directly and through decide then act --decision: approvalOf counts an act
for every ref while the self-check, door, door-pick, goal-level door and
TL;DR checks read the first. One act per ticket; other refs (shas,
messages) still ride along. The drafts[] field and the batching text in
supervisor.md are gone.

Minors: approval-unchecked is raised per "<ticket> <stage>", so an ack of
one stage leaves the other; not raised when the committed draft has a
passing check (a --no-selfcheck re-approval of a checked draft). The act's
selfcheck is a oneOf (draft or skipped, never both, never empty), which
schemaErrors now checks, and the phase draft id is exactly 40 or 64 hex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Review m fixes, at 88901be (merged origin/main first, at f3aef7b)

  • F1 (a second ticket rode past the door and TL;DR checks): I took the simple fix. approve-spec and approve-plan approve one ticket per act. A second ticket id in --refs is refused: "approve-plan approves one ticket per act: A first, and B is a ticket too; log an act for each".
    • Through decide then act --decision, the act is refused the same way, and says to decide again for each ticket.
    • Refs that aren't tickets (a sha, a message) still ride along.
    • The drafts[] field is gone from the code and the schema. supervisor.md now says one act per ticket, in place of the batching sentence.
    • A5 tests:
      • two checked tickets are refused;
      • a decision naming both is refused at its act;
      • a door ticket (one_way_doors, unanswered) second behind an approvable plan is refused. Alone, its door refuses it;
      • a sha as the second ref is accepted, and the act records its one draft.
    • Mutants:
      • many-tickets (refusal removed) turns A5 red;
      • decision-many (refusal skipped on the --decision path) turns A5 red at "a decision naming two tickets is refused at its act".
  • Minor, per-ref counting gap: with one ticket per act, your later-ref-count mutant is now equivalent on every act the kit can log. Only an act from before this change could name two tickets. approvalStats still counts each ticket ref, matching approvalOf, for those older acts.
  • Minor, false positive: approval-unchecked is no longer raised when the draft committed now has a passing check, so a --no-selfcheck re-approval of a checked blob is quiet. A8 covers it. Mutant checked-now turns A8 red.
  • Minor, ack too coarse: the finding's subject is now <ticket> <stage>. A8 raises the spec and the plan of one ticket, acks the spec's, and the plan's stays. Mutant ticket-subject (the ticket alone) turns A8 red.
  • Minor, schema:
    • The act's selfcheck is now oneOf: [{required: [draft]}, {required: [skipped]}], so it is never {} and never both. The kit's schemaErrors gained oneOf: exactly one form must hold.
    • The phase selfcheck.draft pattern is now ^[0-9a-f]{40}([0-9a-f]{24})?$.
    • New test A9 has log-check refuse hand-written copies with {}, with both fields, and with a 50-character draft id. A well-formed copy passes.
    • Mutants no-oneof and mid-length turn A9 red.
  • Optional git-call cache: not done. selfCheckedBefore already memoizes per process. A cross-process cache is its own change.
  • Local runs (testslot, one file at a time, hub port pointed away, DEVTEAM_BOX=off): pre-review-selfcheck 9/9, components 10/10 (G1 unchanged by this round), kit.validate 3/3, world-contract 15/15, split-dist-docs 4/4. Every mutant run was restored and checked with cmp.
  • PR body updated: the one-ticket rule, the finding's subject and condition, the schema's oneOf, the tests and the mutants.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review n: a ticket id not in the graph yet rides past the one-ticket rule and the self-check gate

  • Reviewer: operator-review-n (fresh subagent, claude-opus-5-5), not the author
  • Head: 88901be
  • Date: 2026-12-05T12:15Z

What I ran vs only read

  • Read: the full diff of devteam.mjs, log.schema.json, worker/supervisor/operator.md, test/pre-review-selfcheck.test.mjs, the fixture edits; approvalOf (5457), checkTicket's approval lines (7191-7193), the review-request answer rule (35643), schemaErrors and its callers, schemaSubsetErrors/SCHEMA_CHECKED (16577), review m's fix comment.
  • Ran (testslot, one file at a time, hub port pointed away, DEVTEAM_IMAGE_HUB unset, DEVTEAM_BOX=off): test/pre-review-selfcheck.test.mjs at the head: 9/9 pass.
  • Mutations (each restored, checked with cmp):
    • many-tickets (if (false && more.length) die(): A5 red.
    • oneof-lt (held !== 1 to held < 1, so both fields pass): A9 red.
    • no-oneof (oneOf block skipped): A9 red.
    • workerby-true (the worker-phase condition dropped from approval-unchecked): A8 red.
  • Probe (a scratch test built on the file's own setup, removed afterwards): sc-06-send self-checked; act --class approve-spec --refs sc-06-send sc-20-later with sc-20-later not yet in the graph: accepted (status 0). Then ticket add sc-20-later and commit spec.md = "not a spec at all". Result: check-ticket sc-20-later lists no "spec not approved" (only plan/verification/final-review fails); metrics --json approvals.by_stage.spec.checked = 2, so the unchecked draft counts as checked; unchecked_worker_drafts is empty. A direct approve-spec --refs sc-20-later is refused ("no passing self-check"), so the earlier act is the only reason it reads approved.
  • CI at the head: box-image success, test success, test-stress success (all completed).

Prior findings

  • k F1 (only the first ref checked) and m F1 (door/TL;DR checks read refs[0]): resolved for every ref that is a ticket at act time, directly and via decide then act --decision (A5 covers both; many-tickets turns it red). Not resolved for a ref that becomes a ticket later (F1 below).
  • k F2 (skip unreported): resolved: approvals.by_stage counts and approval-unchecked <ticket> <stage>; workerby-true turns A8 red.

Findings

Id Severity Rule Where Finding
F1 Important quality.md §1.2 (the approve acts check-ticket asks for); the PR's own claim "approve-spec and approve-plan approve one ticket per act" and "the gate covers both" cmdAct one-ticket check (tickets().has(r) at act time) vs approvalOf (5457, refs.includes(id) on every ref, forever) and approvalStats "Is a ref a ticket" is decided against the graph as it is when the act is logged, but approvalOf honours every ref of the act for any ticket added later. An approve act that names a not-yet-added ticket id second (e.g. a supervisor batching the old way, which supervisor.md described until this PR, with a ticket from a plan not yet landed) is accepted; when that ticket is added, check-ticket treats its spec/plan as approved with no self-check of its draft, no one-way-door check and no TL;DR check, and metrics counts it as checked, so approval-unchecked can never fire and the measure the PR asks us to watch is wrong. Shown by the probe above. Case, prefixes and multi-repo ids are not an issue (ids are lowercase kebab, approvalOf matches exactly, all repos' tickets are in one graph); the gap is only time. Fix suggestion: make approvalOf (and approvalStats) count only refs[0] for an act that carries selfcheck (every act this kit logs), keeping every-ref counting for older lines; or refuse any extra ref of ticket-id shape that is not a known non-ticket id. Add the probe as an A5 case.

Notes

  • Minor: schemaErrors gaining oneOf changes nothing else: the only oneOf in any schema is the new act selfcheck; old approve acts have no selfcheck, so they never reach it; result schemas for review check still refuse oneOf (SCHEMA_CHECKED unchanged, chain.mjs:3499 still holds). The comment above SCHEMA_CHECKED ("the keywords schemaErrors checks") is now stale.
  • Old multi-ticket acts in logs: approvalOf still honours them; acceptable, since they were approved under the old rule and the PR says logged approvals are untouched. They count as unrecorded, which is honest.
  • Minor, docs vs engine: worker.md §4 still says a missing citation or one in another form ((T3)) is Minor, but selfcheck plan fails on it and approve-plan refuses until fixed; the same paragraph discloses the check, so it is consistent in effect, but the Minor line could say "selfcheck still asks for it".
  • supervisor.md's "refusing a second ticket id in --refs (directly or through decide)": decide itself accepts both; the refusal comes at the act. Accurate enough, could say "at its act".
  • Deadlocks: none found. Every refusal names a way out (selfcheck <stage>, or --no-selfcheck "<why>" for an owner's draft). A local ticket/<id> behind origin/ticket/<id> would make the gate read a different blob than the worker checked (local is preferred); in the worktree layout the branch is shared, so I did not pursue it.
  • Not checked: the full suite and the G1-touching files (components, chain); CI ran them green at this head.

Opened by the box operator.

Verdict: CHANGES 88901be

hhff and others added 2 commits December 5, 2026 12:16
…elfcheck

Conflicts in devteam.mjs's session help and command table: kept selfcheck and main's test-proof.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
F1: whether a ref is a ticket was judged when the act was logged, but
approvalOf and approvalStats honoured every ref forever, so an id that
became a ticket later read as approved (and counted as checked). An act
that carries selfcheck (every one this kit logs) now approves only refs[0]
(approvedBy); an older line still approves every ref it names.

Minors: the comment above SCHEMA_CHECKED says what it is now; worker.md
§4 says selfcheck plan still fails an uncited or (T3)-style bullet the
review calls Minor; supervisor.md says the refusal comes at the act, not
at decide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Review n fixes, at 456aefb (merged origin/main first, at 87f911d)

  • Merge: origin/main conflicted in devteam.mjs's session help and command table. I kept both selfcheck and main's new test-proof.
  • F1 (a later ticket read as approved): I took your fix.
    • A new approvedBy(act) gives the tickets an approve act approves. For an act that carries selfcheck (every act this kit logs), that is refs[0] only. An older line still approves every ref it names.
    • approvalOf, and through it check-ticket and the status stage, use it. So does approvalStats.
    • A5 now has your probe. act --class approve-spec --refs sc-06-send sc-21-later is accepted while sc-21-later isn't a ticket yet. Once it is added with a garbage spec, its status stage isn't spec'd, and metrics' spec approval counts are unchanged.
    • Mutants:
      • every-ref (approvedBy returns every ref) turns A5 red at "the ticket added later reads as not approved";
      • stats-every-ref (only approvalStats counts every ref) turns A5 red at "and metrics counts no approval for it".
  • Minor, SCHEMA_CHECKED comment: it now says these are the keywords a review's result schema may use. It notes that schemaErrors also checks oneOf, for the log schema only.
  • Minor, worker.md §4: after "is Minor" (the sentence spec-sections pins is unchanged), it now says selfcheck plan still fails a top-level bullet with no (Task N…) or (no task: …) citation, so (T3) fails it, and approve-plan waits for that check.
  • Minor, supervisor.md: a second ticket id is refused at the act. A decide naming two is accepted, and its act --decision is refused. An act approves only its first ref, even one that later names a ticket.
  • Local runs (testslot, one file at a time, hub port pointed away, DEVTEAM_BOX=off): pre-review-selfcheck 9/9, components 10/10, spec-sections 7/7. Both mutant runs were restored and checked with cmp.
  • PR body updated with the first-ref rule, the new A5 case and its mutants.

Opened by the box operator.

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review o: approvals are one ticket per act end to end; reviews k, m, n resolved; merge resolution sound

  • Reviewer: operator-review-o (fresh subagent, Claude Opus 5.5), not the author
  • Head: 456aefb
  • Date: 2026-12-05 UTC

What I ran vs only read

  • Scratch clone at the head above; read git diff origin/main...HEAD (25 files), cmdAct, approvedBy/approvalOf, approvalStats, selfCheckGap, selfCheckedBefore, cmdSelfcheck, the send note, reviewStats, the schema, the three process docs and the A1–A9 tests.
  • Merge 87f911d8 (parents 88901beb, 37ce3e96 = origin/main = merge base): git show --cc shows the only conflict hunks are HELP_SESSIONS (both the selfcheck and main's test-proof lines kept, in order) and COMMANDS_SESSIONS (selfcheck: cmdSelfcheck added beside main's 'test-proof': cmdTestProof). git diff origin/main...HEAD equals git diff origin/main HEAD (856+/85-), so nothing of main was dropped.
  • testslot nice -n 19 node test/run.mjs --file-timeout 600 test/pre-review-selfcheck.test.mjs at the head: 9/9 pass (212 s).
  • Mutations (each applied with perl, the file run, source restored and checked with cmp and git diff --quiet):
    • every-ref: approvedBy returns every ref for any act → red (A5).
    • stats-every-ref: approvalStats iterates a.refs instead of approvedBy(a) → red (A5).
    • many-tickets: the one-ticket refusal in cmdAct disabled → red (A5).
    • no-gate: if (gap.why) die(...) disabled → red (A5).
    • oneof-off: schemaErrors' oneOf check disabled → red (A9).
    • old-first-only: approvedBy takes only refs[0] for older acts too → stays green (Minor M1 below).
  • CI at the head: test success, test-stress success, box-image success.
  • Not run locally: components, split-dist-docs, devteam-mjs-regions (CI green at this head covers them).

Prior findings

  • k F1 (second ticket approved unchecked): resolved. cmdAct refuses any ticket after refs[0] for approve-spec/approve-plan, by --class and through --decision (many-tickets goes red).
  • k F2 (invisible bypass): resolved. approvals.by_stage counts checked/skipped/unrecorded, and approval-unchecked <ticket> <stage> is raised (A8).
  • m F1 (door ticket rides second): resolved by the same refusal. A5 covers a door ticket second, and supervisor.md no longer says batching is supported.
  • n F1 (id that becomes a ticket later): resolved. approvedBy gives refs[0] only for an act carrying selfcheck, and approvalOf and approvalStats both use it (every-ref and stats-every-ref go red).

Readers of approvals

  • approvalOf → ticket stage (status, dashboard stage, next/ready/goal progress through stage) and checkTicket (check-ticket, check-pr, merge/chain). All go through approvedBy.
  • approvalStats uses approvedBy.
  • The send note uses approvalOf.
  • The review-request "answered" test (refs[0] === by) was already first-ref only.
  • The dashboard only titles acts by their first ref.
  • Lines 18000 and 18092 match refs for consuming an owner's --approved answer, which is not a stage approval. Unchanged and unaffected.
  • The answer --read act (12542) carries a q-id ref, never a ticket.
  • No other flow writes approve-spec or approve-plan acts.
  • A hand-written selfcheck-carrying act with several refs approves only refs[0], so it fails safe.
  • Older lines keep every-ref approval in both readers, consistently.

Findings

Findings: none.

Notes

Id Severity Where Note
M1 Minor test/pre-review-selfcheck.test.mjs A5 No test pins "an older line still approves every ref it names": the old-first-only mutant survives. Review k counted no multi-ticket act in 3,194 past acts, so the risk is low. A one-line old act naming two tickets in the sc-11-past fixture would hold it.
M2 Minor supervisor.md step 8 After the long insertion, "the latter also refuses while a one-way door on the ticket is unanswered…" now follows the approval-unchecked clause, and "the latter" no longer clearly means approve-plan. Say "approve-plan also refuses …".
M3 Suggestion approvalStats An approve act without selfcheck logged after this kit is live, whether written by hand or by a checkout on an older kit, counts as unrecorded, approves every ref and raises no finding. Hand-writing log lines already bypassed every act gate, so this isn't new. Still, metrics could flag an unrecorded approval dated after the log's first selfcheck-carrying act.
M4 Suggestion devteam.mjs WORK_PHASES/workStageOf Dead code since review i's restructure: nothing calls it.
M5 Suggestion cmdDecide decide --class approve-spec --refs A B is accepted, and only its act is refused. act --decision d --refs A still works, so it doesn't deadlock. Refusing at decide would spare a decision no act can carry out in full.

Could not check: a live multi-repo fleet where the supervisor's local ticket/<id> could lag origin/ticket/<id> (ticketDraftRef prefers local). On this box workers share the repo's refs, so I judged it fine by reading.

Opened by the box operator.

Verdict: APPROVE 456aefb

@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

PR #978 review p: quality.md §6 still says uncited TL;DR bullets never block and pre-rule plans aren't marked down; approve-plan now refuses both

  • Reviewer: operator-review-p (fresh subagent, claude-opus-5-5), not the author
  • Head: 456aefb
  • Date: 2026-12-05T13:40Z

What I ran vs only read

Read: the PR body, git diff origin/main...HEAD (engine, schema, worker.md, supervisor.md, operator.md, tests, G1 golden), the code the diff calls (recordsRepo, factsRepo, tableCells, ruleKey, checkTicket's approval check, every reader of approve-spec/plan acts, cmdAct's door and TL;DR checks), docs/devteam/dashboard/index.html (approve acts are only displayed: no approve button), constitution.md (table row "Approving … a ticket's spec and plan: supervisor") and quality.md §1, §3 and §6.

Ran (scratch clone, hub env pointed away, through testslot):

  • test/pre-review-selfcheck.test.mjs at head: pass, 1 file ok (485 s).
  • My own probe of the angle the PR doesn't test (every existing multi-repo test now passes --no-selfcheck): (1) a records-in-home console ticket, the worker running selfcheck spec from its code worktree in the link and from home's records worktree, then a plain act --class approve-spec; (2) a link ticket with records in the link, same flow. Both pass: the check reads the right branch in both layouts and the supervisor's act accepts it.
  • Mutations (source restored with git checkout after each; git status clean):
Mutant Test Result
noNote: the review-request stderr note removed A5 red
noOneOf: schemaErrors' oneOf check disabled A9 red
workerAlways: approval-unchecked raised with no worker phase lines A8 red (the owner's draft becomes a finding)
dayOnly: a day-only review date orders checks like a timed one A6 red
recent7: approval-unchecked drops its 7-day window A8 green (survives)
six draft-check mutants together: empty fails when accepted; a task with no Files: accepted; a plan with no ### Task N accepted; an empty Refusals and edges accepted; a Today section with no table row accepted; an acceptance table with no rows accepted A1, A2 all green (none tested)
  • CI at the head: test success, test-stress success, box-image success.

Findings

Id Severity Rule Where Finding
P1 Important quality.md §6 (TL;DR citations: "a missing citation, or one in another form ((T3), …), is Minor, and a plan drafted before this rule isn't marked down for lacking them"); quality.md §3 Severity (Minor does not block); constitution.md row "A rule, gate or review standard; anything in governance/" docs/devteam/governance/quality.md §6 (unchanged) vs selfCheckDraft tldr-cites-tasks + cmdAct selfCheckGap contradicts: the engine now refuses approve-plan for any plan with a top-level TL;DR bullet that has no citation or uses another form ((T3)). It also refuses plans with no Files:/Model: line or no ### Task N headings, until the worker reshapes them. quality.md §6, the governance text on exactly this rule, still says such a citation gap is Minor and that pre-rule plans aren't marked down. That is the rollout population the PR expects to hit (88% of approved plans fail the check). The PR changes worker.md to say so ("is Minor in the review. selfcheck plan still fails…"), but it leaves the governance rule saying the opposite. It doesn't say it is overriding §6's grandfather clause. A supervisor or reviewer reading quality.md (the review standard) is told the gap never blocks, and the engine blocks the approval. quality.md §6 already documents the tldrGap refusal beside this rule, so the fix belongs there too: one sentence saying act --class approve-plan also waits for a passing selfcheck plan, which needs every top-level bullet cited as (Task N…) or (no task: …). Restate or drop the "drafted before this rule" clause, and pin the sentence in A7. Review g raised it as Minor. I rate it Important because the contradiction is in a governance doc and lands on mid-flight plans.

Notes

Minor

  • Coverage: the six draft-check mutants above all survive A1/A2. The missing-Files: case is one of them: A2 tests only a missing Model: line, though the PR lists both. One commit and one assertion each would hold them.
  • Coverage and docs: the 7-day window on approval-unchecked survives (recent7). supervisor.md step 8 describes the finding without "in the last 7 days".
  • selfcheck plan fails real, valid plans on form alone. Examples: a TL;DR bullet hard-wrapped onto a continuation line (only the first line is read for the citation), a citation followed by ;, and a table without a leading |. Review g noted the first. Each refusal names the fix, so a worker can reshape and send again.
  • Rollout, as the caller asked (mid-flow drafts already reviewed): the PR discloses it, but no guidance covers a draft whose spec or plan review already says APPROVE before the release. Reshaping the plan (headings, Files:) changes it after its review, so "the verdict holds" (supervisor.md step 8) no longer does, and a review round follows. The alternative is --no-selfcheck "reviewed before the self-check", which raises approval-unchecked, and that finding's fix text points back to re-checking. Nothing jams: either way works. A sentence in supervisor.md on which one to use for pre-release drafts would save the supervisors a guess.
  • approve-spec now reads the records repo, which it never did before, so it fails on a link this machine can't read. --no-selfcheck gets past it.
  • Dead code: WORK_PHASES/workStageOf (also review o M4).

Checked and fine: no kit flow logs an approve act except act (merge, chain, recurring landing, dashboard and answer don't). check-ticket and merge are unchanged, so nothing already approved is re-checked and no merge jams. Authority: the supervisor's approval is narrowed by a worker-side mechanical precondition, with a logged, counted override. Nothing widens for the worker, the supervisor or the operator, and no owner-only rule loosens. ruleKey caps rule names at 40 characters, so the schema's 80-character item limits hold. oneOf is used only by the new act field, and review result schemas still refuse it.

Earlier reviews: I agree each Important is resolved at this head:

  • f F1 (escaped pipe): tableCells, A1.
  • g F1 (phase-keyed gate): the send gate is gone and the act reads no phase, A5.
  • i F1/F2: each stage on its own check, and a re-scoped spec gets a fresh check, A5.
  • k F1: the one-ticket rule. k F2: the approvals counts and approval-unchecked, A8, with my workerAlways red.
  • m F1: a door ticket second in refs is refused, A5.
  • n F1: approvedBy reads the first ref of a new act, A5.

Review o's M1–M5 still stand as Minor/Suggestion. M4 is confirmed above.

Not checked: the full suites the PR lists (components, split-dist-docs, kit.validate, world-contract). CI at this head is green on them.

Opened by the box operator.

Verdict: CHANGES 456aefb

…elfcheck

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review p)

P1: quality.md §6, beside the tldrGap refusal, now says approve-plan also
waits for a passing selfcheck plan, which fails an uncited or (T3)-style
top-level bullet, a citation of a missing task, and a task with no Files:
or Model: line. The "drafted before this rule" clause now holds for the
review only; at the approval a pre-check plan is reshaped or approved with
a logged --no-selfcheck. A7 pins both; spec-sections follows the reworded
clause.

Minors: supervisor.md step 8 names approval-unchecked's 7-day window, says
how to treat drafts reviewed before the self-check shipped, and reads
"approve-plan also refuses" for "the latter"; WORK_PHASES/workStageOf
removed (dead); A2 covers a task with no Files: line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hhff

hhff commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Review p fixes, at 8e91cac (merged origin/main first, at d63013b, no conflicts)

  • P1 (quality.md §6 disagreed with the engine): quality.md §6 is governance, so this PR now needs the owner's yes.
    • Beside the tldrGap refusal, it now says: "act --class approve-plan also waits for a passing selfcheck plan on the committed plan (worker.md §4), which fails a top-level TL;DR bullet with no (Task N…) or (no task: …) citation (so (T3) fails it), a citation of a task the plan doesn't have, and a task with no Files: or Model: line."
    • The "drafted before" clause is restated: such a citation "is Minor in the review, and a plan drafted before this rule isn't marked down there for lacking them; at the approval, a plan drafted before the self-check is reshaped until selfcheck plan passes, or approved with act … --no-selfcheck "<why>", which the act logs and metrics counts."
    • A7 pins both sentences. spec-sections' pin follows the reworded clause.
    • quality.md isn't patched by the split overlay, so no patch or hash changes were needed. split-dist-docs passes.
    • Mutant quality-old (quality.md as on main) turns A7 red.
  • supervisor.md step 8:
    • It names the finding's window: "when such an approval in the last 7 days skipped the check …".
    • It covers drafts reviewed before the release: reshape until the check passes (a reshaped plan goes back to its review, since the verdict no longer holds), or approve with --no-selfcheck "reviewed before the self-check" and ack the finding as such.
    • Review o's M2: "the latter" now reads "approve-plan also refuses while …".
    • A7 pins all three.
  • Dead code: WORK_PHASES/workStageOf removed.
  • Optional: A2 now covers a task with no Files: line. Mutant no-files turns A2 red. The other draft checks you listed are left as they were.
  • Local runs (testslot, one file at a time, hub port pointed away, DEVTEAM_BOX=off): pre-review-selfcheck 9/9, spec-sections, split-dist-docs and components pass. The mutant run was restored and checked with cmp.
  • PR body updated.

Opened by the box operator.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant