Skip to content

Stop /ship asking owners to approve its own review bookkeeping - #4449

Closed
garrytan wants to merge 9 commits into
mainfrom
capy/ship-bookkeeping-grants
Closed

garrytan wants to merge 9 commits into
mainfrom
capy/ship-bookkeeping-grants

Conversation

@garrytan

@garrytan garrytan commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

/ship no longer stops for an owner's approval in three cases where the stop came from its own bookkeeping: an approved extra review round now buys that round, a base merge that only changes base-side text is no longer a behavior change, and a reviewer's "nothing blocks" reply no longer turns into Critical findings.
Each of these cost a stopped run plus an owner ruling or a new PR (gstack#4272, #4383, #4431); every shortcut keeps a test showing a real change still stops.
Nothing for readers to do.

Round grants at the review cap (GST-2968)
  • A run that starts past the two-round cap (the read-only final review) is now marked read_only in the PR body's runs block by gstack-ship-receipt stub.
  • When a round grant applies at the head, gstack-ship-receipt history leaves those read-only passes out of --prior-full, so the grant buys the round the PR_ROUND_CAP stop names. Before, the read-only pass already counted as that round, so the next run was read-only again (gstack#4272: two grants bought nothing).
  • The granted round keeps its fix round (its pass 2); nothing past it plans. A spent grant routes read-only again.
  • A grant now applies across a base merge that leaves the PR's own added and removed lines byte-identical, in either direction, since preflight merges the base before the review (ghome#17: grant at 28b7968, reviewed e9ee170). A head that changes those lines needs a new grant.
  • lib/review-depth.ts is repinned with a deterministic no-loss replay (test/fixtures/review-pins/replays/GST-2968.json): over 21,233,664 cases, the only step changes are 23,040 granted-round stops that now get their fix pass; no review step is removed.
Base-side text after a base merge (GST-2975)
  • Path comparison now reads all four sides with the shared-preamble hash ids masked (both generated forms), so a main merge that only moved those ids in regenerated skill files is a base merge (Ask each question once and check every handed-over file, in every skill that loads the shared preamble (GST-2756) #4383).
  • A line that is the base's new line plus exactly the tokens the branch added to the reviewed line (both sides appended to one expected-value list, ghome#16) is base context, so finish sends it to the one scoped reader instead of stopping for an owner grant. Test paths whose own lines are unchanged are no longer gate-scanned on the base's edits.
  • Negative controls: a resolution that drops, invents or rewrites anything on the branch's own lines still stops as a behavior change.
Reviewer replies that say nothing blocks (GST-2972)
  • A file:line in a reviewer's prose no longer anchors a finding. Before, prose that confirmed code ("a High or Critical challenge… autoplan-revise.ts:103") became an anchored Critical that only an owner could clear (Keep reviewer product challenges open on the approval page #4431, twice).
  • A reply that says NO FINDINGS collects only structured finding lines: JSON, a lead severity label, a label heading, a numbered finding heading, a Severity or Blocks: yes field, or the native voice's FIXABLE/INVESTIGATE tag.
  • A reply whose valid REVIEW_VERDICT says blocking=0 still collects its prose rows, because a verdict line lowers nothing by itself (the existing negative controls in test/review-verdict.test.ts). Such a row is now a summary candidate the lead can lower with a reason, instead of an owner stop.
  • The test replays both real Keep reviewer product challenges open on the approval page #4431 replies; a structured Critical in a blocking=0 or NO FINDINGS reply still collects as anchored and still disagrees with the verdict.
Agent notes
  • Commits: d104e87 (GST-2968), 23b3073 (GST-2975), 3c2d982 and 18b6262 (GST-2972), 1ad188a (pre-landing review fixes for 3 blockers), 22bb3c1 (changelog fragment), 0a9459e (review-policy correction from the docs audit).
  • Local runs: two tests fail with a 5 s timeout on this machine (review-plan-targeted-delta "the Feature Request: Full Code Base Audit vs Documentation #225 shape", review-dispatch "edited to look refused") and the same way with the branch's lib and bin changes stashed, so they are machine speed, not this change. Seven local preflight/re-review test failures also occur at the untouched 18b6262 (environment). CI is the full run.
  • Known gap: a read-only run that finishes with a receipt (no stop) is not marked read_only, so a grant at a later head still counts it.

REVIEW_LOOP: passes=2 blocking_found=3 deferred=0 noted=6 fixed=3 scope=frozen dispatches=8
Gate edits: none detected (7 listed, 2 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Refs GST-2968 GST-2975 GST-2972

What changed

A file and line in a reviewer's 'nothing blocks' prose no longer becomes a Critical finding (GST-2972)

A file and line in a reviewer's "nothing blocks" prose no longer becomes a Critical finding (GST-2972).

Before/after as text: A file and line in a reviewer's 'nothing blocks' prose no longer becomes a Critical finding (GST-2972)
--- Before · before.txt · captured output
+++ After · after.txt · captured output
    real blockers named in an exception clause ("No CRITICAL issues except the token leak in log.ts:3"); GSTA-167
    reverted that. A reply that says `NO FINDINGS` keeps only its structured findings (GST-2122). Those are JSON objects
    (malformed JSON included), lead labels, label headings, numbered finding headings, `Severity` fields, `Blocks: yes`,
+   the native voice's FIXABLE or INVESTIGATE tag, which still collect at their label. A file:line in its prose is the
+   reader confirming code, not a finding, so it no longer anchors one (GST-2972). Its other prose collects nothing. Outside such a reply prose collects as described above. A denial that a change
-   the native voice's FIXABLE or INVESTIGATE tag, and anything naming a file:line, which still collect at their label.
-   Its other prose collects nothing. Outside such a reply prose collects as described above. A denial that a change
 

Extra review rounds an owner approves (GST-2968). Owners hit "two grants bought nothing" (gstack#4272): a read-only final review already counted as the round a grant was meant to buy, so the next run was read-only again. A run that starts past the two-round cap is now marked read_only in the PR's run record, history leaves those passes out when a grant applies, and the granted round keeps its fix pass. A grant also survives a base merge that leaves the PR's own added and removed lines byte-identical (ghome#17). lib/review-depth.ts is repinned with a no-loss replay over 21,233,664 cases: the only step changes are 23,040 granted-round stops that now get their fix pass.

Base-side text after a base merge (GST-2975). A main merge that only moved shared-preamble hash ids in regenerated skill files read as a behavior change (#4383), and so did a line that was the base's new line plus exactly the tokens the branch added (ghome#16). Both now count as base context and go to the one scoped reader instead of an owner stop. A resolution that drops, invents or rewrites anything on the branch's own lines still stops.

Reviewer replies that say nothing blocks (GST-2972). A file:line in a reviewer's prose confirming code became an anchored Critical only an owner could clear (#4431, twice). A NO FINDINGS reply now collects only structured finding lines, and a blocking=0 reply's prose rows stay lowerable with a reason. A structured Critical in either reply still collects and still blocks.

Why

"Two grants bought nothing" (gstack#4272), and two more runs stopped for an owner on text the branch never wrote (#4383, #4431). Owners now rule only on real changes; bookkeeping no longer asks them for anything.

Blast radius

This touches the round count /ship's run history feeds into the review plan, finish's base-merge comparison, and the review collector every reader's reply goes through. Each shortcut has a negative control that a real change still stops (test/pr-round-cli.test.ts, test/ship-base-side-masks.test.ts, test/review-ledger-quiet-reply.test.ts, test/review-verdict.test.ts), and the full free suite passed in CI run 44123166003 at this tree (script ran).

Pre-Landing Review

Two review passes. Pass 1 found 3 blockers, all fixed in 1ad188a with tests:

  • lib/ship-patch.ts:171: a regenerated file whose only change was the shared-preamble id still compared as changed after masking, so finish stopped on the Ask each question once and check every handed-over file, in every skill that loads the shared preamble (GST-2756) #4383 shape this PR targets.
  • bin/gstack-ship-receipt:1096: a granted run's stub recomputed read-only at its current head, so after the fix commit the granted passes were marked read-only and a later grant would subtract them.
  • lib/pr-review-history.ts:62: recording the finished run dropped its read-only mark, so a later read-only stop plus grant still routed read-only (QA reproduced it before the fix and passed after).

Pass 2 on the fixed tree found no blockers. The money-path targeted reader returned NO FINDINGS on both passes, and one more read of the final head (asked for because the docs and changelog edits after review carry numbers) found one informational note, listed below.

Second-model review: ran in pass 1 and raised 2 of the 3 blockers above; pass 2 ran the specialist, red-team and targeted readers.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL lib/ship-patch.ts:209 splicedHunk compares the inserted token sequence, not its position, so a resolution that moves the branch's token counts as context (still goes to the scoped reader).
  • INFORMATIONAL lib/review-ledger.ts:344 A NO FINDINGS reply's unstructured prose with a file:line now collects nothing (the intended GST-2972 trade-off).
  • INFORMATIONAL lib/review-round-grant.ts:60 ownLinesSame uses a -U0 patch-id, so relocated but byte-identical own lines on an ancestor/descendant head inherit the grant.
  • INFORMATIONAL lib/ship-patch.ts:130 sideDiffs runs up to four git cat-file calls per compared path even when no side has a preamble id.
  • INFORMATIONAL bin/gstack-ship-receipt:1085 The stub's new at-or-before grant fallback has only a positive test; no test checks a non-ancestor grant or another PR's grant leaves the stub read_only.
  • INFORMATIONAL bin/gstack-ship-receipt:1085 The stub's at-or-before grant fallback can disagree with the run's plan when a run starts at a descendant of an unused grant's head: the stub stays unmarked, so a later grant at a new stop may not buy its round (conservative: no extra round).
  • INFORMATIONAL bin/gstack-ship-receipt:1101 When a grant is recorded on a merge head that was never pushed and preflight re-merges the base as a sibling, the run's stub finds no grant and marks the granted run read_only, so a later grant could buy one extra round; the stub and the plan should read the same grant.
Exploratory QA

Report-only CLI and library smoke, synthetic PR bodies, no network or GitHub writes.

  • Pass 2 (head 1ad188a): 3 of 3 contracts pass: history counts a read-only stub; a read-only run keeps its mark after the finished run is recorded; a NO FINDINGS reply collects no prose rows and still collects a structured Critical. No findings.
  • Pass 1: the finished-run contract failed before the fix (blocker 3 above) and passed after it; one early capture ran the installed main binary instead of this branch, so it is inconclusive and was superseded, not rerun.
  • Not probed: a real grant across a base merge (covered by test/pr-round-cli.test.ts).
Design Review

No frontend files changed — design review skipped.

Eval Results

No evals ran: the finish route selected no behavior evals (behavior=0, bounded=1) for this change.

Review bot comments

No review bot comments.

Verification Results

3 PASS, 0 FAIL, 0 BLOCKED, 0 NOT RUN (pass 2 QA contracts); one pass 1 capture inconclusive and superseded, never counted as a pass.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated: one factual correction, no blockers.

Scope: base b79843c..22bb3c1 on capy/ship-bookkeeping-grants (6 commits, 19 files, no staged/unstaged/new files): round-grant bookkeeping (GST-2968), base-side merge masking (GST-2975), NO FINDINGS collector (GST-2972). Audited docs/review-policy.md, docs/troubleshooting.md, docs/ship-policy.md, docs/unattended.md and the changelog fragment against the changed lib/ and bin/ sources.

Documentation health:

  • docs/review-policy.md: Updated. The NO FINDINGS rule and the verdict-line table no longer count a file:line in prose as an anchored finding (GST-2972).
  • docs/troubleshooting.md: Current (round-grant text already updated on the branch).
  • docs/ship-policy.md: Current, with debt (see below).
  • docs/unattended.md: Current.

Coverage debt:

  • GST-2975 masking of shared-preamble ids and spliced expected-value lines (routed to the one scoped reader) is documented only in the changelog fragment, with no policy-doc coverage.
  • docs/ship-policy.md carry table row (~2116, "the branch's +/- lines identical") may not mention spliced hunks if carry uses the same comparison; not verified.
  • The new history/stub --base flag and RUN_STUB ... read_only=1 appear only in CLI help and docs/review-policy.md.
Tests
  • bun test test/pr-round-cli.test.ts test/review-ledger-quiet-reply.test.ts test/review-plan-pr-rounds.test.ts test/ship-base-side-masks.test.ts: 28 tests ran, all pass (finish's targeted check).
  • Full free suite in CI, free-tests run 44123166003 at tree 1891457e027b: green, 37,511 tests.
  • Windows smoke, run 44121086190: green.
Approvals

No approvals recorded for branch capy/ship-bookkeeping-grants.
Plan: exempt: bug fix
Plan check: exempt bug fix

🤖 Generated with Claude Code

Agent notes
{
  "schema_version": 1,
  "pr": 4449,
  "head": "0a9459e728957bae81aacb2473117543f918189c",
  "version": "1.100.0.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 28,
      "fail": 0,
      "skip": 0
    },
    "test": {
      "pass": 1683,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44123166003,
      "attempt": 1,
      "tree": "1891457e027ba81d3e6cb8c5d69ac4b52a5218cc"
    }
  ],
  "session_kind": "unattended",
  "run": "ship4449",
  "head_tree": "1891457e027ba81d3e6cb8c5d69ac4b52a5218cc",
  "product_patch_id": "2a54f784e1544a261db9518927707612ebe252c2",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 283,
    "rules": "66e5174161eecc2c",
    "base": "e0c4136dc2999840720091ee772666127099e13d",
    "registry": "e0c4136dc2999840720091ee772666127099e13d",
    "gate_scan": {
      "tagged": 0,
      "head": "0a9459e728957bae81aacb2473117543f918189c"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "risk:security",
      "runtime=283"
    ],
    "risk": [
      "money",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @1891457e027b (8 checks, current for 0a9459e72895)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44123166003/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44121086190/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=1891457e027b tests=37511 skipped=89 runs=44123166003/1 profiles=ci-reuse/free-tests heads=0a9459e72895 verified=2026-11-17T16:22:55.633Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "README.md, AGENTS.md, CLAUDE.md and docs/ (review-policy, troubleshooting, ship-policy, unattended read against the changed lib/ and bin/ sources)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 6,
    "fixed": 3,
    "scope": "frozen",
    "rounds": 2,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "2a54f784e1544a261db9518927707612ebe252c2",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}
{"head":"2bf013420af73a23f68c54c98d9207e98638d7fa","run":"ship4449b","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":2,"fixed":0,"scope":"frozen","rounds":1,"dispatches":{"specialist":3}}}
{"head":"5fde1e685493ca12730e488fbf2e8c1d6d792c1a","run":"ship4449c","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":3,"fixed":0,"scope":"frozen","rounds":1,"est_input_tokens":52734,"dispatches":{"specialist-batched":1,"red-team":1}},"read_only":true}

garrytan and others added 3 commits November 17, 2026 14:55
A read-only final review at the round cap counted as the round a later grant would add, so the grant never opened a fix round. Runs that start past the cap are now marked read-only, a grant leaves those passes out of the count, the granted round keeps its fix round, and a grant still applies across a base merge that leaves the PR's own lines byte-identical.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…(GST-2975)

finish now compares regenerated skill files with the shared-preamble hash ids masked, and treats a line that is the base's new line plus exactly the tokens the branch added as base context for the scoped reader. A resolution that drops, invents or rewrites the branch's own lines still stops.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s (GST-2972)

A reviewer reply whose verdict says blocking=0 or NO FINDINGS no longer turns its confirmation prose into Critical findings. Structured blockers in such a reply still collect and still disagree with the verdict.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 17, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

garrytan and others added 6 commits November 17, 2026 15:09
…em (GST-2972)

Dropping every unstructured row under REVIEW_VERDICT blocking=0 broke the ruling that a valid verdict line lowers nothing by itself (test/review-verdict.test.ts negative controls). Only a NO FINDINGS reply now drops unstructured rows; a file:line in prose no longer anchors a row, so a blocking=0 reply's prose Critical becomes a summary candidate the lead may lower.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Keep a run's read-only mark through its receipt write and its fix commits, and treat a generated file whose only change is the shared-preamble id as unchanged after a base merge.

Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t as a finding

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nding the lead can lower (GST-2972)

Dropping such prose let a reply that said NO FINDINGS and then named a token leak at log.ts:3 pass with no finding (found by the cross-family trail read on #4449; main blocked it). The prose now collects again, but neither a file:line nor a list item anchors it there, so under a blocking=0 verdict it is a summary candidate that blocks until the lead lowers it with a reason.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… FIXABLE prose lowerable in NO FINDINGS replies (GST-2968)

The read-only final review of #4449 found that the grant check compared zero-context patch-ids, which ignore where a hunk sits, so moving the PR's own audit() call into another function kept a grant. Each own hunk's place is now compared too, carried through the base's own changes, so a pure base merge still keeps the grant and a base edit right next to the PR's lines needs a new one. In a reply that says NO FINDINGS, the native voice's FIXABLE tag no longer anchors a prose row, so under blocking=0 it stays a finding the lead can lower, as on main.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai

capy-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Parked at 5fde1e6. The last read-only review of this head found one blocking issue in the review-grant bookkeeping: at bin/gstack-ship-receipt:1085 and :1100, stub lets a grant from an earlier head apply to every later run, so a run at a changed head isn't marked read-only, and a fresh grant there reports it was already spent. The fix the second-model review suggests is to tie that fallback to the run that actually started with the grant. CI is green at this head. This PR waits for a maintainer decision before it ships.

@capy-ai

capy-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Closing without merging. The confirmation-prose fix (GST-2972) and the base-side masking fix (GST-2975) are being rebuilt in a separate PR without the round-grant code. The round-grant fix (GST-2968) is on hold until grants and rulings are redesigned together. This branch is kept at 5fde1e6 for reference.

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