After a fix, the second review round is always a full review (#4783)

After a blocking fix, /ship's second review round is now always a full
review, with every reviewer recorded alongside the pass, instead of a
narrower re-check whose reply could go missing.

Why: the narrower re-check ran one reviewer outside the pass record, so
a missing reply or a blocker it found never reached the verdict. Part of
the /ship simplification Garry approved; nothing for readers to do.

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-24 08:52:13 +00:00
1 parent c34b967346
commit 7deee4292c
23 files changed
+216 -167

No files matched your search

+15 -10
View File
@@ -29,7 +29,7 @@ export const FULL_PASS_CAP = 2;
export const SMALL_DIFF_LINES = 50;
export const RED_TEAM_LINES = 200;
export const LARGE_DIFF_LINES = 100;
/** The largest fix range, in runtime lines, a pass 2 after a blocking fix reviews as a scoped pass (GSTA-152 D6); a starting value. */
/** The largest fix range, in runtime lines, whose full pass 2 after a blocking fix keeps the readers the retired scoped pass ran (GSTA-152 D6, GST-3562 part 3). */
export const SCOPED_RANGE_LINES = 150;
/** The checklists the batched specialist always reads on code and gate class, whatever the depth or scope (GSTA-167 part 2). */
export const LIGHT_FIXED: readonly Specialist[] = ['testing', 'security'];
@@ -412,14 +412,17 @@ export interface History {
* dispatch keeps one full-effort reader that excludes nothing (the reader the fix-check was). The table sets it; prCapped's
* spreads carry it; the dispatch reads it, never the reason text. readOnly marks the read-only final review: the dispatcher
* stages it on the PR's merge base whatever --diff-base the driver passes, and Step 3's edit guard applies no fix on it.
* rangeReaders (GST-3562 part 3): this full pass stands where main planned a scoped pass after a small blocking fix, so it
* also dispatches the readers that pass ran: the Red Team, and the native adversarial when the fix range has runtime lines,
* even after Step 11 ran it.
*/
export interface NextStep { step: Step; reason: string; keepReader?: true; readOnly?: true }
export interface NextStep { step: Step; reason: string; keepReader?: true; readOnly?: true; rangeReaders?: true }
/**
* The transition table (docs/review-policy.md#transitions). Pass 1 is full. A fixed
* blocking finding earns a second full pass on the range, scoped when `depth` (known
* only to planReview) is below full and the fix range has at most SCOPED_RANGE_LINES
* runtime lines; any other fix earns a full second pass on the range too, except a light pass whose fix range
* blocking finding earns a second full pass on the range, never a scoped pass (GST-3562 part 3); below full depth with at
* most SCOPED_RANGE_LINES runtime lines in the fix range it keeps the readers main's scoped pass ran (keepReader,
* rangeReaders); any other fix earns a full second pass on the range too, except a light pass whose fix range
* changes no runtime lines (GST-3562 A: no new fix-check is planned, and the step's keepReader keeps the full-effort reader
* the fix-check was); two rounds is the cap (R51), and capStep says what a fix after the cap gets.
* The cap limits fix rounds, not Step 11's voices: on gate class any stop waits for them (GST-967),
@@ -518,7 +521,7 @@ function loopStep(h: History, depth?: Depth): NextStep {
const keep = h.touchedGate ? 'a fix touched a gate-class path' : depth === undefined ? 'the depth is unknown' : h.pass1Depth === 'full' ? 'pass 1 ran at full depth' : depth === 'full' ? 'the diff is at full depth'
: typeof n !== 'number' || !Number.isFinite(n) || n < 0 ? 'the fix range was not read' : n > SCOPED_RANGE_LINES ? `the fix range has ${n} runtime lines (> ${SCOPED_RANGE_LINES})` : null;
if (keep) return { step: 'full', reason: `a blocking finding was fixed and ${keep}: full pass on the range` };
return { step: 'scoped', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range (<= ${SCOPED_RANGE_LINES}): scoped pass on the range` };
return { step: 'full', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range: full pass on the range, never a scoped pass, so every reader is in the pass record (GST-3562)`, keepReader: true, rangeReaders: true };
}
return { step: 'full', reason: 'below-floor fixes changed code after round 1: round 2 is a full pass on the range, never a fix-check (R51, GST-3562 A)', keepReader: true };
}
@@ -685,18 +688,20 @@ export function planReviewAt(i: PlanInput, table: (h: History, depth: Depth) =>
const raised = !full && (raise || runtimeLines <= SMALL_DIFF_LINES);
const lines = full ? i.diffLines : Math.max(runtimeLines, raised ? SMALL_DIFF_LINES : 0);
const checklists = batchChecklists(dcls, i, skipped);
if (checklists.length) add('specialist', 'batched', specialist, full ? [] : docsAndOutputs, { checklists });
const redTeam = dcls === 'gate' || (dcls === 'code' && (lines > RED_TEAM_LINES || !!i.criticalFound || raised));
if (checklists.length) add('specialist', 'batched', specialist, full || (next.rangeReaders && SPECIALISTS.some(forcedBy(i))) ? [] : docsAndOutputs, { checklists });
const redTeam = dcls === 'gate' || !!next.rangeReaders || (dcls === 'code' && (lines > RED_TEAM_LINES || !!i.criticalFound || raised));
if (redTeam) add('red-team', 'red-team', 'full');
else skipped.push(`red-team (${dcls} class${dcls === 'code' ? `, ${lines} runtime lines, no critical` : ''})`);
const codeLike = dcls === 'code' || dcls === 'gate';
const rangeAdversarial = !!next.rangeReaders && (h.rangeRuntimeLines ?? 0) > 0;
if (h.fullPasses === 0 || (!i.adversarialRan && codeLike)) {
if (codeLike) add('adversarial-native', 'adversarial', 'full');
if (codeLike || rangeAdversarial) add('adversarial-native', 'adversarial', 'full');
else skipped.push(`adversarial-native (${dcls} class)`);
if (codeLike || i.numbers.publishes) add('outside-voice', 'outside-voice', 'host');
else skipped.push(`outside-voice (${dcls} class, no numeric claims)`);
} else {
skipped.push('adversarial-native and outside-voice (run once per invocation)');
if (rangeAdversarial) add('adversarial-native', 'adversarial', 'full');
skipped.push(rangeAdversarial ? 'outside-voice (run once per invocation)' : 'adversarial-native and outside-voice (run once per invocation)');
if (numbersChanged) add('outside-voice', 'outside-voice (numbers changed)', 'host');
}
} else if (next.step === 'scoped') {
+3 -2
View File
@@ -135,7 +135,7 @@ const STAGE_OF: Record<string, Stage> = { specialist: 'specialists', 'fix-check'
export function buildManifest(o: {
pass: string; out: string; ledger: string; base: string; diffBase: string; root: string; checklistRoot: string;
dispatches: Array<Dispatch & { excerpt?: string[] }>; next: string; planLines: string[]; learnings?: string | null; extras?: Extra[];
targetedClasses?: readonly string[]; mergeBase?: string; rangeBase?: string; fixCheck?: FixCheckFiles; reviewExclude?: Record<string, unknown>; disclosure?: string; readers?: EffectiveReaders; voices?: boolean;
targetedClasses?: readonly string[]; mergeBase?: string; rangeBase?: string; voiceBase?: string; fixCheck?: FixCheckFiles; reviewExclude?: Record<string, unknown>; disclosure?: string; readers?: EffectiveReaders; voices?: boolean;
}): Manifest {
if (o.voices && o.extras?.length) throw new BriefError(`Step 11's voices pass sends no audit reader, so it takes no --extras: ${o.extras.map(e => e.name).join(', ')}`);
const readers: PassReader[] = [];
@@ -155,6 +155,7 @@ export function buildManifest(o: {
const keep = (d.keep ?? []).filter(s => !excerpt.includes(s));
readers.push({ reader, stage, title: `ship ${o.pass} ${reader}`, state: 'planned', role, name, effort: d.effort, exclude, checklists: d.checklists,
...(policy.length ? { policy_exclude: policy.map(shellQuote).join(' ') } : {}), ...(keep.length ? { keep } : {}), ...(excerpt.length ? { excerpt } : {}),
...((role === 'adversarial-native' || role === 'outside-voice') && o.voiceBase ? { diff_base: o.voiceBase } : {}),
...(role === 'targeted' ? { classes: [...(o.targetedClasses ?? [])], diff_base: o.mergeBase ?? o.diffBase } : {}),
...(role === 'adversarial-native' && d.classes?.length ? { classes: [...d.classes], diff_base: o.mergeBase ?? o.diffBase } : {}),
...(d.model === 'cross-family' ? { cross_family: true } : d.model && d.model !== 'lane' ? { model: { model_id: d.model } } : {}),
@@ -241,7 +242,7 @@ export function renderStage(m: Manifest, stage: Stage, t: SectionTexts, diffFor:
}
let slice: Record<string, unknown> = {};
if (role === 'outside-voice') {
const s = sliceDiff(diffFor(m.diff_base, r), REVIEW_DIFF_MAX_BYTES);
const s = sliceDiff(diffFor(r.diff_base ?? m.diff_base, r), REVIEW_DIFF_MAX_BYTES);
const diffFile = path.join(briefs, 'outside-voice.diff');
fs.writeFileSync(diffFile, s.text, { mode: 0o600 });
Object.assign(slots, { diff_file: diffFile, diff_bytes: String(s.bytes), diff_sha256: createHash('sha256').update(s.text).digest('hex'), ...(s.sliced ? { diff_slice: sliceNote(s, REVIEW_DIFF_MAX_BYTES) } : {}) });