Repository navigation
fix: a granted fix-check after a fix-check plans in the loop (GST-1681) - #4096
Merged
Merged
Conversation
In the loop, a new review_loop_grant naming the last fix-check's commit (--range-base, the stop it answers) plans one more scoped fix-check, the next link of the fix-check chain finish counts (GEVA-363, gstack-evals#254). Replay: GST-1681 (repins lib/review-depth.ts) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
In the loop, a grant recorded before a later logged fix-check already bought a link of the fix-check chain, so gstack-review-plan refuses it (exit 3): a post-review link's grant names the commit its fix-check read, and a stale --range-base names an earlier link. A CLI regression covers both, and a grant recorded after the newest fix-check still plans. Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/specialist-batched#1 reader=testing Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Before: after round 2's fix-check and one granted fix-check, an owner who granted one more round at the last fix-check's stop head got
NEXT: stopfromgstack-review-plan. In the loop a fix-check never earned another, so GEVA-363 (gstack-evals#254) hand-ran fc3 on a--fix-rangetoken and finish printedFIX_CHECK: not counted (fix-range pass; only a later full pass can clear review).After: a new recorded
review_loop_grantnaming the last fix-check's commit (--range-base, the stop it answers) plans one more scoped fix-check, the next link of the fix-check chain finish already counts. A grant recorded before a later logged fix-check has already bought its link, so the planner refuses it (exit 3) instead of planning a second paid fix-check on one grant.Why
#4093 (GST-1676) covered this only for
--post-review. The in-loop stop after a second fix-check still had no path, so a Captain's grant past the cap was hand-rendered and finish couldn't count it.How
bin/gstack-review-plan: outside--post-review, after a fix-check, a grant whose stop head is exactly--range-basesets a newchainedhistory flag. The previous link's grant names an earlier stop head and is refused (exit 3); a grant at any other commit plans nothing. One grant, one link.bin/gstack-review-plan(24082b9, the pre-landing review fix): in the loop, a grant recorded before a later loggedreview-fix-checkrow is spent and refused (exit 3). That closes the replay pass 1 found, where a post-review link's grant or a stale--range-basebought a second link. Whengstack-review-readcan't read the log, the planner fails closed (exit 1) rather than plan a fix-check the grant may not buy.lib/review-depth.ts:nextStepturns that stop into one fix-check whenchained, a grant and no open blocker are present; gate class still runs Step 11's voices first. Withoutchaineda fix-check still never earns another (GEVA-223 and GST-1676 tests unchanged).--granthelp text.chained).Tests (written first, failing on main)
test/review-plan-cli.test.tsGST-1681: GEVA-363's exact shape (--pass 1 --last fix-check --fix-checks 2 --fixed-blocking --range-base <fc2> --grant <grant at fc2>) plans a fix-check; the previous grant refuses; no grant, an open blocker, or a grant at another commit stop. It also pins GBRA-336's--post-review --last fix-check --fix-checks 2 --grantinvocation, which plans on main since fix: finish counts a post-review fix-check chain's first link; review-plan plans the next chained fix-check (GST-1676) #4093.test/review-plan-cli.test.ts(24082b9): "in the loop, a grant recorded before a later logged fix-check is spent and refused" covers the post-review-link replay and the stale--range-basereplay, and a grant recorded after the newest fix-check still plans. It fails on 9bcbfa2's bin and passes at 24082b9.test/review-depth.test.ts: thechainedtransition, lean and full loop, gate voices first.test/ship-finish-ruled-notes.test.ts: finish counts the GEVA-363 chain (fc2 and fc3, each under its own grant; the in-cap fc1 isn't a link). This one already passes on main.Blast radius
The planner only, and only after a fix-check with a grant. Nothing changes unless a grant names exactly the last fix-check's commit, and the new guard can only refuse such a grant, never plan one (read at bin/gstack-review-plan:165-167 and covered by the CLI regression).
Approvals
Approved: yes (record r-ed038bdcd511). The full approval record stays private: this repository is public or its visibility is unknown.
GStack Minder (GSTA-36) scoped this as GST-1681 step 2.
Summary
A Captain's grant for one more fix-check after a fix-check now plans that fix-check in the loop, and the same grant can't buy two. The branch has two commits. 9bcbfa2 is the planner change with its tests, and 24082b9 is the pre-landing review fix that refuses a spent grant.
Test Coverage
All new code paths have test coverage except the fail-closed read branch and malformed timestamps, both listed under Review notes.
Coverage: deterministic (4 changed runtime files each have a changed test: bin/gstack-review-plan 3, docs/review-policy.md 1, docs/ship-policy.md 2, lib/review-depth.ts 4).
Tests ran: free 1620 (files, CI carry run 42296806806/1 at tree da3d01ac6b29; 6 files skipped here, not owed)
Pre-Landing Review
Pass 1 (gate class, full depth, 4 dispatches) raised 3 issues. The 2 asked were fixed in 24082b9, and red team #2 became a note. Pass 2 (range 9bcbfa2..24082b9, 4 dispatches) raised 4 issues, all kept as notes, none deferred. Step 11: adversarial-native 5 findings (1 Medium folded into the ruled note, 4 Low noted), outside voice 1 CRITICAL (ruled below).
REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=5 fixed=2 scope=frozen unrecorded=1 ledgers_read=4 dispatches=4 est_input_tokens=4730
Ruled note: bin/gstack-review-plan:167:adversarial at 24082b9 ruled by Captain GStack Minder (GSTA-36), 2026-11-06 at 2026-11-06T21:30:07.066Z: Caller-written timestamp fails toward one wasted fix-check; finish one-grant-per-link still refuses a false clear; follow-up GST-1684 (approval a-fd9dcccd3139)
Gate edits: none detected (5 listed, 1 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 (medium) found 1 CRITICAL (p2/outside-voice#1,
bin/gstack-review-plan:167:adversarial: the spent-grant check trusts the caller-written timestamp). The Captain ruled it a disclosed note (above, follow-up GST-1684). VERIFY: clean for pass 1 and pass 2.Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
bin/gstack-review-plan:166The new fail-closed branch, which returns EXIT.fail when gstack-review-read exits nonzero, has no test. The GST-1681 test covers only the spent-grant refusal (exit 3) and the fresh-grant plan (exit 0). A regression that flips this guard to fail open, so the planner plans a fix-check whenever the review log can't be read, would pass the suite.bin/gstack-review-plan:167The spent-grant check fails open when a timestamp doesn't parse. If a review-fix-check row has a missing or malformed timestamp, or a legacy approval row has no recorded_at, Date.parse returns NaN and the comparison is false. The grant is then treated as unspent, and that one grant can buy a second paid fix-check. No test covers either malformed input.bin/gstack-review-plan:167Approval ids are deterministic: sha256 of source, date, ask, words and by (lib/approval-record.ts buildRow), and appendRows skips an id that is already present. The new spent-grant check now depends on recorded_at, so it matters when a fresh grant cannot be told apart from the spent one. The in-loop case this change handles reuses the same stop head as the spent grant (the test's gc and fresh both name c). If the lane records the owner's new grant with the same ask template, words and by on the same day, gstack-approvals add prints 'APPROVAL_RECORDED: (already present)' and keeps the old recorded_at. Every replan is then refused with exit 3, and the owner's legitimate grant can never buy its link. The refusal text makes this likely, because its suggested remedy is the generic template '... (review_loop_grant )'. Reproduced: two adds of an identical ask with words 'do it' and by 'GStack Minder', one second apart, returned the same id a-078957f004a5, and the second was marked 'already present'. The test avoids the collision only because its asks differ by a label ('post-review link at c' vs 'fc5').bin/gstack-review-plan:167The check orders a fix-check against the grant by the row's caller-written timestamp field. gstack-review-log never stamps that field, and the ship prose only asks for 'ISO 8601'. The specialists already flagged the NaN case. This is a separate one: valid ISO 8601 forms that parse to the wrong instant. Date-only '2026-11-06' parses as UTC midnight. A zone-less '2026-11-06T21:20:30' written fromdate -uparses as local time, which is off by hours on a non-UTC machine such as a lane on Garry's Mac. Either form can place a fix-check that ran after the grant before recorded_at, so a spent grant looks unspent and buys a second paid fix-check. The logger already stamps a trusted start time on every bound row, review_binding.started_at, taken when the fix-check's start token is minted (lib/review-evidence.ts bindReview).bin/gstack-review-plan:161(pass 1, red team refactor: reorganize codebase into modular structure #2, noted by lead judgment) A valid grant at a later in-range commit than--range-baseis ignored in the loop after a fix-check without a message: the planner exits 0 withNEXT: stopasking for a grant. main behaves the same for that invocation, and refusing it would break GST-1676's pinnedNEXT: stopcase.completed:falseor unavailablereview-fix-checkrow refuses a rerun under the same grant. This fails closed, so it costs an owner round-trip, not safety.recorded_atand the fix-check row's time come from different clocks (the machine that rangstack-approvals addand the lane machine), so clock skew can make a spent grant look unspent. Synced cloud clocks make this unlikely.spawnSyncreturnsstatus: null, so the refusal prints "gstack-review-read exited null". The planner still fails closed; only the message is unclear.converged:false, and the reader was rerun under the Captain's grant before Step 11.5 bound the reviews (VERIFY clean, briefs=1 outputs=1).Exploratory QA
Smoke probe
qa-probe.shreproduced pass-1 red team #1 on 9bcbfa2 (a spent grant replayed and plannedNEXT: fix-check). The fixed regression test fails on 9bcbfa2's bin and passes at 24082b9.Design Review
No frontend files changed — design review skipped.
Eval Results
No prompt-related files changed — evals skipped (no prompt, template, judge or harness change; eval:select lists behavior probes as release coverage only, quality judges none).
Review bot comments
No review bot comments.
Plan Completion
Plan completion audit: not run (no plan bound; --kind fix)
Issues
Refs p1/red-team#1Refs p1/specialist-batched#1TODOS
No TODO items completed in this PR.
Documentation
Status: current. No documentation edits were needed, and there are no blockers.
Scope: the 10 committed files from base 688e3ab to head 24082b9 (no staged, unstaged or new files). The changes are the GST-1681 in-loop granted fix-check chain link in
bin/gstack-review-planandlib/review-depth.ts, with tests and fixtures.Documentation health:
docs/review-policy.md: current. The round-3 prose and the transitions table cover the in-loop grant link.docs/ship-policy.md: current. The cap section explains the in-loop link and why the previous link's grant is refused.changelog.d/capy-gst-1681-granted-third-fix-round.md: current. The fragment matches the behavior.bin/gstack-review-plan --help: current. The--granthelp text describes the new link.Coverage debt: the new
History.chainedfield and the in-loop grant path have reference coverage (the policy docs and the CLI help) but no how-to example. That is a common gap, and nothing critical is missing.Diagram drift: none.
Test plan
bun run test(CI carry, free-tests run 42296806806/1 at tree da3d01ac6b29): 1620 files pass, 0 fail, 6 skip (not owed here)bun run typecheckclean;bun run typecheck:testno new diagnosticsgstack-pregateat tree da3d01ac6b29: requires-remote cleared (macos-named-regressions and remote_gate by run 42296806806/1, windows-smoke by run 42295454723/1)🤖 Generated with Claude Code