v1.99.5.0 Give the head a pull request merges a full review when its removed lines changed or it was only re-checked (GST-2706) (#4365)

* Count review rounds per pull request across /ship runs (GST-2673)

/ship's two-round review cap was counted inside each run, so a pull request
shipped many times was reviewed again at every head. Step 1 now reads the
rounds the PR body's receipt history records, passes them to the review plan,
and sends later heads to the scoped re-check, with a lane or Captain round
grant for an extra round. Adds the no-loss replay preregistration.

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

* Cap full review rounds per pull request and keep fix-checks to each run

The plan counts a PR's earlier full rounds (--prior-full) against the cap of
two, as the approved plan says, and prints every earlier round as pr_rounds=.
Renames the troubleshooting anchor to pr-round-cap, lists <SESSION_ID> as a
reviewed placeholder, and leaves ship/DRIVER.md at its size cap.

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

* Point the ship driver's review pass at Step 9's plan flags, which carry the PR round count

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

* Give a pull request's final head a full review and make the diff-only re-check advice only (GST-2673)

A scoped re-check that reads only what changed since the last reviewed head
caught 22 of 24 planted faults but none of 8 real faults that full rounds had
caught, so it no longer carries a /ship receipt. A later head whose own lines
changed now gets a fresh full review, the PR's last before merge; a PR already
at two full rounds gets one read-only full review with no fix round, whose
blocker goes to the lane's Captain. carry prints RECHECK: advisory and refuses
--recheck. The drift threshold, the re-check blocker count and the
design-change grant kind are removed with the route they fed.

Repins lib/review-depth.ts and ship/sections/review-army.md under replay
GST-2673 (docs/evals/pr-round-count-results.md; deterministic grid against
main: 196,608 of 196,608 plans identical with no prior rounds).

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

* Keep a review round grant usable through its fix round and after a read-only review

A grant now holds after the fix round's commits move HEAD past it, counts only the rounds earlier heads spent, and a receipt written without a run keeps other runs' stubs.

Review-Finding: p1/specialist-batched#1 reader=state-machines
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/red-team#3 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Count every review round at a granted head again, so a grant can't reset the count

Reverts the history change that skipped rounds recorded at a round grant's head: the run that hit the cap is recorded at that same head, so skipping it wiped the count. A grant recorded after a read-only review still doesn't buy a fix round (fails closed).

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

* Give a merge head a full review when its removed lines changed or its receipt came from a re-check

A head whose removed lines changed with the base no longer carries on one scoped reader, a receipt an older gstack carried through a scoped re-check no longer carries on or lands, and a /ship body post keeps the run history. The read-only stop stops offering a round grant it can't honor, and the stamp-only-carry no-stop class is removed because a refused carry never stopped. (GST-2706)

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

* Keep the run history inside Agent notes when the PR text quotes a receipt

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

* Let a receipt write skip a retired no-stop entry left in an older branch ledger

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

* Say in troubleshooting that the queue refuses a receipt carried through a re-check

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>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-17 12:01:00 +00:00
1 parent 800a9269fd
commit 79f6012bbc
23 files changed
+241 -162

No files matched your search

+22 -7
View File
@@ -152,7 +152,14 @@ caught on another crew's PRs.
once) and prints `PR_REVIEW_HISTORY:`, the flag line `PR_REVIEW_FLAGS:
--prior-rounds <rounds> --prior-full <full rounds>` and `PR_REVIEW_ROUTE:`.
`/ship` Step 1 prints all three. A re-check that carried a receipt before
this rule adds no round.
this rule adds no round. The count fails open when the history can't be
read (no `gh`, an unreadable body): Step 1 prints `PR_REVIEW_FLAGS:
--prior-rounds 0` and `PR_REVIEW_ROUTE: first (history unavailable: …)`, so
the plan counts this run's rounds only (`lib/ship-preflight.ts`). Every
run still reviews its head in full; what's lost is the cap on earlier
runs, so check the PR body by hand when that line shows. A `/ship` body
post keeps the live `gstack-receipt-runs` block (`lib/gstack-post.ts`), so
earlier runs and started stubs stay countable.
2. **Runs that stop count too.** After each Step 9 pass, `gstack-ship-receipt
stub --pr <n> --run <id> --review-loop <summary>` writes a `status: started`
entry, so a run that stops before its receipt still counts. The run's receipt
@@ -166,10 +173,18 @@ caught on another crew's PRs.
before merge), and `read-only` after two. Carry may still print `RECHECK:
advisory … packet=<file>`: one reader may read that packet for advice, but
its verdict never rebinds the receipt, and `carry --recheck` is refused
([scoped re-check](troubleshooting.md#receipt-carry-recheck)).
([scoped re-check](troubleshooting.md#receipt-carry-recheck)). A receipt an
older gstack carried through a re-check (its `carry.reason` names `scoped
re-check by`) carries no further, not even through a base merge or a stamp,
and `gstack-ship-queue` won't bind it (`QUEUE_RECEIPT_STALE`): the code that
hop covered never got a full review, so the head runs `/ship` until a fresh
full review replaces that receipt.
4. **Stop rule.** `gstack-review-plan --prior-full <n>` adds the PR's earlier
full rounds to this run's full passes; fix-checks stay the in-run table's
call, and `--prior-rounds` is printed as `pr_rounds=`. A full pass past two
call, and `--prior-rounds` is printed as `pr_rounds=`. The per-PR cap counts
full passes only, by design (`lib/review-depth.ts` `prCapped`): earlier runs'
fix-checks and scoped passes show in `pr_rounds=` but don't count against it,
because each run's own fix round is the in-run table's call. A full pass past two
stops with `PR_ROUND_CAP` and prints the exact `gstack-approvals
round-grant` command; a below-floor fix at the cap finishes with its notes
listed. The stop is the lane's or Captain's call, never an owner ask
@@ -178,8 +193,9 @@ caught on another crew's PRs.
own code changed since still gets one full review of its final head. It has
no fix round: below-floor findings ship as notes, and a blocker (open or
fixed) or a gate-class edit stops with `PR_ROUND_CAP` for the lane's Captain
to decide: ship with the note, record a round grant, or park. The count does
not reopen.
to decide: ship with the note, or park. A round grant recorded after the
read-only review doesn't buy a fix round, because that review already spent
the round the grant would add. The count does not reopen.
6. **Round grant.** `gstack-approvals round-grant --pr <n> --head <sha> --kind
extra-round --reason <why> --by <lane or Captain>` records one grant for one
head: one round past the cap, with its fix round, instead of the read-only
@@ -256,7 +272,7 @@ applies no edits is its exit too.
<a id="no-stop"></a>
### No-stop defaults (K1)
Five routine stops don't wait for a Captain. /ship and /autoplan record each one
Four routine stops don't wait for a Captain. /ship and /autoplan record each one
as `{class, reason, evidence}` in the receipt's `no_stop` field and keep going.
`gstack-no-stop record` (`lib/no-stop.ts`) checks each case before it records it.
When a case doesn't qualify, it prints `NO_STOP: refused` and exits 3, and that
@@ -267,7 +283,6 @@ stop goes to the owner as before. Every other stop still stops.
| `scoped-fix-check` | Round 2 stops for a fix whose range since round 2's `PASS_HEAD` is docs class only, or only raises timeout values. `--range-base` must be the commit the newest review-log pass row read. One per branch: the ledger keeps every record, so a later /ship on the branch stops for the owner. | It records the standing grant in the approval record (`by: gstack no-stop default (K1)`) and prints `GRANT:`. `gstack-review-plan --grant` plans the one scoped fix-check. A blocking finding there goes to the owner. |
| `test-timeout-fix` | Every changed line is in a test file and only raises a timeout value: the value of a timeout key (`timeout: 5_000`, `setDefaultTimeout(5_000)`, `--timeout=5000`) or bun's and jest's trailing per-test argument, only on the line that opens the test call itself (`test('…', () => {…}, 30_000);`, likewise `it(` and `describe(`). A multi-line test's closing `}, 30_000);` does not qualify and stops for the owner. A line with `expect`, `assert` or a comparison never qualifies. | The gate scan's relaxation finding takes the printed `GATE_DISPOSITION: kept` reason instead of `open`. |
| `pregate-flake-rerun` | One rerun of a failed pregate case at the same tree (CREW rule 16). One per branch. | Green counts as flaky. Red again is a real failure. |
| `stamp-only-carry` | A refused carry, where the receipt head merged into the base (base side on conflict) differs from HEAD only in a version stamp: `VERSION`, the `"version"` line of `package.json`, `CHANGELOG.md`, the agents digest or `changelog.d/` fragments. | Go on to Steps 2–16 without waiting for a Captain: the plan reviews HEAD in full, since a re-check no longer carries a receipt ([rounds per pull request](#rounds-per-pull-request)). |
| `autoplan-regate` | An edit to the plan file made after the owner's answer, or after the revise that took their changes, while the reviewed plan itself is unchanged. The edit only adds lines, all inside the plan's `## ELI5` section (an added `## ELI5` heading opens one), and no added line holds a number or a word for spend, cost, budget, price, cap, credits, limit, max, arm, model, judge, verdict, threshold, bar, trial, sample, stop rule, paid or eval. A removed or reworded line, or a line added anywhere else, goes to the owner. The carry exports the reviewed plan, so the added explanation is never built. | `gstack-autoplan` carries the owner's words (`reason=no-stop autoplan-regate: …`) and writes `<run>/no-stop.json`. `gstack-no-stop import` adds it to the branch's ledger. |
The ledger is one JSON array per branch under the checkout's git directory
+10 -13
View File
@@ -1381,7 +1381,7 @@ checked-out HEAD, when the receipt records `gstack_version` without
**`no_stop`.** The routine stops the run recorded and went on past, from
`write --no-stop <json|@file>`: an array of `{ class, reason, evidence }`, with
`class` one of the five no-stop defaults. /ship passes the branch's
`class` one of the four no-stop defaults. /ship passes the branch's
`gstack-no-stop` ledger here ([review-policy.md#no-stop](review-policy.md#no-stop)).
**`review_loop_exception`.** The owner's acceptance of a stop after a
@@ -2281,19 +2281,16 @@ of the branch's own +/- lines, or a packet over the caps, prints `RECHECK: not e
`RECEIPT_CARRY_PRODUCT_CHANGED`. A changed path alone, or context paths alone,
keep the routes above, and their output is unchanged.
The same scoped review also covers a hunk whose only difference from the
reviewed one is the base's edit of the lines the branch replaces. The base took
A hunk whose added lines are the reviewed ones but whose removed lines changed
with the base is a changed path, not a context path (GST-2706). The base took
`SAVE_VERSION := 83` while the branch's `:= 84` line, reviewed against `82`,
stays byte-identical. The branch's added lines must match byte for byte, and
the lines just outside the reviewed hunk's removed range must be lines the base
kept, landing just outside the current hunk's range (`lib/ship-patch.ts`
`comparePath`). The path then counts as a context path. Carry and finish put it
in the scoped-review packet, and the reader checks that the branch's value
still holds next to the base's. It never carries without a reader. A hunk whose
added lines changed, that now also removes a line the base never touched, or
whose range holds a line the base added (a base hunk at or next to the replaced
lines that adds more lines than it removes) stays a changed path. A [mechanical retake](#mechanical-retake) does not apply
here, since the branch retook nothing.
stays byte-identical, so the PR now removes `83`, a line no review read. A head
counts as the reviewed one only when the PR's own added and removed lines are
both byte-identical ([rounds per pull request](review-policy.md#rounds-per-pull-request)),
so carry refuses with `RECEIPT_CARRY_PRODUCT_CHANGED` and the head runs /ship,
whose plan reviews it in full (`lib/ship-patch.ts` `comparePath`). GST-1561 had
sent it to the one scoped reader instead. A [mechanical retake](#mechanical-retake)
does not apply here, since the branch retook nothing.
**Rewritten history.** `write` records `head_tree` (the reviewed head's tree)
and `product_patch_id` (its product patch against the base), and every carry
+8 -3
View File
@@ -6482,6 +6482,10 @@ what would merge. The one accepted difference is a train slot's stamp: when
the current head is the pinned head's stamp commit (same tree modulo stamp
files, or the pin with main merged in at slot 2 and later), the receipt
written for the pinned head is the binding one and `verify --train` accepts it.
It also refuses a receipt an older gstack carried through a scoped re-check
(its `carry.reason` names `scoped re-check by`), even at its own head: the code
that hop covered never got a full review (GST-2706,
[rounds per pull request](review-policy.md#rounds-per-pull-request)).
**Fix.** Rerun /ship on the current head so the receipt names it, then rerun
`gstack-ship-queue ready --pr <n> --screen|--no-screen`. A lane never stamps
@@ -7122,9 +7126,10 @@ the range-diff evidence ([unattended.md](unattended.md#the-terminal-line)).
**Meaning.** Every product path the branch touches has the reviewed +/- lines
in the same places, but the base edited context lines next to some of them, so
the 3-line patches differ (GST-384: main reworded the line above the PR's
hunk). A hunk whose added lines are unchanged and whose removed lines differ only
by the base's edit of the lines the branch replaces counts too (GST-1561: the base
took `SAVE_VERSION := 83` under the branch's `:= 84`). The merge may have spliced the two, as in a JSON entry where the branch
hunk). A hunk whose added lines are unchanged but whose removed lines changed with
the base (the base took `SAVE_VERSION := 83` under the branch's `:= 84`) doesn't
count: the PR's own removed lines changed, so it's `RECEIPT_CARRY_PRODUCT_CHANGED`
and a full review (GST-2706). The merge may have spliced the two, as in a JSON entry where the branch
changed one key and the base the next, so the receipt does not carry silently.
The refusal names the paths and a packet file with the hunks that differ and
the base's own change. The same lines moved somewhere else are