/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

+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 {