Skip to content

Add --output-schema support to codex exec resume #14343

@bralca

Description

@bralca

What variant of Codex are you using?

CLI, headless mode

What feature would you like to see?

Problem

codex exec supports --output-schema 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 and -o 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexecIssues related to the `codex exec` subcommand

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions