Codex second-model reviews in /gstack-ship now count, and the shipping record carries them (GST-4148) (#4889)

When /gstack-ship's second-model review runs on Codex, the review record
now names the Codex model and its family, so it counts as a second-model
review instead of being recorded as unavailable.

Why: shipping records should say which second model reviewed a change;
Codex reviews were silently dropped from that record, and live records
never carried it.

Nothing to do: if Codex can't run, 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=state-machines
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p2/outside-voice#2 reader=outside-voice
Review-Finding: p2/outside-voice#4 reader=outside-voice
Review-Finding: p3/outside-voice#1 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-29 01:30:01 +00:00
1 parent a299100ed5
commit af9c235399
24 files changed
+189 -43

No files matched your search

+2 -2
View File
@@ -153,7 +153,7 @@ Outside prompt (supply repository context from the parent):
"${CODEX_BOUNDARY}Review the changes on this branch against the base branch. Use the supplied branch diff. If it was not supplied and you have repository tools, run DIFF_BASE=$(git merge-base origin/<base> HEAD) && git diff "$DIFF_BASE". Your job is to find ways this code will fail in production. Think like an attacker and a chaos engineer. Find edge cases, race conditions, security holes, resource leaks, failure modes, and silent data corruption paths. Be adversarial. Be thorough. No compliments — just the problems. A finding blocks only if it ${BLOCKING_FLOOR}; end each finding with \`Severity: Critical|High|Medium|Low\` and \`Blocks: yes|no\`. Then write ONE line in the canonical format \`Recommendation: <action> because <one-line reason naming the most exploitable finding>\`. Generic reasons like 'because it's safer' do not qualify; the reason must point to a specific finding or no-fix rationale. ${OUTSIDE_VERDICT_REQUEST}"
${!isShip && outsideVoiceFor(ctx).id === 'codex' ? outsideVoiceHelperInvocation(ctx, { pass: 'adversarial', gate: 'review' }) : outsideVoiceInvocation(ctx, { timeoutMs: 540000, nativeAlreadyRequired: isShip ? 'dispatched' : true, diffCommand: 'DIFF_BASE=$(git merge-base origin/<base> HEAD) && git diff "$DIFF_BASE"' })}
${!isShip && outsideVoiceFor(ctx).id === 'codex' ? outsideVoiceHelperInvocation(ctx, { pass: 'adversarial', gate: 'review' }) : outsideVoiceInvocation(ctx, { timeoutMs: 540000, nativeAlreadyRequired: isShip ? 'dispatched' : true, provenance: isShip, diffCommand: 'DIFF_BASE=$(git merge-base origin/<base> HEAD) && git diff "$DIFF_BASE"' })}
Present the full output verbatim. A Critical, High or \`Blocks: yes\` finding is CRITICAL; \`Blocks: no\` never lowers one, and only a named policy ground drops it. ${isShip ? 'An unavailable outside challenge does not block shipping by itself; supported findings still enter Step 11, and the structured P0/P1 and non-convergence gates still apply.' : 'This outside challenge is informational; supported findings still enter Step 5 Fix-First, whose approval and convergence gates apply.'}
@@ -172,7 +172,7 @@ function adversarialStructuredReview(ctx: TemplateContext, isShip: boolean): str
${isShip ? 'On \`DISPATCH: outside-voice\`, if' : 'If'} \`CODEX_MODE\` is \`ready\` or \`unverified\` and either \`DIFF_TOTAL >= 200\` or the user requested the override above:
${!isShip && outsideVoiceFor(ctx).id === 'codex' ? outsideVoiceHelperInvocation(ctx, { pass: 'structured', gate: 'structured', appendDiffBase: '<base>' }) : outsideVoiceInvocation(ctx, { timeoutMs: 540000, nativeAlreadyRequired: isShip ? 'dispatched' : true, gate: 'structured', diffCommand: 'DIFF_BASE=$(git merge-base <base> HEAD) && git diff "$DIFF_BASE"' })}
${!isShip && outsideVoiceFor(ctx).id === 'codex' ? outsideVoiceHelperInvocation(ctx, { pass: 'structured', gate: 'structured', appendDiffBase: '<base>' }) : outsideVoiceInvocation(ctx, { timeoutMs: 540000, nativeAlreadyRequired: isShip ? 'dispatched' : true, provenance: isShip, gate: 'structured', diffCommand: 'DIFF_BASE=$(git merge-base <base> HEAD) && git diff "$DIFF_BASE"' })}
${outsideVoiceFor(ctx).id === 'codex' ? '' : 'The Claude Code backend receives the parent-captured base diff, including committed and working-tree changes, because review mode cannot execute git.\n\n'}Present output under \`${outsideVoiceFor(ctx).label.toUpperCase()} SAYS (code review):\` inside a \`tool-output\` fence.
Only a completed response ending with its \`VERDICT:\` line establishes the gate. P0/P1 findings (\`[P0]\`/\`[P1]\` or native \`P0:\`/\`P1:\` labels; \`VERDICT: findings\`) → GATE: FAIL. Completed without P0/P1 → GATE: PASS. Refusal, failure, missing markers or \`OUTSIDE_STATUS: unverified\` → GATE: MISSING COVERAGE; no fix question.
+7 -3
View File
@@ -99,6 +99,8 @@ export interface OutsideCommandOptions {
nativeAlreadyRequired?: boolean | 'dispatched';
/** Resolve the plan-review policy once in the invocation shell and bind it through probe and dispatch. */
role?: OutsideRole;
/** /gstack-ship's dispatched voices: Codex's closing OUTSIDE_STATUS line names model= and family=, which collect needs to prove a second family (GST-4140). */
provenance?: boolean;
}
/** One self-contained shell body. No shell functions/variables survive between blocks. */
@@ -111,6 +113,8 @@ export function outsideVoiceCommand(ctx: TemplateContext, opts: OutsideCommandOp
// Every other gate lets run-with-timeout resolve GSTACK_CODEX_EFFORT, then codex_effort, then this default.
const effort = opts.reasoningEffort ?? 'high';
const pinnedEffort = opts.gate === 'spec';
const provenance = v.id === 'codex' && opts.provenance;
const status = (s: string) => provenance ? `"OUTSIDE_STATUS: ${s} provider=${v.id} host=${ctx.host} $_OUTSIDE_ID"` : `'OUTSIDE_STATUS: ${s} provider=${v.id} host=${ctx.host}'`;
const effortFlag = pinnedEffort ? ` -c 'model_reasoning_effort="${effort}"'` : '';
const codex = `codex exec - -C "$_REPO_ROOT" -s "${CODEX_SANDBOX_REF}" ${CODEX_MODEL_CONFIG_FLAG}${effortFlag} ${CODEX_WEB_SEARCH_FLAG} --json -o "$_OUTSIDE_TMP/text" <"$_OUTSIDE_INPUT"`;
const invocation = v.id === 'codex'
@@ -144,12 +148,12 @@ fi` : ''}
cat "$_OUTSIDE_TMP/stderr" >&2 || { [ "$_OUTSIDE_EXIT" -ne 0 ] || _OUTSIDE_EXIT=1; }
_OUTSIDE_RC=0
bun --no-env-file --config=/dev/null "${root}/lib/outside-review-result.ts" --label '${v.label} outside review' --exit "$_OUTSIDE_EXIT" --stderr "$_OUTSIDE_TMP/stderr" ${v.id === 'codex' ? '--events "$_OUTSIDE_TMP/events" ' : ''}${opts.purpose === 'design-direction' ? 'proposal' : opts.gate ?? 'review'} "$_OUTSIDE_TMP/text" || _OUTSIDE_RC=$?
${v.id === 'claude-code' ? '[ "$_OUTSIDE_RC" -eq 1 ] || cat "$_OUTSIDE_TMP/text" || exit 1\n' : ''}case "$_OUTSIDE_RC" in
${v.id === 'claude-code' ? '[ "$_OUTSIDE_RC" -eq 1 ] || cat "$_OUTSIDE_TMP/text" || exit 1\n' : ''}${provenance ? `_OUTSIDE_ID="model=$_CODEX_SEL family=$("${bin}/gstack-outside-voice" family "$_CODEX_SEL" 2>/dev/null || echo unknown)"\n` : ''}case "$_OUTSIDE_RC" in
0|3) ;;
4) echo 'OUTSIDE_STATUS: unverified provider=${v.id} host=${ctx.host}'; exit 4 ;;
4) echo ${status('unverified')}; exit 4 ;;
*) [ "$_OUTSIDE_EXIT" -ne 0 ] && exit "$_OUTSIDE_EXIT"; exit 1 ;;
esac
echo 'OUTSIDE_STATUS: completed provider=${v.id} host=${ctx.host}'`;
echo ${status('completed')}`;
}
/** The reviewer's required last line: lib/outside-review-result.ts reads a review clean only from it. */