/ship on Codex starts its audits with Codex's own subagent tools, not Claude Code's (#4476) (#4489)

On Codex, /ship and the other skills now start audit and reviewer
subagents with Codex's own `spawn_agent` and wait on `wait_agent`,
instead of Claude Code's Agent tool, which Codex can't call.

Why: Codex's /ship stopped at the Step 7 coverage audit and never
finished (#4476).

Codex users need `multi_agent = true` under `[features]` in
`~/.codex/config.toml`.

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-18 15:48:59 +00:00
1 parent 782f4595ed
commit fda9dea79f
11 files changed
+127 -27

No files matched your search

+3 -2
View File
@@ -4,6 +4,7 @@ import { FREE_TEXT_WRITE_RULE, freeTextFileBash } from './free-text-file';
import { binaryAssignment } from './runtime-root';
import { usesLazySections } from './sections';
import { AI_SLOP_BLACKLIST, OPENAI_HARD_REJECTIONS, OPENAI_LITMUS_CHECKS, CC_BACKGROUND_DEFAULT_SINCE, FOREGROUND_IF_AVAILABLE, BACKGROUND_RECOVERY } from './constants';
import { CODEX_SUBAGENT_CALL } from '../../hosts/codex';
import { OVERUSED_FONTS_DISPLAY, BANNED_FONTS, FONTS_BODY_UI_OK, FONTS_MONO_OK, FONTS_VERIFIED_FREE, HANDOFF_COMMANDS, selectCatalog, catalogEntries, renderCatalog, detectorSlopEntries, judgmentTellEntries } from '../../lib/design-catalog';
import { SENTINEL, DETECT_EXIT_ECHO, DETECT_LIMITS } from '../../lib/design-detect-contract';
import { DOM_DUMP_FILE } from '../../lib/dom-dump-script';
@@ -619,7 +620,7 @@ ${outsideVoiceInvocation(ctx, { timeoutMs: 300000, reasoningEffort: 'medium', pu
${outsideVoiceProvenance(ctx, 'design-sketch')}
2. **${outsideVoiceFor(ctx).nativeLabel} subagent** (via Agent tool, ${FOREGROUND_IF_AVAILABLE} — subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}; ${BACKGROUND_RECOVERY}):
2. **${outsideVoiceFor(ctx).nativeLabel} subagent** (${ctx.host === 'codex' ? `via ${CODEX_SUBAGENT_CALL}` : `via Agent tool, ${FOREGROUND_IF_AVAILABLE} — subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}; ${BACKGROUND_RECOVERY}`}):
"For this product approach, what design direction would you recommend? What aesthetic, typography, and interaction patterns fit? What would make this approach feel inevitable to the user? Be specific — font names, hex colors, spacing values. Do not fall back on these defaults: a cream ground with a high-contrast serif and terracotta accent; near-black with one neon accent and glowing edges; italic accent words inside headlines; numbered 01 / 02 / 03 section labels; tiny tracked monospace labels; pill-shaped buttons. If your first idea is one of these, name it and choose again."
Present ${outsideVoiceFor(ctx).label} output under \`${outsideVoiceFor(ctx).label.toUpperCase()} SAYS (design sketch):\` and subagent output under \`${outsideVoiceFor(ctx).nativeLabel.toUpperCase()} SUBAGENT (design direction):\`.
@@ -795,7 +796,7 @@ Prompt (include the actual plan/product/frontend source context, not only file p
${outsideVoiceInvocation(ctx, { timeoutMs: 300000, reasoningEffort, ...(isDesignConsultation ? { purpose: 'design-direction' as const } : {}), ...(isPlanDesignReview ? { role: 'plan-review' as const } : {}) })}
2. **${outsideVoiceFor(ctx).nativeLabel} design subagent** (Agent tool, ${FOREGROUND_IF_AVAILABLE}; await its result. ${BACKGROUND_RECOVERY}):
2. **${outsideVoiceFor(ctx).nativeLabel} design subagent** (${ctx.host === 'codex' ? `via ${CODEX_SUBAGENT_CALL}` : `Agent tool, ${FOREGROUND_IF_AVAILABLE}; await its result. ${BACKGROUND_RECOVERY}`}):
"${subagentPrompt}"
**Error handling (all non-blocking):**
+20 -13
View File
@@ -14,6 +14,7 @@
*/
import { toShellPath, type TemplateContext } from './types';
import { CC_BACKGROUND_DEFAULT_SINCE, FOREGROUND_IF_AVAILABLE, BACKGROUND_RECOVERY } from './constants';
import { CODEX_SUBAGENT_DISPATCH } from '../../hosts/codex';
import { outsideVoiceFailurePolicy, outsideVoiceFor, outsideVoiceInvocation, outsideVoicePreflight, outsideVoiceProvenance, OUTSIDE_VERDICT_REQUEST } from './outside-voice';
import { runtimeRootPrelude } from './runtime-root';
import { DEFENSIVE_REVIEW_FRAMING, fixtureSummaryMode } from './defensive-review';
@@ -72,7 +73,7 @@ On any ${outsideVoiceFor(ctx).label} error, fall back to the ${outsideVoiceFor(c
**If preflight is not ready (or ${outsideVoiceFor(ctx).label} errored):**
Dispatch via the Agent tool with ${FOREGROUND_IF_AVAILABLE} (subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}; the findings must land before the workflow continues). ${BACKGROUND_RECOVERY} The subagent has fresh context and no conversation bias — but it is the same harness; model identity stays unknown unless the runtime reports it; weigh its agreement accordingly.
${ctx.host === 'codex' ? `Dispatch via ${CODEX_SUBAGENT_DISPATCH}.` : `Dispatch via the Agent tool with ${FOREGROUND_IF_AVAILABLE} (subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}; the findings must land before the workflow continues). ${BACKGROUND_RECOVERY}`} The subagent has fresh context and no conversation bias — but it is the same harness; model identity stays unknown unless the runtime reports it; weigh its agreement accordingly.
Subagent prompt: same mode-appropriate prompt as above (Startup or Builder variant).
@@ -127,7 +128,7 @@ reads, not when it saves its result. Include non-ignored untracked source in eac
reviewer's context or read instructions (\`git ls-files --others --exclude-standard\`).
Those files are part of the recorded content too.
Dispatch via the Agent tool with ${FOREGROUND_IF_AVAILABLE} (background is the default since ${CC_BACKGROUND_DEFAULT_SINCE}); findings must arrive before review concludes. ${BACKGROUND_RECOVERY} Fresh context avoids checklist bias, but this is the same harness, not an independent model unless runtime identity proves otherwise.
${ctx.host === 'codex' ? `Dispatch via ${CODEX_SUBAGENT_DISPATCH}.` : `Dispatch via the Agent tool with ${FOREGROUND_IF_AVAILABLE} (background is the default since ${CC_BACKGROUND_DEFAULT_SINCE}); findings must arrive before review concludes. ${BACKGROUND_RECOVERY}`} Fresh context avoids checklist bias, but this is the same harness, not an independent model unless runtime identity proves otherwise.
Subagent prompt:
"${DEFENSIVE_REVIEW_FRAMING}
@@ -468,6 +469,21 @@ A native result never supplies outside coverage.`}`}`;
}
function codexPlanBoundedWait(ctx: TemplateContext, ceo: boolean, needsApprovalReadiness: boolean): string {
const unavailable = `**Unavailable path:** "Outside voice unavailable: <cause>. Fix: <fix>. Continuing to ${needsApprovalReadiness ? 'planning decisions and Approval readiness' : 'outputs'}. (OUTSIDE_VOICE_UNAVAILABLE)"
The cause adds to the provider's diagnosis: ${ctx.host === 'codex' ? 'Codex has no read-only native subagent' : `Plan agent type not offered, TaskStop not offered,
background tasks unavailable${ctx.host === 'claude' ? ' (fix: Claude Code 2.1.277+, background tasks on)' : ''}, no complete report within five minutes, or a failed status`}.
Do not retry with a general-purpose agent. Report missing outside-voice coverage.
Ignore partial or late results for critique, agreement, clean status or coverage.
${ceo ? 'Skip Integrate reviewer findings and Cross-model tension.' : 'Skip Cross-model tension.'} Persist an unavailable result using the command below
with STATUS = "unavailable", SOURCE = "none", OUTSIDE_STATUS = "unavailable", adding \`"unavailable_reason":"<cause>"\`;
then continue directly to ${needsApprovalReadiness ? 'the remaining planning decisions and Approval readiness' : 'outputs'}.
Do not record a clean review when no reviewer completed.
`;
if (ctx.host === 'codex') return `**Bounded outside-voice wait:** Codex offers no read-only Plan subagent type and no
host timer to stop, so take the unavailable path without launching a native subagent.
A native result never supplies outside coverage.
${unavailable}`;
return `**Bounded outside-voice wait — one five-minute host timer:**
Before dispatch, check this session's tools for TaskStop, Bash's \`run_in_background\`
@@ -500,16 +516,7 @@ Execute the four steps once:
Record each stop result; if one fails, cancellation is unconfirmed.
For a completion after the timer or TaskStop, still give no late-result credit.
**Unavailable path:** "Outside voice unavailable: <cause>. Fix: <fix>. Continuing to ${needsApprovalReadiness ? 'planning decisions and Approval readiness' : 'outputs'}. (OUTSIDE_VOICE_UNAVAILABLE)"
The cause adds to the provider's diagnosis: Plan agent type not offered, TaskStop not offered,
background tasks unavailable${ctx.host === 'claude' ? ' (fix: Claude Code 2.1.277+, background tasks on)' : ''}, no complete report within five minutes, or a failed status.
Do not retry with a general-purpose agent. Report missing outside-voice coverage.
Ignore partial or late results for critique, agreement, clean status or coverage.
${ceo ? 'Skip Integrate reviewer findings and Cross-model tension.' : 'Skip Cross-model tension.'} Persist an unavailable result using the command below
with STATUS = "unavailable", SOURCE = "none", OUTSIDE_STATUS = "unavailable", adding \`"unavailable_reason":"<cause>"\`;
then continue directly to ${needsApprovalReadiness ? 'the remaining planning decisions and Approval readiness' : 'outputs'}.
Do not record a clean review when no reviewer completed.
`;
${unavailable}`;
}
function codexPlanCrossModelTension(ctx: TemplateContext): string {
@@ -740,7 +747,7 @@ On \`CODEX_MODE: ${outsideVoiceFor(ctx).id === 'codex' ? 'under_codex' : 'under_
\`outside_status: unavailable\`, run no outside CLI, and use the native subagent below.
A native result never supplies outside coverage.
Dispatch via the Agent tool with the same prompt, passing ${FOREGROUND_IF_AVAILABLE} (subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}). ${BACKGROUND_RECOVERY} Bound it at a 5-minute timeout; if it never completes, treat the review as unavailable and continue.
${ctx.host === 'codex' ? `Dispatch the same prompt via ${CODEX_SUBAGENT_DISPATCH}.` : `Dispatch via the Agent tool with the same prompt, passing ${FOREGROUND_IF_AVAILABLE} (subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}). ${BACKGROUND_RECOVERY}`} Bound it at a 5-minute timeout; if it never completes, treat the review as unavailable and continue.
Present findings under \`DOCUMENTATION REVIEW (${outsideVoiceFor(ctx).nativeLabel} subagent):\`. If it fails: "Doc review unavailable. Continuing to Step 9." Skip the apply gate, persist \`status: unavailable\`, \`outside_status: unavailable\`, and \`source: none\` below, then continue; unavailable is not a clean review.
**Apply decision (informational, never auto-edit, but findings don't evaporate).**
+7 -5
View File
@@ -6,6 +6,7 @@
import { type TemplateContext } from './types';
import { generateInvokeSkill } from './composition';
import { CC_BACKGROUND_DEFAULT_SINCE, FOREGROUND_IF_AVAILABLE, BACKGROUND_RECOVERY } from './constants';
import { CODEX_SUBAGENT_DISPATCH } from '../../hosts/codex';
import { DESIGN_DOC_DISCOVERY_BLOCK } from './design-doc-discovery';
export function generateAntiShortcutClause(_ctx: TemplateContext): string {
@@ -23,7 +24,7 @@ Never skip sections or the terminal report. Do not invent a question merely beca
return `**Anti-shortcut clause:** The plan file records the interactive review; it cannot replace it. Take each non-trivial finding through AskUserQuestion, wait for the answer, and apply only the accepted choice before writing it into the plan. Only a review with zero findings in every section reaches ExitPlanMode without asking. Never skip sections or the terminal report.`;
}
function generateOfficeHoursSpecReviewLoop(): string {
function generateOfficeHoursSpecReviewLoop(host: string): string {
return `## Spec Review Loop
Run an adversarial review before presenting the final document to the user.
@@ -57,8 +58,9 @@ rounds 2 and 3 are delta re-reviews of the exact design diff since the last roun
so prepare every round in the same review directory and do not edit the design
between prepare and its review.
Use the Agent tool with ${FOREGROUND_IF_AVAILABLE} and its returned \`dispatch\`
string unchanged as the prompt. ${BACKGROUND_RECOVERY} The reviewer must Read the entire prepared prompt
${host === 'codex' ? `Start the reviewer with ${CODEX_SUBAGENT_DISPATCH}. Give it the returned \`dispatch\`
string unchanged as the prompt.` : `Use the Agent tool with ${FOREGROUND_IF_AVAILABLE} and its returned \`dispatch\`
string unchanged as the prompt. ${BACKGROUND_RECOVERY}`} The reviewer must Read the entire prepared prompt
file before reviewing the design. Do not recreate the prompt, copy selected fields,
or summarize prior findings. A parent Read does not deliver the file to the reviewer.
The reviewer has fresh context and cannot see the brainstorming conversation.
@@ -147,7 +149,7 @@ reviewer-confirmed resolutions. An unavailable score is null, never invented.`;
}
export function generateSpecReviewLoop(_ctx: TemplateContext): string {
if (_ctx.skillName === 'office-hours') return generateOfficeHoursSpecReviewLoop();
if (_ctx.skillName === 'office-hours') return generateOfficeHoursSpecReviewLoop(_ctx.host);
const ceo = _ctx.skillName === 'plan-ceo-review';
return `${ceo ? '####' : '##'} Spec Review Loop
@@ -156,7 +158,7 @@ ${ceo ? 'Use 0D for any new or reopened amendment discovered by the reviewer. Th
**Step 1: Dispatch reviewer subagent**
${ceo ? `Read Agent's tool definition. Set \`run_in_background: false\` if that field is available; omit it otherwise. Launch one reviewer with both inputs below.
${_ctx.host === 'codex' ? `Launch one reviewer with both inputs below through ${CODEX_SUBAGENT_DISPATCH}. While waiting, do not advance, edit ${ceo ? 'either input' : 'the document'} or launch another reviewer.${ceo ? '' : '\nThe reviewer has fresh context: only the document, not the conversation.'}` : ceo ? `Read Agent's tool definition. Set \`run_in_background: false\` if that field is available; omit it otherwise. Launch one reviewer with both inputs below.
If the result contains a completed review, consume it. If it returns a pending task, use the host's wait tool. With no wait tool, end this response and resume on its completion notification. While waiting, do not advance, edit either input or launch another reviewer.` : `Use Agent with JSON boolean \`run_in_background: false\`, never string \`"false"\`.
Subagents default to background since ${CC_BACKGROUND_DEFAULT_SINCE}. Async launch metadata