Add --output-schema support to codex exec resume

Resolved 💬 2 comments Opened Mar 11, 2026 by bralca Closed Apr 18, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

CLI, headless mode

What feature would you like to see?

Problem

codex exec supports --output-schema <FILE> for structured JSON output, and codex exec resume <SESSION_ID> supports resuming a previous session with full conversation memory. However, these two features cannot be combined — exec resume does not accept --output-schema.

$ codex exec resume <session_id> --json --output-schema schema.json -o output.json "follow-up prompt"

error: unexpected argument '--output-schema' found

Use Case

Any multi-turn agentic workflow that needs both:

  • Conversation memory across turns (via resume)
  • Schema-validated structured output (via output-schema)

For example, multi-step data collection, conversational form-filling, or iterative refinement loops where each turn must
return a typed JSON response conforming to a known schema — and the model needs to remember what happened in previous turns to produce coherent responses.

Without this, you're forced to choose between memory (resume, no schema enforcement) or structured output (schema, no memory). The underlying Responses API supports both previous_response_id and text.format simultaneously, so this appears to be a CLI gap rather than an API limitation.

Proposed Solution

Add --output-schema <FILE> and -o <FILE> to codex exec resume, matching the existing behavior on codex exec.

codex exec resume <SESSION_ID> \
--json \
--output-schema schema.json \
-o output.json \
"follow-up prompt"

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #12538

Powered by Codex Action

etraut-openai contributor · 4 months ago

This feature request hasn't received enough upvotes, so I'm going to close it.