Skip to content

A round grant at the review round cap buys the fix round it names (GST-2968) - #4479

Merged
capy-ai[bot] merged 3 commits into
mainfrom
round-grant-buys-the-fix-round-after-a-review-cap-stop
Nov 18, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
round-grant-buys-the-fix-round-after-a-review-cap-stop

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

When /ship stops at a pull request's review round cap, a grant naming that stop now buys one scoped review of the fix, in the same run or the next, instead of another read-only full review.
Before, a grant recorded after the read-only review, or between /ship runs, bought nothing, so teams paid for extra full reviews or second grants (ghome#40: $8.78 against about $3).
Nothing to do: /ship prints the grant command when it stops.

What changed

The troubleshooting steps for the review round cap, before and after this change

The troubleshooting steps for the review round cap, before and after. A grant now names the stopped review and buys one short review of the fix. The text version is in the notes at the end.

A /ship run that hit the review round cap used to leave the team with no good move. A grant recorded after the read-only review bought nothing, and a grant recorded between runs was ignored, so the next run paid for another full review. Now /ship writes the stop into the PR description, a grant names that stop, and the next run reviews only the fix made since the stop. Each grant is used once, by the first run that claims it, and a later run no longer tries to reuse a grant someone already used. A grant recorded before any review still covers its own fix round, even after /ship merges the base branch in.

Why

"A round grant at the review round cap buys nothing" (GST-2968, ghome#40). Teams that recorded a grant after a stop still paid for a second read-only full review, about $8.78 against about $3 for the short review of the fix that the grant was meant to buy. With this change the grant buys exactly the review round it names, once.

Blast radius

The change touches the review planner, the PR-description bookkeeping that counts review rounds, the release step that checks the review chain, and the review summary. Every new path runs only when a grant and a recorded stop both exist, and the preregistered replay of 9,830,400 planning cases showed every decision unchanged outside the granted-round case (script ran: test/fixtures/review-pins/replays/GST-2968.json).

Test Coverage

The coverage audit (it wrote no tests) found tests for 15 of 18 changed paths (83%), or 78% weighted by value. The review's fix round then added tests for claiming an unknown grant, for a grant another run already used, and for the range checks after a stop. One path is still weakly covered: the help anchors for the three new error codes, which only have an existence check.

Tests ran: focused 39

Pre-Landing Review

Two full review passes and a second-model review found nothing that blocks merge. The first pass found 6 small issues, all fixed in 5b8fd5d: two runs could both claim one grant, a fresh run could reuse a grant another run had used, the re-plans after a granted review could not keep the stop, the error text told a run to repeat a step that refuses to run twice, the release step accepted a grant on the wrong part of the review chain, and three tests were missing. The second pass and the later readers left 7 notes below the blocking floor, listed in the notes at the end and not fixed here.

Exploratory QA

Smoke only: the focused test files (39 tests) and one live reproduction of the planner's usage error after a stop, which a test now covers. The QA method files were not loaded and no other probes ran, so exploratory coverage beyond that smoke did not run.

Design Review

No frontend files changed, so design review was skipped.

Eval Results

Not run. The eval selector picked about 110 paid behavior probes because the changed tools are shared by many workflows, which is well past this PR's paid-test budget, so they are left to the scheduled release gate. The full free test suite passed in CI at 5b8fd5d.

TODOS

No TODO items completed in this PR.

Documentation

Status: current. The docs already match this branch, so nothing was edited.

Scope: base 33b1a96 to head 5b8fd5d, 28 committed files, no staged, unstaged or untracked changes. The audit read every changed doc and template, the source that defines the new result codes and commands, and the repo's Markdown for any other mention of round grants.

Documentation health:

  • docs/review-policy.md: current. Updated in this branch; item 6 covers both grant kinds.
  • docs/troubleshooting.md: current. Updated in this branch with the PR_ROUND_CAP fix steps and the STOP_UNBOUND, GRANT_SPENT and GRANT_UNKNOWN entries.
  • ship/DRIVER.md.tmpl and ship/sections/review-army.md.tmpl: current, and consistent with the policy doc.
  • crew/docs/captain.md: current, no change needed.
  • README.md and AGENTS.md: not affected.

Coverage debt: none. Diagram drift: none.

Tests
Agent notes

Refs GST-2968, GSTA-608

Approvals

No approvals recorded for branch round-grant-buys-the-fix-round-after-a-review-cap-stop.
Plan: exempt: bug fix
Plan check: exempt bug fix

REVIEW_LOOP: passes=2 blocking_found=0 deferred=0 noted=4 fixed=6 scope=frozen ledgers_read=3 dispatches=6
Gate edits: none detected (7 listed, 3 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: openai/gpt-6.1-sol (host subagent), completed, VERDICT: CLEAN
Targeted reader (money): done, no findings
Paid evals: not run (selector picked ~110 behavioral probes via derived references; over the per-PR paid budget)
Flaky: windows-setup hit its 40-minute limit and was cancelled on attempt 1 of run 44259421030, then passed on one rerun (attempt 2) at the same head 5b8fd5d; logged in the flaky ledger.

Review notes

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

  • INFORMATIONAL lib/ship-release.ts:325 fixChecked now matches a fix-check round grant to a link only when the grant's head resolves to that link's range_base. The existing X14 test covers only the positive match. No test shows that a fix-check grant whose stop head falls inside a link but is not that link's range_base is now left unmatched. Before this change such a grant was matched by any SHA in ask/scope inside the range.
  • INFORMATIONAL bin/gstack-ship-receipt:1142 cmdClaim gained a re-read after posting the grant marker. It refuses with GRANT_SPENT when another run's marker comes first, and fails when the re-read itself fails. Neither branch has a test. The re-read also only narrows the race: if a losing run writes its whole body after the winner's re-read, both runs can still confirm their claims.
  • INFORMATIONAL bin/gstack-review-plan:164 This commit relaxes --stop to accept a later --range-base for 'the post-review or targeted re-plan after the granted fix-check'. The targeted re-plan still can't dispatch, though. Later in this file, targetedDelta gets granted=!!grant, where grant is only --grant, which needs a review_loop_grant row. grantedStop (--stop/--round-grant) is never passed through. So when a granted fix-check round changes code in a targeted class (auth, secret, gate, money, the likeliest classes for a fix round), targetedDelta skips with 'not docs-only, so it takes the review loop'. Passing the round grant's id as --grant is refused, because a review_round_grant row doesn't contain 'review_loop_grant'. Meanwhile gstack-ship-receipt write refuses review_targeted, because a targeted class changed since the read (its usage text). pr-body.md.tmpl tells the lane to 'add its --grant' at that point. The lane is left with no path to a receipt unless the owner records a second, review_loop_grant-style grant. No test covers a targeted re-plan with --stop.
  • INFORMATIONAL bin/gstack-ship-receipt:1144 The new re-read in cmdClaim treats 'no grant marker for this id at all' (first === undefined) the same as 'another run's marker came first'. It reports GRANT_SPENT ('claimed by run another run') and tells the lane to record a new grant. A missing marker means some other whole-body write (a concurrent run's stub, stop or receipt write, or a hand edit) clobbered this run's marker, and nobody spent the grant. The lane gets told to buy a grant it doesn't need. A rerun of claim would succeed, because no marker exists.
  • INFORMATIONAL bin/gstack-ship-receipt:1139 1. The claim race is narrowed, not closed (bin/gstack-ship-receipt:1139-1144). The PR body is replaced whole on every gh pr edit, so the last write wins. The new re-read after posting catches one case: another run overwrote this run's marker before the re-read. It misses the reverse order. Run A reads, B reads, A writes, A re-reads and sees itself first, then B writes over the body and re-reads and also sees itself first. Both runs print GRANT_CLAIMED, and A's claim marker is erased from the record, so history afterwards shows only B. This only happens when two /ship runs on the same PR claim the same grant within a few seconds. The current lane rule of one /ship per head makes that unlikely, but the check reads as a guarantee it doesn't give. A real fix needs a compare-and-swap that GitHub PR edits don't offer: an exclusive lock (for example a lock comment or a git ref the claim pushes), or a second re-read after a short delay plus a rule that the lexically smallest run wins. INVESTIGATE. Severity: Low. Blocks: no
  • INFORMATIONAL bin/gstack-review-plan:164 2. --range-base after --stop isn't limited to the re-plan cases it was added for (bin/gstack-review-plan:164). The new check only requires the stop to be an ancestor of the range base. It doesn't require --post-review / --last fix-check or --targeted-ran, even though the error message describes the relaxation as being for those cases. So a lane's first fix-check plan after a stop can pass --stop S --round-grant G --range-base R, with R after the fix commits, and get grantedStop history with a fix range of only R..HEAD. The fix commits between S and R would then not be in the planned fix-check. It fails closed further down: fixChecked in lib/ship-release.ts now binds a fix-check grant only when fc.head is the link's own range_base, and a link starting at R doesn't hold the reviewed tree. Finish therefore refuses, but only after a fix-check reader has been spent on the wrong range. The check also doesn't require the range base to be an ancestor of HEAD. Fix: allow range-base ≠ stop only with --post-review --last fix-check or --targeted-ran, and require ancestor(range-base, HEAD). FIXABLE. Severity: Low. Blocks: no
  • INFORMATIONAL docs/troubleshooting.md:7443 3. One docs line wasn't re-wrapped (docs/troubleshooting.md:~7443). The line starting "<the /ship run>. It adds --round-grant --stop `…" runs to about 120 characters inside a list that is otherwise wrapped at 80. It's cosmetic only, and I found no lint for it. FIXABLE. Severity: Low. Blocks: no

Before/after text of the troubleshooting steps

Before/after as text: The round-cap fix steps: a fix-check grant names the stop and buys one scoped fix-check
--- Before · docs/troubleshooting.md § PR_ROUND_CAP at 33b1a96 · source text
+++ After · docs/troubleshooting.md § PR_ROUND_CAP on this branch · source text
@@ ⋯ 7 unchanged ⋯ @@
 `PR_REVIEW_FLAGS:`. A fix below the blocking floor finishes with its notes
 listed instead of stopping.
 
+**Fix.** The lane's Captain decides. Ship with the open notes listed, park, or,
+when a finding above the floor is open in this PR's own change, buy the stopped
+review's fix round:
+
+1. Record the stop: `gstack-ship-receipt stop --pr <n> --run <the /ship run>
+   --since <REVIEW_SINCE>` (`/ship` runs it on `NEXT: stop`). It prints
+   `STOP_RECORD:` and the grant command.
+2. The lane or Captain records that grant: `gstack-approvals round-grant --pr
+   <n> --head <the stop's head> --kind fix-check --stop-run <its run> --findings
+   <the open finding ids> --reason <why> --by <lane or Captain>`.
+3. Commit the fix on top of the stop's head. A new run's `gstack-ship-preflight`
+   prints `PR_REVIEW_FLAGS:`; the same run, whose preflight already ran, gets
+   that line from `gstack-ship-receipt history --pr <n> --base <base> --run
+   <the /ship run>`. It adds `--round-grant <id> --stop <head>`, and the plan is one scoped fix-check of the PR's own change
+   since that head, with no new full review. The run claims the grant first
+   (`gstack-ship-receipt claim`).
+
+A head no review has stopped at takes an `--kind extra-round` grant instead:
+one full round with its fix round. Each grant is spent by the one run that
+claims it. When `PR_REVIEW_GRANT: not applied (...)` prints, the reason names
+what doesn't match (another stop or head, a stale stop, a claimed grant). This
+is not an owner ask, and gstack cannot grant itself one (`--by` naming gstack
+is refused) ([review-policy.md](review-policy.md#rounds-per-pull-request)).
-**Fix.** The lane's Captain decides. Ship with the open notes listed, or, when a finding above the floor is
-open in this PR's own change or the design changed, have the lane or Captain
-record one round with the command the `NEXT:` line prints,
-`gstack-approvals round-grant --pr <n> --head <sha> --kind extra-round --reason
-<why> --by <lane or Captain>`, then rerun `gstack-ship-preflight`: its
-`PR_REVIEW_FLAGS:` line adds `--round-grant <id>` for the plan.
-The grant names one head; a new push needs a new grant. This is not an owner
-ask, and gstack cannot grant itself one (`--by gstack` is refused)
-([review-policy.md](review-policy.md#rounds-per-pull-request)).
 
+<a id="stop-unbound"></a>
-<a id="receipt-prose-mismatch"></a>

Evidence

  • Case matrix, design and the preregistered no-loss replay: captain drive handoffs/GSTA-608/.
  • Rule-15 replay (deterministic, no paid run): 9,830,400 plan cases, every step identical outside the granted-round-3 class; 12,800 change there, all stop/voices to full/scoped.

🤖 Generated with Claude Code

{
  "schema_version": 1,
  "pr": 4479,
  "head": "5b8fd5d8d159e0d8f02788b04c3b8b748093ca16",
  "version": "1.100.0.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 39,
      "fail": 0,
      "skip": 0
    }
  },
  "calls": 33,
  "session_kind": "unattended",
  "run": "ship-4479-9dbf47a",
  "head_tree": "c636c5e584a0defab4ead14f38a935bf5823ad8d",
  "product_patch_id": "10bbf89c89a4fd7b2fc54c9bfe6356045abfb8cc",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 406,
    "rules": "1afa38a4be3b5eef",
    "base": "33b1a965bacb9ae28ac9281a1a70cbd987e54c01",
    "registry": "33b1a965bacb9ae28ac9281a1a70cbd987e54c01",
    "gate_scan": {
      "tagged": 0,
      "head": "5b8fd5d8d159e0d8f02788b04c3b8b748093ca16"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "risk:security",
      "runtime=406"
    ],
    "risk": [
      "money",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @c636c5e584a0 (8 checks, current for 5b8fd5d8d159)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44259421268/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44259421268/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44259420988/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=c636c5e584a0 tests=37802 skipped=105 runs=44259421268/1 profiles=ci-reuse/free-tests heads=5b8fd5d8d159 verified=2026-11-18T08:20:09.132Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md: changed docs and templates plus every mention of round grants"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 4,
    "fixed": 6,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 6
    }
  },
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "23eb808423669ba0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "10bbf89c89a4fd7b2fc54c9bfe6356045abfb8cc",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

Open in Capy

… the same /ship run or the next (GST-2968)

When a review stops at the cap, /ship records the stop in the PR body, and a fix-check round grant naming that stop buys one scoped fix-check of the fix instead of another read-only full review. Grants are claimed once, and an extra-round grant keeps its fix round.

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

trunk-io Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 18, 2026 06:51
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…, and accurate same-run steps

A grant claimed by another /ship run no longer reappears in a fresh run's review flags, a racing claim is caught by reading the PR body back, a post-review or targeted re-plan after a granted fix-check keeps the stop flag with its own range base, finish only accepts a fix-check grant for the fix-check that starts at its stop head, and the round-cap text says how the same run gets its flags (it cannot rerun preflight).

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/specialist-batched#2 reader=state-machines
Review-Finding: p1/specialist-batched#3 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
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>
@capy-ai
capy-ai Bot merged commit f87d432 into main Nov 18, 2026
61 of 62 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 18, 2026
- A test, or a scratch repository in the temp directory, can no longer write approval rows into your real Capy Drive (GST-3027). (#4466)
- An unattended /autoplan run on Claude Code no longer says the publication guard is off while it is on. (#4481)
- A phase report written only in reasoning now gets a denial that says so and names the fix. (#4481)
- `gstack-autoplan revise` no longer refuses a plan that the first `next` accepted. (#4470)
- `revise --plan` with a different file now says the run follows that file. (#4470)
- A second-model plan review in `/autoplan` is no longer reported as unavailable when it actually ran (GST-3051). (#4471)
- The /ship conductor trial plan now lets case reverts that conflict with later code be resolved by hand in docs, tests and the planted file, so large pull requests can be cases (GST-3003). (#4460)
- A locked plan for a trial of /ship without its separate conductor subagent (GST-3003). (#4456)
- A driven /ship now runs each phase as one command, counts its calls, and stops itself at 100 minutes. (#4451)
- /ship stops asking owners to clear two kinds of bookkeeping noise: base-side merge text and a reviewer's confirmation prose. (#4458)
- A base merge that only touched base-side text no longer stops `/ship` finish for an owner's grant. (#4458)
- A reviewer's confirmation prose no longer becomes a Critical finding that only an owner can clear. (#4458)
- A CI run that passed only after its failed jobs were re-run is now marked wherever gstack reuses it. (#4473)
- /ship reuses CI's passing test run when merging the base changed no file, and stops instead of quietly starting hour-long test runs or reviewing an empty diff (GST-3019). (#4461)
- /ship on Codex no longer stops at the test coverage audit. (#4489)
- A cold first-use check before an app build reaches its owner (GST-3025). (#4465)
- `skill_prefix=true` now survives updates when gbrain is installed. (#4454)
- The OpenClaw docs no longer send you to ClawHub, which held only April 2026 builds of office-hours, ceo-review and retro and no longer has gstack skills (the docs also said four skills while listing three). (#4454)
- `gstack-issue-links` no longer reads other repositories' issues as gstack's. (#4454)
- /ship's pre-gate finds the tests of a monorepo app that imports through its own `@/` alias. (#4464)
- /office-hours explains why it recommends a mode. (#4450)
- /office-hours keeps its 34 founder videos and essays out of the skill file. (#4463)
- Two `gstack-owner-answers add` runs for the same answer no longer collide. (#4490)
- A Captain can check an ask against the owner's earlier answers before sending it. (#4467)
- `gstack-post` stops reading /ship's own receipt identifiers as phone numbers, so posting a /ship PR body no longer needs a confirm. (#4488)
- GitHub release notes now list every change in plain words, with a link to its pull request. (#4390)
- gstack's router no longer gives bug reports a special rule, so the model fixes a bug the way it would without gstack. (#4442)
- /ship's review plan now sorts Swift and Xcode files by risk instead of sending every iOS PR to the full review panel (GST-3041). (#4469)
- /ship's review plan now sends Swift code that touches private user data to the full review panel (GST-3052). (#4472)
- A round grant at /ship's review round cap now buys the fix round it names, in the same run or the next (GST-2968). (#4479)
- The secrets check stops flagging three kinds of ordinary code as a secret, and catches two misses. (#4457)
- A security finding's location and reason no longer go into a PR body. (#4486)
- The token-capped /ship child on Claude Code now starts its prompt with the typed `/ship` command, so the skill actually loads. (#4487)
- A /ship receipt now counts the second-model review's blocking findings, and refuses to be written while one is still open. (#4485)
- A `/ship` with a token cap on Claude Code no longer stops at its first handoff. (#4452)
- /ship's push step now always ends with one line that says whether it pushed (GST-3053). (#4474)
- A PR's review-round count can no longer be overwritten by the body `/ship` posts. (#4440)
- One queued record with a malformed path no longer stops artifacts sync for every project. (#4455)
- A failed artifacts push stays reported until a push succeeds. (#4455)
- The /sync-gbrain memory row no longer says OK when pages failed to import. (#4455)
- ### Tests (#4495)
- A policy-floor test no longer fails once gstack's own version reaches the minor after the newest policy key; it now checks a floor above both, so the v1.101.0.0 release can pass CI. (#4495)
- CI now uploads free-suite test results to Trunk with analytics-uploader v2.1.8 and analytics-cli 0.17.0, up from v2.1.6 and 0.16.2. (#4453)
- Packing a checkout for a Ubicloud run no longer fails when git beside it is rewriting a ref. (#4447)
- The /plan-ceo-review HOLD SCOPE eval no longer fails a review because its follow-up question didn't repeat the mode name. (#4447)
- Unattended /autoplan now records the owner's relayed gate reply instead of refusing it. (#4484)
- Unattended /autoplan now runs the second-model review you turned on, and waits for it instead of ending the session. (#4459)
- Two /autoplan runs started in the same second no longer share a run id. (#4459)

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