/ship no longer reports zero blockers when the second-model review found one (GST-3075) (#4485)

When /ship stopped on a second-model review finding marked "Blocks:
yes", the record it left on the PR said no blockers were found; now the
finding is counted and /ship will not write that record until it is
fixed or ruled.

Why: `ready` and the merge step trust that record, so an undercount let
a blocked PR look clean.

Nothing to do: the next /ship run logs Step 11's findings and checks
them before writing.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: h2p1/red-team#1 reader=red-team
Review-Finding: h2p1/red-team#2 reader=red-team
Review-Finding: h2p1/red-team#3 reader=red-team
Review-Finding: v1/outside-voice#1 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-18 12:51:14 +00:00
1 parent bbf48aa7ef
commit 07611a00a7
19 files changed
+190 -16

No files matched your search

+1
View File
@@ -336,6 +336,7 @@ gstack_result_anchor() {
REVIEW_SCOPE_LEDGER) printf '%s' 'review-scope-ledger' ;;
RECEIPT_CARRY_REFUSED) printf '%s' 'receipt-carry-refused' ;;
PROSE_LINT_FOUND) printf '%s' 'prose-lint-found' ;;
RECEIPT_BLOCKER_OPEN) printf '%s' 'receipt-blocker-open' ;;
REVIEW_LOOP_EXCEPTION_INVALID) printf '%s' 'review-loop-exception-invalid' ;;
CI_CARRY_RERUN_MALFORMED) printf '%s' 'ci-carry-rerun-malformed' ;;
RECEIPT_CARRY_TREE_MISMATCH) printf '%s' 'receipt-carry-tree-mismatch' ;;
+3 -1
View File
@@ -51,7 +51,7 @@ import { approvalForReceipt } from '../lib/approval-citations';
import {
CARRY_METADATA_GLOBS, CARRY_NAMED_PATHS, CARRY_TEST_GLOBS,
bindReceipt, carryReceipt, recheckCarried, classifyCarryPath, computeCensus, extractReceipt, landedStackParent, missingIssueLines, orderReceipt, parseReviewLoop, placeReceipt, planCarry, planTreeCarry,
receiptIssuesFrom, receiptRuns, receiptSummaryLine, renderCensus, renderReceiptBlock, validateReceipt, type CensusPr,
receiptIssuesFrom, receiptRuns, receiptSummaryLine, renderCensus, renderReceiptBlock, unruledOpenBlockers, validateReceipt, type CensusPr,
} from '../lib/ship-receipt';
import { checkDocsCaps, docsCapLine, docsExceptionLine, parseReceiptDocs } from '../lib/ship-receipt-docs';
import { comparePath, contextPacket, PACKET_SECTION_CAP, readScopedReview, touchedPaths } from '../lib/ship-patch';
@@ -367,6 +367,8 @@ function cmdWrite(rest: string[], json: boolean): number {
const loopRaw = jsonArg(flag(rest, '--review-loop'));
const reviewLoop = loopRaw ? parseReviewLoop(loopRaw) : undefined;
if (loopRaw && !reviewLoop) throw new Error('--review-loop needs integer passes, blocking_found and deferred (gstack-review-scope summary --out <file>, then @<file>)');
const open = unruledOpenBlockers(loopRaw, ruledNotes, ruledHead => spawnSync('git', ['merge-base', '--is-ancestor', ruledHead, headSha ?? head], { cwd: repoRoot, timeout: 30_000 }).status === 0);
if (open.length) { process.stderr.write(resultLineWithDocs('gstack-ship-receipt write', 'RECEIPT_BLOCKER_OPEN', `${open.join(', ')}; nothing written`) + '\n'); return EXIT.refused; }
input = {
schema_version: 1, pr: flag(rest, '--pr') !== undefined ? Number(flag(rest, '--pr')) : undefined, head,
version: flag(rest, '--version') ?? receiptVersion(repoRoot, head, base), base,
@@ -0,0 +1 @@
- **A /ship receipt now counts the second-model review's blocking findings, and refuses to be written while one is still open.** When /ship stopped after Step 11 because the second-model review (or the native adversarial pass) raised a `Blocks: yes` finding, no review-log row recorded it, so the receipt said `blocking_found=0` and the PR looked clean to `ready` and the merge step. Step 11's own row now carries `via: ship` and its findings, `gstack-review-scope summary` counts them (they are never a pass or a round), and `gstack-ship-receipt write` refuses with `RECEIPT_BLOCKER_OPEN` while any blocker's newest action is still `open` and no owner ruling closes it. A finding below the floor still counts only as a note.
+1
View File
@@ -802,6 +802,7 @@ puts in the receipt:
| `review_loop.passes` | full review passes this ship ran (1 or 2; up to 3 under `review_scope: diff-plus-blocking` or `all`) |
| `review_loop.blocking_found` | every blocker found (GST-951): the rows' blocking findings (classified, or an unclassified CRITICAL), plus each ledger CRITICAL (as collected or judged) that no row finding from the same reviewer at the same path:line accounts for (each row finding pairs with one per ledger), so an adversarial, outside-voice or not-yet-classified blocker counts and one whose newest classification is below the floor does not. An unreadable ledger, merged file or judged set, or a judged set changed since `judge`, is `REVIEW_SCOPE_LEDGER`, never a count |
| `review_loop.unrecorded` | blockers found that no row gives a disposition (fixed, deferred, noted, skipped, a gate answer); absent when 0 |
| `review_loop.open` | blockers a row still holds as `open` at its newest action, gate findings aside (GST-3075), each its ledger id or fingerprint (or `{ id, fingerprint }`); Step 11's `adversarial-review` row counts here like a pass's row but is never a pass or a round. Only a later row's action clears one, and while any is left with no owner ruling, `gstack-ship-receipt write` refuses with [`RECEIPT_BLOCKER_OPEN`](troubleshooting.md#receipt-blocker-open); absent when 0 |
| `review_loop.unbound` | what could not bind (GST-1168), each printed as `REVIEW_SCOPE_UNBOUND: <what>: <why>`: a row with no start token and no readable time, a `pN` ledger with no review row of pass N (a fix-check ledger in a `pN` directory is not a pass ledger, GST-1775), a row finding's `ledger_id` no ledger collected, a `Review-Finding` trailer naming nothing; absent when 0 |
| `review_loop.ledgers_read` | dispatch ledgers the count read; absent under `--no-ledger` |
| `REVIEW_SCOPE_VOIDED:` (stderr, not a receipt field) | an abandoned pass (GBEV-3): a `pN` ledger never judged that no row names, replaced by a later `pM` ledger (M > N) that was judged or is named. Its findings are left out of every count above instead of counting as unbound and unrecorded. A fix-check ledger and the last pass are never voided |
+20
View File
@@ -7284,6 +7284,26 @@ outside the range is listed as `not applied`, and a path edited after the
fix-check still routes by the post-review rules. When the owner wants the
findings fixed instead, fix them and ask for a grant for one more fix-check.
<a id="receipt-blocker-open"></a>
### `RECEIPT_BLOCKER_OPEN`
**Meaning.** `gstack-ship-receipt write` wrote nothing because the
`--review-loop` record (`gstack-review-scope summary`) lists a blocking
finding that is still `open`: a review-log row holds it, its newest action is
`open`, and no owner ruled note closes it. That happens when /ship
stops with a blocker unfixed, for example a second-model review finding marked
`Blocks: yes` in Step 11 that no later Step 9 pass fixed. A receipt there would
claim a review that never cleared the blocker (GST-3075). Gate findings keep
their own path (an `open` gate finding makes the PR a draft) and are not
counted here.
**Fix.** Fix the finding, commit, and run /ship again on the new head; that
run's Step 9 row records it `fixed`. If it should ship unfixed, take the stop
to the owner: their ruled note (`gstack-approvals rule`) closes it, or their
grant buys one fix-check. Never edit the review-log row or the loop file to
drop the finding, and never write the receipt by hand
([ship-policy.md](ship-policy.md#ship-receipt)).
<a id="review-loop-exception-invalid"></a>
### `REVIEW_LOOP_EXCEPTION_INVALID`
+5
View File
@@ -415,6 +415,11 @@ export const RELEASE_RESULT_CODES = {
summary: 'the prose /ship is about to publish (a CHANGELOG entry or a PR body) carries an AI tell a regular expression can decide',
fix: 'rewrite each PROSE: line in the draft the way its hint says, then rerun gstack-prose-lint on the same file',
},
RECEIPT_BLOCKER_OPEN: {
anchor: 'receipt-blocker-open',
summary: 'the review loop stopped at this head with a blocking finding still open (a Step 9 or Step 11 finding, the second-model review included, whose newest review-log action is still open and no owner ruling closed), so no receipt is written',
fix: 'fix the finding and run /ship again on the new head, or take the stop to the owner, whose ruled note or grant closes it; never write the receipt by hand or drop the finding from the review-log row',
},
REVIEW_LOOP_EXCEPTION_INVALID: {
anchor: 'review-loop-exception-invalid',
summary: 'write --review-loop-exception got an exception that is malformed, accepts a stop the review loop does not show (a fix_check with review_loop.fix_checks 0 or missing, or a second_pass with fewer than two passes or no deferred finding), names a head that is not the receipt head or its ancestor, or is missing from the PR body',
+13 -4
View File
@@ -291,6 +291,8 @@ export interface ReviewLoopSummary {
est_input_tokens?: number;
/** Blocking findings no row gives a disposition (fixed, deferred, noted, skipped or a gate answer): found, outcome unrecorded. */
unrecorded?: number;
/** Blocking findings a row holds whose newest action is `open`, gate findings aside (GST-3075): the loop stopped with them unfixed, so write refuses the receipt (RECEIPT_BLOCKER_OPEN). Each is its ledger id or fingerprint, or both as `{ id, fingerprint }` so a ruling on either closes it. Only a later row's action clears it: an earlier `fixed`, a fix trailer or a fix-check ledger never does, since none of them shows the finding was fixed after it was raised again. */
open?: Array<string | { id: string; fingerprint: string }>;
/** Dispatch ledgers whose collected and judged findings were counted (gstack-review-dispatch). */
ledgers_read?: number;
/** What could not bind (GST-1168), each named with its reason: a row with no start token or readable time, a row finding's ledger_id no ledger holds, a Review-Finding trailer naming no finding. Never counted as zero silently. */
@@ -324,7 +326,9 @@ function rowTime(row: Record<string, any>): number {
export const LATE_DEFER_SKILL = 'review-late-defer';
/** A fix-check (one reviewer reading the touched hunks and the fix list) logs under its own skill, so it is never a pass. */
export const FIX_CHECK_SKILL = 'review-fix-check';
const DISPATCH_SKILLS = ['review', LATE_DEFER_SKILL, FIX_CHECK_SKILL, 'adversarial-review'];
/** Step 11's row (one per voice attempt): its findings count like a pass's (GST-3075), but it is never a pass or a round. */
export const VOICES_SKILL = 'adversarial-review';
const DISPATCH_SKILLS = ['review', LATE_DEFER_SKILL, FIX_CHECK_SKILL, VOICES_SKILL];
/** Dispatch records of one row: its `dispatches` array, else the specialists and Red Team its stats say ran (older rows). */
function rowDispatches(row: Record<string, any>): Array<{ role: string; bytes: number | null }> {
@@ -400,7 +404,7 @@ export function parseFixTrailers(commit: string, values: readonly string[]): Fix
*/
export function summarizeReviewLoop(rows: readonly Record<string, any>[], since: string, allLedgers: readonly (readonly LedgerBlocker[])[] = [], allPasses: readonly LedgerPass[] = [], trailers: readonly FixTrailer[] = []): ReviewLoopSummary {
const sinceMs = Date.parse(since);
const loopSkill = (r: Record<string, any>) => r.skill === 'review' || r.skill === LATE_DEFER_SKILL || r.skill === FIX_CHECK_SKILL;
const loopSkill = (r: Record<string, any>) => r.skill === 'review' || r.skill === LATE_DEFER_SKILL || r.skill === FIX_CHECK_SKILL || r.skill === VOICES_SKILL;
const inRun = (r: Record<string, any>) => r && r.via === 'ship' && Number.isFinite(rowTime(r)) && (!Number.isFinite(sinceMs) || rowTime(r) >= sinceMs);
const unbound: string[] = rows.filter(r => r && r.via === 'ship' && loopSkill(r) && !Number.isFinite(rowTime(r)))
.map(r => `row ${String(r.skill)} pass=${String(r.pass ?? '?')}: no start token and no readable timestamp, so it cannot be placed in this run`);
@@ -415,7 +419,7 @@ export function summarizeReviewLoop(rows: readonly Record<string, any>[], since:
const voided = [...voidedAt].map(i => `pass ${allPasses[i]!.name}: its ledger was never judged and no review-log row names it (an abandoned pass), so its ${allPasses[i]!.ids!.length} collected findings are left out`);
const ledgers = allLedgers.filter((_, i) => !voidedAt.has(i));
const ledgerPasses = allPasses.filter((_, i) => !voidedAt.has(i));
type Seen = { locus: string | null; raiser: string | null; classified: boolean; blocks: boolean; candidate: boolean; disposed: boolean; ledgerId?: string; fingerprint?: string };
type Seen = { locus: string | null; raiser: string | null; classified: boolean; blocks: boolean; candidate: boolean; disposed: boolean; action?: string; gate: boolean; ledgerId?: string; fingerprint?: string };
const seen = new Map<string, Seen>();
const deferred = new Set<string>();
const noted = new Set<string>();
@@ -438,6 +442,8 @@ export function summarizeReviewLoop(rows: readonly Record<string, any>[], since:
blocks: classified ? f.blocking : prior?.classified ? prior.blocks : !!prior?.blocks || rowBlocks(f),
candidate: !!prior?.candidate || f.severity === undefined || rank(f.severity) === 4 || rank(f.raw_severity) === 4 || f.blocking === true,
disposed: !!prior?.disposed || DISPOSITIONS.includes(f.action),
action: typeof f.action === 'string' ? f.action : prior?.action,
gate: !!prior?.gate || f.gate !== undefined,
...(ledgerId ?? prior?.ledgerId ? { ledgerId: ledgerId ?? prior?.ledgerId } : {}),
...(prior?.fingerprint ?? findingIdentity(f) ? { fingerprint: prior?.fingerprint ?? findingIdentity(f) } : {}),
});
@@ -484,6 +490,9 @@ export function summarizeReviewLoop(rows: readonly Record<string, any>[], since:
const unrecorded = ledgerOnlyKeys.length - ledgerOnlyFixed + blockers.filter(([, s]) => !s.disposed).length;
const out: ReviewLoopSummary = { passes: passes.length, blocking_found: blockers.length + ledgerOnlyKeys.length, deferred: deferred.size, noted: noted.size, fixed: fixed.size + ledgerOnlyFixed, scope };
if (unrecorded) out.unrecorded = unrecorded;
const open = blockers.filter(([, s]) => !s.gate && s.action === 'open')
.map(([k, s]) => s.ledgerId && s.fingerprint && s.ledgerId !== s.fingerprint ? { id: s.ledgerId, fingerprint: s.fingerprint } : s.ledgerId ?? s.fingerprint ?? k);
if (open.length) out.open = open;
if (ledgers.length) out.ledgers_read = ledgers.length;
if (unbound.length) out.unbound = unbound;
if (voided.length) out.voided = voided;
@@ -509,6 +518,6 @@ export function dispatchTotal(d: Record<string, number> | undefined): number | u
export function reviewLoopLine(s: ReviewLoopSummary): string {
const total = dispatchTotal(s.dispatches);
return `REVIEW_LOOP: passes=${s.passes} blocking_found=${s.blocking_found} deferred=${s.deferred} noted=${s.noted} fixed=${s.fixed} scope=${s.scope}`
+ (s.unrecorded ? ` unrecorded=${s.unrecorded}` : '') + (s.unbound?.length ? ` unbound=${s.unbound.length}` : '') + (s.ledgers_read ? ` ledgers_read=${s.ledgers_read}` : '')
+ (s.unrecorded ? ` unrecorded=${s.unrecorded}` : '') + (s.open?.length ? ` open=${s.open.length}` : '') + (s.unbound?.length ? ` unbound=${s.unbound.length}` : '') + (s.ledgers_read ? ` ledgers_read=${s.ledgers_read}` : '')
+ (s.fix_checks ? ` fix_checks=${s.fix_checks}` : '') + (total !== undefined ? ` dispatches=${total}` : '') + (s.est_input_tokens !== undefined ? ` est_input_tokens=${s.est_input_tokens}` : '');
}
+8
View File
@@ -496,6 +496,14 @@ export function carryReceipt(receipt: ShipReceipt, head: string, carry: CarryRec
return orderReceipt({ ...receipt, head, head_tree: at.tree, product_patch_id: at.productPatchId || 'none', carry: { ...merged, ...(trees.length ? { trees } : {}) } });
}
/** The `open` blockers of a `--review-loop` record (gstack-review-scope summary) that no owner ruling closes: write refuses a receipt while any is left (GST-3075). A ruling names the finding by its ledger id or its fingerprint, and with `onHead` counts only when its head is the receipt head or an ancestor of it. */
export function unruledOpenBlockers(loop: Record<string, unknown> | undefined, ruled: ReadonlyArray<{ finding: string; head?: string }>, onHead?: (head: string) => boolean): string[] {
const open = (Array.isArray(loop?.open) ? loop.open : []).flatMap((o: unknown) => typeof o === 'string' ? [{ id: o, names: [o] }]
: o && typeof o === 'object' && typeof (o as any).id === 'string' ? [{ id: (o as any).id as string, names: [(o as any).id, (o as any).fingerprint].filter((n): n is string => typeof n === 'string') }] : []);
const live = ruled.filter(n => !onHead || (typeof n.head === 'string' && onHead(n.head)));
return open.filter(o => !live.some(n => o.names.includes(n.finding))).map(o => o.id);
}
/** The loop counters the factory scorecard reads (passes, blocking_found, deferred), as `write --review-loop` records them. */
export type ReviewLoopReceipt = NonNullable<ShipReceipt['review_loop']>;
export function parseReviewLoop(value: unknown): ReviewLoopReceipt | undefined {
+4
View File
@@ -309,6 +309,10 @@ export const KNOWN_WINDOWS_INCOMPATIBLE: Array<{ file: string; reason: string }>
file: 'test/gstack-ship-receipt.test.ts',
reason: 'spawns bin/gstack-ship-receipt and bin/gstack-artifact (shebangs) plus a #!/bin/sh gh shim through test/helpers/restamp-fixture.ts',
},
{
file: 'test/ship-receipt-voice-blockers.test.ts',
reason: 'spawns bin/gstack-review-scope and bin/gstack-ship-receipt (shebangs) through test/helpers/restamp-fixture.ts runBin, like test/gstack-ship-receipt.test.ts',
},
// Field list 2, W1 (shared merge queue): same fixture helpers, same shebang spawns.
{
file: 'test/gstack-ship-queue.test.ts',
+8 -2
View File
@@ -208,7 +208,7 @@ its original token. If it never started because it was unavailable, disabled or
size-gated, omit \`--finish PASS_START\` and set completed/converged false.
Do not create or borrow a token just to save a result.
\`\`\`bash
~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","host":"${ctx.host}","outside_provider":"${outsideVoiceFor(ctx).id}","outside_status":"OUTSIDE_STATUS","phase":"PHASE","tier":"always","gate":"GATE","commit":"'"$(git rev-parse --short HEAD)"'","completed":COMPLETED,"converged":CONVERGED}' --finish PASS_START
~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review",${isShip ? '"via":"ship",' : ''}"timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","host":"${ctx.host}","outside_provider":"${outsideVoiceFor(ctx).id}","outside_status":"OUTSIDE_STATUS","phase":"PHASE","tier":"always","gate":"GATE","commit":"'"$(git rev-parse --short HEAD)"'","completed":COMPLETED,"converged":CONVERGED${isShip ? ',"findings":FINDINGS' : ''}}' --finish PASS_START
\`\`\`
PASS_START belongs to that attempt, not the parent's REVIEW_START. Each token is consumed once.
Fill fields from this attempt, not the parent's ${isShip ? 'Step 9.4' : 'Step 5.8'} result:
@@ -222,7 +222,13 @@ Fill fields from this attempt, not the parent's ${isShip ? 'Step 9.4' : 'Step 5.
a completed pass with findings, or "unavailable" for an incomplete pass.
- GATE is "informational" for adversarial passes. For structured review, use
"pass" or "fail" from its completed result, "skipped" when size-gated, or
"informational" with completed:false when coverage is missing.
"informational" with completed:false when coverage is missing.${isShip ? `
- FINDINGS is a JSON array, one record per finding this attempt raised, in Step 9.4's
shape (\`fingerprint\`, \`severity\`, \`blocking\`, \`raised_by\`, \`ledger_id\`) with ACTION
\`"open"\` for a blocker (CRITICAL, High or \`Blocks: yes\`) and \`"noted"\` below the floor;
\`[]\` when it raised none. The receipt counts these rows' blockers, and one still
\`open\` when the run stops (no later Step 9 row fixed or deferred it) makes
\`gstack-ship-receipt write\` refuse (\`RECEIPT_BLOCKER_OPEN\`).` : ''}
---`;
}
+7 -1
View File
@@ -260,7 +260,7 @@ its original token. If it never started because it was unavailable, disabled or
size-gated, omit `--finish PASS_START` and set completed/converged false.
Do not create or borrow a token just to save a result.
```bash
~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","host":"claude","outside_provider":"codex","outside_status":"OUTSIDE_STATUS","phase":"PHASE","tier":"always","gate":"GATE","commit":"'"$(git rev-parse --short HEAD)"'","completed":COMPLETED,"converged":CONVERGED}' --finish PASS_START
~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review","via":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","host":"claude","outside_provider":"codex","outside_status":"OUTSIDE_STATUS","phase":"PHASE","tier":"always","gate":"GATE","commit":"'"$(git rev-parse --short HEAD)"'","completed":COMPLETED,"converged":CONVERGED,"findings":FINDINGS}' --finish PASS_START
```
PASS_START belongs to that attempt, not the parent's REVIEW_START. Each token is consumed once.
Fill fields from this attempt, not the parent's Step 9.4 result:
@@ -275,6 +275,12 @@ Fill fields from this attempt, not the parent's Step 9.4 result:
- GATE is "informational" for adversarial passes. For structured review, use
"pass" or "fail" from its completed result, "skipped" when size-gated, or
"informational" with completed:false when coverage is missing.
- FINDINGS is a JSON array, one record per finding this attempt raised, in Step 9.4's
shape (`fingerprint`, `severity`, `blocking`, `raised_by`, `ledger_id`) with ACTION
`"open"` for a blocker (CRITICAL, High or `Blocks: yes`) and `"noted"` below the floor;
`[]` when it raised none. The receipt counts these rows' blockers, and one still
`open` when the run stops (no later Step 9 row fixed or deferred it) makes
`gstack-ship-receipt write` refuse (`RECEIPT_BLOCKER_OPEN`).
---
+2 -1
View File
@@ -274,7 +274,8 @@ files under `review_exclude_paths` changed it, which `--docs-post` binds (`REVIE
The summary reads this branch's review log for the invocation's passes (its
`REVIEW_LOOP:` line is the one the Pre-Landing Review section carries). Here every
finding reaches a row through Step 9.4; a run whose readers were collected by
finding reaches a row through Step 9.4 or Step 11's own row; a blocker still `open` there
makes write refuse (`RECEIPT_BLOCKER_OPEN`). A run whose readers were collected by
`gstack-review-dispatch` (ship/DRIVER.md) passes `--run <run dir>` instead. The `&&`
matters: a summary that refuses (no pass matched `REVIEW_SINCE`) must not let `write`
record a stale or empty loop file.
+2 -1
View File
@@ -257,7 +257,8 @@ files under `review_exclude_paths` changed it, which `--docs-post` binds (`REVIE
The summary reads this branch's review log for the invocation's passes (its
`REVIEW_LOOP:` line is the one the Pre-Landing Review section carries). Here every
finding reaches a row through Step 9.4; a run whose readers were collected by
finding reaches a row through Step 9.4 or Step 11's own row; a blocker still `open` there
makes write refuse (`RECEIPT_BLOCKER_OPEN`). A run whose readers were collected by
`gstack-review-dispatch` (ship/DRIVER.md) passes `--run <run dir>` instead. The `&&`
matters: a summary that refuses (no pass matched `REVIEW_SINCE`) must not let `write`
record a stale or empty loop file.
@@ -1 +1 @@
{"sha":"72d45950b82d885fea5aa67a05b516912f54e5080ceeb360cfad44380b282dd0","replay":"GST-1821"}
{"sha":"18b1627a6886fe2e0f0e6cc80a33ac2ee138ac2c8996f51bcb68a108f281acb6","replay":"GST-3075"}
+1
View File
@@ -0,0 +1 @@
{"replay":"GST-3075","justification":"GST-3075 (a /ship record counts the second-model review's blockers): ship/sections/adversarial.md changes only Step 11's review-log persistence prose for the lead, the gstack-review-log call that records each voice attempt (it now adds via:ship and a FINDINGS array) and one FINDINGS bullet saying what that array holds and that an open blocker makes gstack-ship-receipt write refuse. No reviewer reads that prose. Deterministic no-loss check, no paid run: every brief body lib/review-brief.ts cuts from the ship sections keeps its pinned hash (test/fixtures/review-pins/brief-bodies unchanged; test/review-packets-removed.test.ts 'every reviewer brief cut from the ship sections is byte-identical to its pinned body' passes at this tree). No reader, depth, dispatch, brief, checklist or finding rule changes; CREW rule 15 exempts non-reviewer /ship prose."}
+2 -2
View File
@@ -21,8 +21,8 @@ describe('late defers from Step 11', () => {
{ skill: 'adversarial-review', via: 'ship', timestamp: '2026-10-26T10:25:00Z', findings: [{ fingerprint: 'd:1:w', blocking: true, action: 'deferred' }] },
];
const s = summarizeReviewLoop(rows, '2026-10-26T09:30:00Z');
expect(s).toEqual({ passes: 2, blocking_found: 3, deferred: 2, noted: 0, fixed: 1, scope: 'frozen', rounds: 2 });
expect(reviewLoopLine(s)).toBe('REVIEW_LOOP: passes=2 blocking_found=3 deferred=2 noted=0 fixed=1 scope=frozen');
expect(s).toEqual({ passes: 2, blocking_found: 4, deferred: 3, noted: 0, fixed: 1, scope: 'frozen', rounds: 2 });
expect(reviewLoopLine(s)).toBe('REVIEW_LOOP: passes=2 blocking_found=4 deferred=3 noted=0 fixed=1 scope=frozen');
expect(LATE_DEFER_SKILL).toBe('review-late-defer');
// A `review` row logged without a start token would be the newest review row and read UNVERIFIED; the late-defer row is not a diff review at all.
expect(reviewFreshness(late, 'abc')).toBeUndefined();
+3 -3
View File
@@ -381,16 +381,16 @@ describe('gstack-review-scope (bin)', () => {
{ skill: 'review', timestamp: '2026-10-26T10:40:00Z', findings: [{ fingerprint: 'e:1:v', blocking: true, action: 'fixed' }] },
];
fs.writeFileSync(path.join(logDir, `${branch}-reviews.jsonl`), rows.map(r => JSON.stringify(r)).join('\n') + '\n{not json\n');
const expected = { passes: 2, blocking_found: 2, deferred: 1, noted: 1, fixed: 1, scope: 'frozen', rounds: 2 };
const expected = { passes: 2, blocking_found: 3, deferred: 1, noted: 1, fixed: 1, scope: 'frozen', unrecorded: 1, rounds: 2 };
const out = path.join(repo.root, 'review-loop.json');
const r = runBin(repo, 'gstack-review-scope', ['summary', '--no-ledger', '--since', '2026-10-26T09:30:00Z', '--out', out, '--json']);
expect(r.status).toBe(EXIT.ok);
expect(r.err).toContain('REVIEW_LOOP: passes=2 blocking_found=2 deferred=1 noted=1 fixed=1 scope=frozen');
expect(r.err).toContain('REVIEW_LOOP: passes=2 blocking_found=3 deferred=1 noted=1 fixed=1 scope=frozen unrecorded=1');
expect(JSON.parse(r.out)).toEqual(expected);
expect(JSON.parse(fs.readFileSync(out, 'utf8'))).toEqual(expected);
const plain = runBin(repo, 'gstack-review-scope', ['summary', '--no-ledger', '--since', '2026-10-26T08:00:00Z']);
expect(plain.status).toBe(EXIT.ok);
expect(plain.out.trim()).toBe('REVIEW_LOOP: passes=3 blocking_found=3 deferred=1 noted=1 fixed=2 scope=frozen');
expect(plain.out.trim()).toBe('REVIEW_LOOP: passes=3 blocking_found=4 deferred=1 noted=1 fixed=2 scope=frozen unrecorded=1');
const noSince = runBin(repo, 'gstack-review-scope', ['summary', '--json']);
expect(noSince.status).toBe(EXIT.fail);
expect(noSince.err).toContain('(REVIEW_SCOPE_INPUT;');
+104
View File
@@ -0,0 +1,104 @@
/**
* GST-3075: a /ship receipt written at a stopped head read blocking_found=0 while the second-model review's
* `Blocks: yes` findings had stopped the run. Step 11's voice findings reached no review-log row (only a later
* Step 9 row carries queued Step 11 records, and a run that stops after Step 11 logs none), so
* `gstack-review-scope summary --no-ledger` counted nothing and write recorded the undercount.
* Synthetic fixture: one clean Step 9 pass, then the Step 11 row as /ship now logs it.
*/
import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { EXIT } from '../lib/headless-artifacts';
import { summarizeReviewLoop } from '../lib/review-scope';
import { extractReceipt, unruledOpenBlockers } from '../lib/ship-receipt';
import { cleanup, makeFixtureRepo, runBin, type FixtureRepo } from './helpers/restamp-fixture';
setDefaultTimeout(60_000);
const repos: FixtureRepo[] = [];
afterEach(() => { while (repos.length) cleanup(repos.pop()!); });
const SINCE = '2026-11-18T01:00:00Z';
const at = (min: number) => new Date(Date.parse(SINCE) + min * 60_000).toISOString();
const FP = 'src/auth.ts:42:security';
const review = (min: number, pass: number, findings: object[]) => ({ skill: 'review', via: 'ship', timestamp: at(min), status: findings.length ? 'issues_found' : 'clean', review_scope: 'frozen', pass, findings });
const voices = (min: number, findings: object[]) => ({ skill: 'adversarial-review', via: 'ship', timestamp: at(min), status: 'issues_found', source: 'outside-voice', phase: 'adversarial', gate: 'informational', completed: true, findings });
const blocker = { fingerprint: FP, severity: 'CRITICAL', blocking: true, raised_by: 'outside-voice', action: 'open' };
const belowFloor = { fingerprint: FP, severity: 'INFORMATIONAL', blocking: false, raised_by: 'outside-voice', action: 'noted' };
function branchWith(rows: object[]): FixtureRepo {
const repo = makeFixtureRepo({ prefix: 'gst3075-' });
repos.push(repo);
repo.git('checkout', '-qb', 'feat');
const slug = runBin(repo, 'gstack-slug', ['--get', 'SLUG']).out.trim();
const logDir = path.join(repo.home, 'projects', slug);
fs.mkdirSync(logDir, { recursive: true });
fs.writeFileSync(path.join(logDir, 'feat-reviews.jsonl'), rows.map(r => JSON.stringify(r) + '\n').join(''));
return repo;
}
/** /ship Step 19's two commands: the summary (--no-ledger, as ship/sections/pr-body.md runs it), then write. */
function summaryThenWrite(repo: FixtureRepo) {
const loopFile = path.join(repo.root, 'review-loop.json');
const s = runBin(repo, 'gstack-review-scope', ['summary', '--since', SINCE, '--no-ledger', '--out', loopFile]);
expect(s.status).toBe(EXIT.ok);
const body = path.join(repo.root, 'body.md');
fs.writeFileSync(body, '## Summary\n');
const w = runBin(repo, 'gstack-ship-receipt', ['write', '--pr', '42', '--base', 'main', '--session-kind', 'unattended', '--review-loop', '@' + loopFile, '--body', body]);
return { loop: JSON.parse(fs.readFileSync(loopFile, 'utf8')), w, body: fs.readFileSync(body, 'utf8') };
}
describe('GST-3075: the receipt counts the voices\' blockers and refuses one still open', () => {
test('a Blocks: yes voice finding left open at the stop counts in blocking_found, and write refuses with RECEIPT_BLOCKER_OPEN', () => {
const { loop, w, body } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [blocker])]));
expect(loop).toMatchObject({ passes: 1, blocking_found: 1, rounds: 1, open: [FP] });
expect(w.status).toBe(EXIT.refused);
expect(w.err).toContain('(RECEIPT_BLOCKER_OPEN; ');
expect(w.err).toContain('docs/troubleshooting.md#receipt-blocker-open)');
expect(w.err).toContain(FP);
expect(w.out).toBe('');
expect(body).toBe('## Summary\n');
});
test('negative control: a Blocks: no voice finding leaves blocking_found at 0 and the receipt is written', () => {
const { loop, w } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [belowFloor])]));
expect(loop).toMatchObject({ passes: 1, blocking_found: 0 });
expect(loop.open).toBeUndefined();
expect(w.status).toBe(EXIT.ok);
expect(extractReceipt(w.out).receipt).toMatchObject({ review_loop: { passes: 1, blocking_found: 0 } });
});
test('a voice blocker the next Step 9 pass fixed counts once as found and fixed, and the receipt is written', () => {
const { loop, w } = summaryThenWrite(branchWith([review(0, 1, []), voices(20, [blocker]), review(40, 2, [{ ...blocker, action: 'fixed' }])]));
expect(loop).toMatchObject({ passes: 2, blocking_found: 1, fixed: 1, rounds: 2 });
expect(loop.open).toBeUndefined();
expect(w.status).toBe(EXIT.ok);
expect(extractReceipt(w.out).receipt).toMatchObject({ review_loop: { blocking_found: 1, fixed: 1 } });
});
test('a voice row is never a pass or a round, a deferred or gate finding is not open, and an owner ruling closes one', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [blocker, { fingerprint: 'a.ts:1:gate', severity: 'CRITICAL', blocking: true, gate: 'RH1', action: 'open' }]), { skill: 'review-late-defer', via: 'ship', timestamp: at(30), findings: [{ ...blocker, action: 'deferred' }] }], SINCE);
expect(s).toMatchObject({ passes: 1, rounds: 1, blocking_found: 2, deferred: 1 });
expect(s.open).toBeUndefined();
expect(unruledOpenBlockers({ open: [FP, 'p3/outside-voice#2'] }, [{ finding: FP }])).toEqual(['p3/outside-voice#2']);
expect(unruledOpenBlockers({ passes: 1 }, [])).toEqual([]);
});
test('a blocker a Step 9 row fixed and the next Step 11 row raised again stays open', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [blocker]), review(40, 2, [{ ...blocker, action: 'fixed' }]), voices(60, [blocker])], SINCE);
expect(s).toMatchObject({ passes: 2, blocking_found: 1, open: [FP] });
});
test('a fix trailer from before the Step 11 row that raised the blocker again does not close it', () => {
const rows = [review(0, 1, [{ ...blocker, action: 'fixed' }]), voices(20, [blocker])];
const s = summarizeReviewLoop(rows, SINCE, [], [], [{ finding: FP, reader: 'outside-voice', commit: 'a'.repeat(40) }]);
expect(s).toMatchObject({ blocking_found: 1, fixed: 1, open: [FP] });
expect(summarizeReviewLoop([...rows, review(40, 2, [{ ...blocker, action: 'fixed' }])], SINCE).open).toBeUndefined();
});
test('a ruling on the fingerprint closes a blocker that carries a ledger id, and a ruling at another head does not', () => {
const s = summarizeReviewLoop([review(0, 1, []), voices(20, [{ ...blocker, ledger_id: 'p1/outside-voice#1' }])], SINCE);
expect(s.open).toEqual([{ id: 'p1/outside-voice#1', fingerprint: FP }]);
expect(unruledOpenBlockers({ open: s.open }, [{ finding: FP, head: 'abc' }], h => h === 'abc')).toEqual([]);
expect(unruledOpenBlockers({ open: s.open }, [{ finding: FP, head: 'old' }], h => h === 'abc')).toEqual(['p1/outside-voice#1']);
});
});
@@ -0,0 +1,4 @@
{
"bytes": 613,
"why": "GST-3075: Step 11's row logs via ship and its findings, so a voice blocker left open at a stop counts and the receipt write refuses"
}