From fda9dea79f131d7731259b9275fc82c04387ca37 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 18 Nov 2026 23:48:59 +0800 Subject: [PATCH] /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> --- ...dex-ship-starts-audits-with-spawn-agent.md | 4 +++ docs/hosts.md | 12 +++++++ hosts/codex.ts | 25 ++++++++++++++ scripts/resolvers/design.ts | 5 +-- scripts/resolvers/outside-voice-steps.ts | 33 +++++++++++-------- scripts/resolvers/spec-review.ts | 12 ++++--- test/fixtures/skill-md-size-allowlist.json | 10 +++--- test/host-config.test.ts | 25 ++++++++++++++ test/outside-voice-native-deadline.test.ts | 16 +++++++++ test/run-in-background-guidance.test.ts | 5 +++ test/skill-ceo-section-ordering.test.ts | 7 ++-- 11 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 changelog.d/codex-ship-starts-audits-with-spawn-agent.md diff --git a/changelog.d/codex-ship-starts-audits-with-spawn-agent.md b/changelog.d/codex-ship-starts-audits-with-spawn-agent.md new file mode 100644 index 000000000..5ca75257a --- /dev/null +++ b/changelog.d/codex-ship-starts-audits-with-spawn-agent.md @@ -0,0 +1,4 @@ +--- +important: blocker +--- +- **/ship on Codex no longer stops at the test coverage audit.** The Codex version of /ship told Codex to start its audit with Claude Code's Agent tool, `subagent_type` and `run_in_background`, which Codex doesn't have, so the run stopped before it could finish (#4476). Codex skills now start every audit and reviewer subagent with Codex's own `spawn_agent` and wait on `wait_agent` for its final result: /ship's coverage, plan and docs audits, the native review voices in /review, /office-hours and the design reviews, the plan-CEO spec review, /autoplan's phases and /context-restore. Turn on `multi_agent = true` under `[features]` in `~/.codex/config.toml`; without it the dispatch fails and the step takes its failure path. The plan reviews' timed fallback reviewer needs a read-only subagent type Codex doesn't offer, so on Codex it reports the second-model review as unavailable instead of starting one. Claude Code's and every other host's instructions are unchanged. diff --git a/docs/hosts.md b/docs/hosts.md index 1138610ae..2a2e6e303 100644 --- a/docs/hosts.md +++ b/docs/hosts.md @@ -224,6 +224,18 @@ or name a model in your request to override it for the invocation, including resumed consultations. See [eval defaults and overrides](../CONTRIBUTING.md#testing--evals) for capture, judge, and benchmark model selection. +**Subagents on Codex.** Codex has no Agent tool, so the Codex skills start every +audit and reviewer subagent (/ship's coverage, plan and docs audits, the native +review voices) with Codex's `spawn_agent` and wait on `wait_agent` until it reports +a final status. Turn multi-agent on first: `multi_agent = true` under `[features]` +in `~/.codex/config.toml`. Without it the dispatch fails and the step takes its +documented failure path. Codex has no read-only Plan subagent type, so when the +plan reviews' outside voice is unavailable they report it unavailable instead of +starting a native fallback. /ship's review record still only counts a reviewer +whose brief gstack itself sent: a reviewer started some other way has no recorded +send, so `gstack-review-dispatch verify` reports its brief `NOT_SENT` and prints +`VERIFY: dirty` (exit 1) rather than trusting it. + ## The design binary's models The design binary (`$D`) uses OpenAI's `gpt-5.5` by default, with image diff --git a/hosts/codex.ts b/hosts/codex.ts index d1ffcc6ad..ce8f19270 100644 --- a/hosts/codex.ts +++ b/hosts/codex.ts @@ -1,5 +1,15 @@ import { defineHost, GBRAIN_RESOLVERS } from './define-host'; +/** + * Codex's own subagent lifecycle (#4476). Codex has no Agent tool, subagent types, + * run_in_background or TaskStop: it starts a child with spawn_agent and blocks on + * wait_agent. Resolver dispatch sites render these on Codex; the toolRewrites below + * carry them into the template sites. Kept here because setup loads hosts/ alone. + */ +export const CODEX_SUBAGENT_DISPATCH = "Codex's `spawn_agent` (`fork_turns: \"none\"`), then `wait_agent` until a final status (a timeout is not one); its final message is the result. Without `spawn_agent`, the dispatch failed"; +/** The same call where a step only names it inline. */ +export const CODEX_SUBAGENT_CALL = "Codex's `spawn_agent`, then `wait_agent` for its final message"; + const codex = defineHost({ name: 'codex', displayName: 'OpenAI Codex CLI', @@ -44,6 +54,21 @@ const codex = defineHost({ // Outside-review resolvers route to Claude Code; Review Army has its own restriction. suppressedResolvers: ['REVIEW_ARMY', ...GBRAIN_RESOLVERS], + // #4476: Codex has no Agent tool. The template sites that spell out Claude Code's + // Agent call, and {{FOREGROUND_DISPATCH_NOTE}}, become Codex's spawn_agent and + // wait_agent; resolver sites render CODEX_SUBAGENT_DISPATCH themselves. test/host-config.test.ts fails on any left over. + toolRewrites: { + '**Foreground required:** pass `run_in_background: false` when available on the Agent call — subagents run in the background by default since Claude Code v2.1.198, so omitting an available flag gives a background run. A launch receipt means it went background: await its completion notice. Dispatch through the Agent tool only:': `**Wait for the result:** start the subagent with ${CODEX_SUBAGENT_DISPATCH}. Dispatch through \`spawn_agent\` only:`, + 'use the Agent tool with `run_in_background: false`.\nOmitting the flag runs the subagent in the background. The explicit flag waits\nfor a result while keeping a fresh context.': `start each subagent with ${CODEX_SUBAGENT_DISPATCH}.`, + 'Agent with `subagent_type: "general-purpose"` and\n`run_in_background: false`': "Codex's `spawn_agent`, then `wait_agent`", + 'using Agent, `subagent_type: "general-purpose"`\nand `run_in_background: false`': "using Codex's `spawn_agent`, then `wait_agent`", + 'one read-only Agent (`subagent_type: "general-purpose"`,\n `run_in_background: false`)': "one read-only subagent (Codex's `spawn_agent`, then `wait_agent`)", + 'with the Agent tool (never Skill),\n`subagent_type: "general-purpose"`.': "with Codex's `spawn_agent` (never Skill).", + 'Claude Code: set Agent `run_in_background: false` if its schema exposes it.\n A launch receipt means it went background: await its completion notice.\n Other hosts: foreground; await completion when supported.': 'Codex: `spawn_agent` sends the Agent prompt below; then `wait_agent` until its final status.', + '(via Agent tool):': "(via Codex's `spawn_agent`):", + 'through the Agent tool (a plain Read': "through Codex's `spawn_agent` and `wait_agent` (a plain Read", + }, + transcripts: { root: '~/.codex/sessions///
/rollout-*.jsonl', layout: 'dated rollout files from every workspace on the machine; the first line of each names its cwd', diff --git a/scripts/resolvers/design.ts b/scripts/resolvers/design.ts index bde70c974..7e1cee069 100644 --- a/scripts/resolvers/design.ts +++ b/scripts/resolvers/design.ts @@ -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):** diff --git a/scripts/resolvers/outside-voice-steps.ts b/scripts/resolvers/outside-voice-steps.ts index 0fa4ee266..5304ed9d1 100644 --- a/scripts/resolvers/outside-voice-steps.ts +++ b/scripts/resolvers/outside-voice-steps.ts @@ -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: . 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":""\`; +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: . 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":""\`; -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).** diff --git a/scripts/resolvers/spec-review.ts b/scripts/resolvers/spec-review.ts index 51bbe78ee..f01552dce 100644 --- a/scripts/resolvers/spec-review.ts +++ b/scripts/resolvers/spec-review.ts @@ -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 diff --git a/test/fixtures/skill-md-size-allowlist.json b/test/fixtures/skill-md-size-allowlist.json index 872cede12..9d3dd4224 100644 --- a/test/fixtures/skill-md-size-allowlist.json +++ b/test/fixtures/skill-md-size-allowlist.json @@ -7,11 +7,11 @@ "agy/gstack-plan-devex-review": 114944, "agy/gstack-plan-eng-review": 143530, "agy/gstack-review": 104723, - "codex/gstack-autoplan": 107895, - "codex/gstack-plan-design-review": 110460, - "codex/gstack-plan-devex-review": 116452, - "codex/gstack-plan-eng-review": 144695, - "codex/gstack-review": 104107, + "codex/gstack-autoplan": 107438, + "codex/gstack-plan-design-review": 110382, + "codex/gstack-plan-devex-review": 114230, + "codex/gstack-plan-eng-review": 142473, + "codex/gstack-review": 104057, "copilot/gstack-autoplan": 108595, "copilot/gstack-plan-design-review": 109369, "copilot/gstack-plan-devex-review": 114406, diff --git a/test/host-config.test.ts b/test/host-config.test.ts index 91cb5fd4d..ec5adf712 100644 --- a/test/host-config.test.ts +++ b/test/host-config.test.ts @@ -501,6 +501,31 @@ describe('golden-file regression', () => { expect(current).toBe(golden); }); + test('Codex render names no Claude-only subagent call, and /ship starts its audits with spawn_agent and wait_agent (#4476)', () => { + const root = path.join(GOLDEN_OUT, '.agents', 'skills'); + const claudeOnly = /subagent_type|run_in_background|TaskStop|task-notification|\bAgent tool\b/; + const offenders: string[] = []; + const walk = (dir: string): void => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const file = path.join(dir, entry.name); + if (entry.isDirectory()) walk(file); + else if (entry.name.endsWith('.md')) { + fs.readFileSync(file, 'utf-8').split('\n').forEach((line, i) => { + if (claudeOnly.test(line)) offenders.push(`${path.relative(root, file)}:${i + 1}: ${line.trim().slice(0, 120)}`); + }); + } + } + }; + walk(root); + expect(offenders).toEqual([]); + + const coverage = fs.readFileSync(path.join(root, 'gstack-ship', 'sections', 'test-coverage.md'), 'utf-8'); + expect(coverage).toContain('`spawn_agent`'); + expect(coverage).toContain('`wait_agent`'); + expect(coverage).toContain('Wait for its LAST-line JSON before applying the coverage gate.'); + expect(fs.readFileSync(path.join(ROOT, 'ship', 'sections', 'test-coverage.md'), 'utf-8')).toContain('`run_in_background: false`'); + }); + test('Factory ship skill matches golden baseline', () => { const golden = fs.readFileSync(path.join(GOLDEN_DIR, 'factory-ship-SKILL.md'), 'utf-8'); const current = fs.readFileSync(path.join(GOLDEN_OUT, '.factory', 'skills', 'gstack-ship', 'SKILL.md'), 'utf-8'); diff --git a/test/outside-voice-native-deadline.test.ts b/test/outside-voice-native-deadline.test.ts index 586cf7963..7b8962317 100644 --- a/test/outside-voice-native-deadline.test.ts +++ b/test/outside-voice-native-deadline.test.ts @@ -25,6 +25,7 @@ function renders(): Array<[string, string]> { for (const skill of SKILLS) { out.push([`${skill}/sections/review-sections.md`, fs.readFileSync(path.join(ROOT, skill, 'sections/review-sections.md'), 'utf8')]); for (const host of ALL_HOST_CONFIGS) { + if (host.name === 'codex') continue; const ctx: TemplateContext = { host: host.name, skillName: skill, tmplPath: `${skill}/sections/review-sections.md.tmpl`, paths: HOST_PATHS[host.name] }; out.push([`${host.name}:${skill}`, generateCodexPlanReview(ctx)]); } @@ -81,4 +82,19 @@ describe('native outside-voice fallback without TaskOutput (#3182)', () => { } expect(RESULT_CODES.OUTSIDE_VOICE_UNAVAILABLE.anchor).toBe('outside-voice-unavailable'); }); + + test('Codex, with no Plan subagent type or TaskStop, takes the unavailable path without launching (#4476)', () => { + for (const skill of SKILLS) { + const content = generateCodexPlanReview({ host: 'codex', skillName: skill, tmplPath: `${skill}/sections/review-sections.md.tmpl`, paths: HOST_PATHS.codex }); + const section = flat(bounded(content)); + expect(section, skill).toContain('take the unavailable path without launching a native subagent'); + expect(section, skill).toContain('A native result never supplies outside coverage.'); + expect(section, skill).not.toMatch(/TaskStop|run_in_background|subagent_type|task-notification/); + const unavailable = flat(content.slice(content.indexOf('**Unavailable path:**'))); + expect(unavailable, skill).toContain('Outside voice unavailable: . Fix: .'); + expect(unavailable, skill).toContain('Codex has no read-only native subagent'); + expect(unavailable, skill).toContain('`"unavailable_reason":""`'); + expect(unavailable, skill).toContain('Do not record a clean review when no reviewer completed.'); + } + }); }); diff --git a/test/run-in-background-guidance.test.ts b/test/run-in-background-guidance.test.ts index 6dda5d456..03eb9032c 100644 --- a/test/run-in-background-guidance.test.ts +++ b/test/run-in-background-guidance.test.ts @@ -298,6 +298,11 @@ describe('outside-voice dispatch contract', () => { { expectMentions(output, [['without', 'unavailable', 'launching']], 'output'); expectMentions(output, [['do not', 'completed', 'reviewer']], 'output'); + if (host.name === 'codex') { + expect(output).toContain('Codex offers no read-only Plan subagent type'); + expect(output).not.toMatch(/TaskStop|run_in_background|subagent_type/); + continue; + } expect(output, host.name).toContain('Do not set a model\noverride'); expect(hasBoundedOutsideVoiceWait(output), host.name).toBe(true); } diff --git a/test/skill-ceo-section-ordering.test.ts b/test/skill-ceo-section-ordering.test.ts index 8f6ee762a..d58781786 100644 --- a/test/skill-ceo-section-ordering.test.ts +++ b/test/skill-ceo-section-ordering.test.ts @@ -377,8 +377,11 @@ test('CEO integrates completed native findings before its external-only comparis anchors.map(anchor => typeof anchor === 'string' ? review.indexOf(anchor) : review.search(anchor)); expect(review.slice(externalStart, nativeStart)).toContain('**Integrate reviewer findings**'); const bounded = review.slice(boundedStart, unavailableStart); - expect(bounded).toContain('**Integrate reviewer findings**'); - expect(bounded).toMatch(/follow step 4/i); + if (host.name === 'codex') expect(bounded).toContain('take the unavailable path without launching'); + else { + expect(bounded).toContain('**Integrate reviewer findings**'); + expect(bounded).toMatch(/follow step 4/i); + } expect(bounded).not.toContain('continue to Cross-model tension'); const unavailable = review.slice(unavailableStart, findingsStart); expect(unavailable).toContain('STATUS = "unavailable", SOURCE = "none", OUTSIDE_STATUS = "unavailable"');