Code changes get a second-model review of their final fixes, and the shipping record names that model's family (GST-4140) (#4886)

When a code change's first review leads to fixes, the second-model
review now reads those fixes and the final review again, instead of
being skipped once it had run.

A reviewer from the same model family as the author (a Claude reader
checking Claude's work) no longer counts as the second model, and the
review record names the model family that reviewed.

Nothing to do: when the second model can't run (Codex down, rate-limited
or refused), that is still recorded and never blocks shipping.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: s11/outside-voice#1 reader=outside-voice
Review-Finding: s11/outside-voice#2 reader=outside-voice
Review-Finding: s11/outside-voice#3 reader=outside-voice
Review-Finding: s11/outside-voice#4 reader=outside-voice
Review-Finding: s11/adversarial-native#1 reader=adversarial-native
Review-Finding: s11/adversarial-native#2 reader=adversarial-native
Review-Finding: s11/adversarial-native#3 reader=adversarial-native
Review-Finding: s11/adversarial-native#5 reader=adversarial-native
Review-Finding: s11/adversarial-native#7 reader=adversarial-native
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-28 22:51:30 +00:00
1 parent 942a12c618
commit 4a40464ea7
20 files changed
+557 -38

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
/**
* GST-4140's no-loss replay. After Step 11 ran (--adversarial-ran), a later full pass on a code or gate diff at standard or full
* depth lists the outside voice again, and the read-only final review of such a diff lists the native adversarial again too, so
* the final head never ships without a second-model read. Main dropped both as "run once per invocation". The change only adds
* readers: asMainBeforeGst4140 checks each added reader is exactly one of these and reads the plan back as main's, so every grid
* frozen to an older main keeps its hash.
* outside: the full pass lists `outside-voice` at the host effort where main listed none, or listed it only as
* `outside-voice (numbers changed)` (read back under that name). A pass 2 whose fix range changes no runtime lines adds no
* outside voice: it plans main's readers and only words its skip line apart.
* adversarial: the read-only final review lists one more `adversarial-native` at full effort, after every reader main listed.
*/
import { expect } from 'bun:test';
import type { PlanInput, ReviewPlan } from '../../lib/review-depth';
export type Gst4140Kind = 'outside' | 'outside+adversarial';
export function asMainBeforeGst4140(input: PlanInput, plan: ReviewPlan): { plan: ReviewPlan; kind?: Gst4140Kind } {
const h = input.history;
const dcls = plan.stepDepth === 'full' ? 'gate' : plan.class;
if (!(plan.mode === 'panel' && plan.next.step === 'full' && plan.stepDepth !== 'light' && h.fullPasses > 0 && input.adversarialRan && (dcls === 'code' || dcls === 'gate'))) return { plan };
const range = !!plan.next.rangeReaders && (h.rangeRuntimeLines ?? 0) > 0;
const final = !!plan.next.readOnly && !range;
const numbersChanged = input.numbers.publishes && input.reviewedNumbers !== undefined && input.reviewedNumbers !== input.numbers.fingerprint;
const added = final || h.rangeRuntimeLines !== 0;
const outside = plan.dispatches.filter(d => d.role === 'outside-voice');
expect([h, outside.map(d => `${d.name}:${d.effort}`)]).toEqual([h, added ? ['outside-voice:host'] : numbersChanged ? ['outside-voice (numbers changed):host'] : []]);
let dispatches = !added ? plan.dispatches : plan.dispatches.flatMap(d => d.role !== 'outside-voice' ? [d] : numbersChanged ? [{ ...d, name: 'outside-voice (numbers changed)' }] : []);
if (final) {
const last = dispatches.map(d => d.role).lastIndexOf('adversarial-native');
expect([h, dispatches.filter(d => d.role === 'adversarial-native').length, dispatches[last]?.effort, dispatches.slice(last + 1).every(d => d.role === 'targeted')]).toEqual([h, 1, 'full', true]);
dispatches = [...dispatches.slice(0, last), ...dispatches.slice(last + 1)];
}
const quiet = 'outside-voice (run once per invocation: the fix range changes no runtime lines)';
const skipped = plan.skipped.filter(s => s !== 'adversarial-native (run once per invocation)' && s !== quiet);
expect([h, plan.skipped.length - skipped.length]).toEqual([h, (range || final ? 0 : 1) + (!added && !numbersChanged ? 1 : 0)]);
const at = skipped.indexOf('targeted (already read this product patch)');
const was = range ? 'outside-voice (run once per invocation)' : 'adversarial-native and outside-voice (run once per invocation)';
return { plan: { ...plan, dispatches, skipped: at < 0 ? [...skipped, was] : [...skipped.slice(0, at), was, ...skipped.slice(at)] }, ...(added ? { kind: final ? 'outside+adversarial' as const : 'outside' as const } : {}) };
}