Skip to content

A granted fix round now ends with one full review of the final head, and fixed findings close only on a finished review (GST-3260) - #4696

Closed
garrytan wants to merge 24 commits into
mainfrom
fixed-findings-close-only-on-a-finished-review
Closed

garrytan wants to merge 24 commits into
mainfrom
fixed-findings-close-only-on-a-finished-review

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

After a granted fix round changes code, /ship now runs one read-only full review of the final head, and a fix commit's trailer closes its finding only after a full review that finished with the fix in range.
Why: a scoped re-check of only what changed never stands in for a PR's last full review, and three closure paths could close a finding too easily.
Nothing to do. This PR is stacked on #4664 and lands after it.

What changed
  • Final full review after a granted fix round. gstack-review-plan used to stop after a granted follow-up check ("never a new full review"). When that check reads the fix clean and the fix changed runtime code, the plan is now one read-only full review of the final head: no fix round, and a blocker stops the run for the PR's owner to decide (PR_ROUND_CAP). A fix that only touches docs or tests still finishes after the check. The /ship step that runs the check asks the plan again afterwards.
  • Trailer closures need a finished review. A Review-Finding: trailer closes its finding only after a full review that converged, is bound to its committed tree and has the fix commit inside its range. Before, a completed pass that had made its own fixes, or whose range began after the fix, could close it.
  • Security findings never close by location. A security finding known only by its raw path:line:category fingerprint never closes by grant or trailer, so its location can't reach the PR body.
  • A missing reviewer record closes nothing. A granted check whose record of what its reader raised can't be read no longer passes the check that it dealt with every finding.
  • Fix lists with markup. A fix list that writes an id as **p1/x#1** or [p1/x#1] now names that id, so the granted check can close it.
  • New files in the check's diff. The follow-up check's diff now includes files the fix created but hasn't committed (git add -N, then git diff). With no new files, the diff is byte-identical to before.
Tests and replay

Every new case fails on #4664's head first.

  • test/fix-check-clearing.test.ts: trailer closure refused for a pass that didn't converge or whose range starts at the fix; a security fingerprint closes nothing, while a plain fingerprint still closes; a missing reviewer record closes nothing; bracketed and bolded fix-list ids.
  • test/fix-check-hunks-untracked.test.ts: the documented hunks command includes a new untracked file and is byte-identical when there is none.
  • test/round-cap-granted-stop.test.ts and test/r51-final-review-replay.test.ts: the new plan through the CLI, and the preregistered no-loss replay (docs/evals/r51-final-review-after-grant-prereg.md). The replay compares main's planner with this one on 2,596 recorded test histories and 1,658,880 grid histories. Every step main plans still runs; the only addition is one read-only full review after a clean granted check that changed runtime lines; no fix round or check is added. It's deterministic and makes no model calls.
Agent notes
{"head":"ef58d375717997e2bb30d163ded119bfbd0ba4fa","run":"ship-4696b","mark":"stop","tree":"d1b1b338d17ec36eb18484226e2f6463eb9ff127","at":"2026-11-22T10:15:21.088Z"}
{"head":"ef58d375717997e2bb30d163ded119bfbd0ba4fa","run":"ship-4696b","mark":"grant","grant":"a-5a39bc5f25d0","at":"2026-11-22T10:25:56.708Z"}
{"head":"e3a087bd1671a6659f66a7af646ecad6f6ab26e1","run":"ship-4696b","mark":"stop","tree":"c2e700e5158d469aa9231c0cf6ac5a3b80c2ef13","at":"2026-11-22T10:28:40.338Z"}
{"head":"e3a087bd1671a6659f66a7af646ecad6f6ab26e1","run":"ship-4696b","mark":"abandoned","by":"GSTA-36","reason":"Captain GSTA-36 granted an extra-round read-only final review; it runs in ship-4696c"}
{"head":"e3a087bd1671a6659f66a7af646ecad6f6ab26e1","run":"ship-4696c","mark":"stop","tree":"c2e700e5158d469aa9231c0cf6ac5a3b80c2ef13","at":"2026-11-22T11:51:43.229Z"}

Open in Capy

garrytan and others added 21 commits November 22, 2026 00:39
…nd a live run past two hours stays open (GST-3260)

The bare run marker becomes a run record whose state only gstack commands change; gstack-ship-run status and abandon end a run that stopped working. Stops bind to the head their last reading row read (#4591), and a reused run id counts once per head (gstack-evals#406).

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

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

gstack-review-log stamps a granted fix-check row from the run record's claim (the stop head it read from, the run, the grant and the PR) and records the digest of the hunks its reader was given. lib/fix-check-clearing.ts is the one owner of when such a row counts: finish counts it anchored on the stop its grant names rather than the newest reviewed tree (#4612), and receipt write closes exactly the open findings the grant names, recording cleared_by_grant and one Agent notes line, or says why on a FIX_CHECK_CLEAR line. Stop and claim entries in the PR body now carry when they were recorded. The review plan routes a fix-check grant that answers a stop raised after a fix-check to its one fix-check (harness-evals#504). Reviewer prompts and packets are unchanged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…later full review reads it clean (GST-3260, #4597)

A later full review that read the fix commit but left the finding out of its row could not close it, because review-log rows are never rewritten, so the receipt needed an owner ruling. Receipt write now closes an open blocker when a branch commit carries its trailer (its exact ledger id, or a fingerprint no other open blocker shares) and a later complete full review, bound to its committed tree and holding that commit, reports nothing open at that id or line. The receipt records cleared_by_trailer and the Agent notes section gets one line per closed finding. Gate findings never close this way.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nder a token cap refreshes the run's heartbeat (GST-3260)

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/specialist-batched#2 reader=testing
Review-Finding: p1/specialist-batched#3 reader=state-machines
Review-Finding: p1/specialist-batched#4 reader=state-machines
Review-Finding: lib/ship-run-record.ts:167:correctness reader=core
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ound (GST-3260)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…r a /ship run is open (GST-3260)

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

gstack-review-log and gstack-ship-receipt now load nothing beyond lib/ unless
there is a finding to close: the fix-check hunks record moves into
lib/review-evidence.ts, and receipt write loads the clearing module only when
a blocker is open. The planner routes a still-unspent fix-check grant through
its existing granted-stop route, so lib/review-depth.ts keeps PR 1's bytes.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… whole fix it read, and a trailer closes only after a fully clean later review (GST-3260)

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Base-only: PR 1's final head c4a6af1 merged first, then main with c4a6af1 as the merge base; this PR's own added and removed lines are byte-identical to the reviewed head 79a0671.
…reviewer's relayed grant, which the one-self-grant rule now requires (GST-3260)

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…er fix can also clear an open blocker (GST-3260)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ed with the fix in range (GST-3260)

Fixes the three open notes from the cross-family trail read of #4664, as GStack Minder ruled: the trailer route now needs a converged, verified full review whose range holds the fix; a raw security fingerprint never closes by grant or trailer, so its location cannot reach the PR body; and a fix-check row whose dispatch ledger cannot be read closes nothing. Each has a test that fails on #4664 at ac9163d.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…its granted check can close it (GST-3260)

fixListNames split on whitespace, quotes and parentheses only, so **p1/x#1** and [p1/x#1] kept their markup and never matched a grant id. It now strips leading [ and * and trailing ] and * from each token, keeping brackets inside a path such as app/[id]/page.tsx. Fixes the #4664 note p2/outside-voice#1.

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

Decision 3.5 wrote the touched hunks as git diff $PASS_HEAD, which leaves out an untracked file the fix created. The clearing code then refused the closure, so it failed closed, but the reader never saw the new file. The instruction now runs git add -N on each file the fix created first; with no untracked file the bytes are unchanged. Fixes the #4664 note p2/red-team#1. The ship/sections/review-army.md pin moves in the replay commit, after its preregistered no-loss replay (docs/evals/r51-final-review-after-grant-prereg.md) passes.

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

Written before the planner change and before the replay test exists: the question, corpus (main's planner at blob 47ac26b, the recorded test histories, an exhaustive grid and nine real shapes), the pass rule (every old step still runs; the only added step is at most one read-only full review after a granted fix-check that changed runtime lines) and the decision each outcome changes.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…l review of its final head (GST-3260)

R51: a re-check that reads only what changed never stands in for the PR's final full review. After a clean granted fix-check (the --stop fix-check grant route and the owner's round-2 --grant route) whose range changed runtime lines, nextStep now plans one read-only full review; after it, no blocker is done with its notes and a blocker stops with PR_ROUND_CAP for the lane's Captain, never another fix round or fix-check. A docs-and-tests fix range stays done. gstack-review-plan derives the new History field grantFixChecked from the review log (a fix-check row the grant spent, then a completed full review row), and /ship's decision 3.5 asks the plan again after a granted fix-check. The lib/review-depth.ts and ship/sections/review-army.md pins move in the replay commit, after the preregistered no-loss replay passes.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t, no step lost (GST-3260)

test/r51-final-review-replay.test.ts runs the preregistered no-loss replay (docs/evals/r51-final-review-after-grant-prereg.md) with no model calls: main's lib/review-depth.ts (blob 47ac26b) against this branch over 2,596 recorded test histories, a 1,658,880-history grid and ten real shapes, plus the decision 3.5 packet replay. All pass: without the new field every history plans as on main; with it the only added step is one read-only full review after a granted fix-check that changed runtime lines, never a fix-check. Repins lib/review-depth.ts and ship/sections/review-army.md under replay GST-3260 and records the result in the preregistration.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…only-on-a-finished-review

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

# Conflicts:
#	bin/gstack-review-plan
#	docs/review-policy.md
#	lib/fix-check-clearing.ts
#	lib/review-evidence.ts
#	test/fix-check-clearing.test.ts
@capy-ai
capy-ai Bot changed the base branch from confirmed-fix-round-closes-its-findings to main November 22, 2026 09:41
@trunk-io

trunk-io Bot commented Nov 22, 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 3 commits November 22, 2026 09:46
… plan instead of skipping the final review (GST-3260)

After a spent grant, a fix range that cannot be read (uncommitted or untracked edits) now stops and asks for the fix to be committed, rather than reading as docs only and skipping the R51 final review. A failed review-log read on either grant route now refuses to plan, as the in-loop route already did. The untracked-files hunks test now checks the paths and digest the clearing code compares.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: test/fix-check-hunks-untracked.test.ts:1:testing reader=core
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…check step (GST-3260)

Decision 3.5 used to send every plan answer except a full review to decision 4, so the new stop for an unreadable fix range could be read as converged and skip the final review. Now an unreadable range means commit the fix and ask again, and any other stop is decision 2.

Review-Finding: p2/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Closing this, as the owner ruled. The fixes that are live on main (closing a finding by a fix commit's trailer, keeping security findings out of the PR body, and the missing findings record) moved to #4700, along with the two gaps this PR's last review found in them. The routing of the final full review after a granted fix round waits for a design pass. The branch stays.

@capy-ai capy-ai Bot closed this Nov 22, 2026
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