Skip to content

codex exec resume should support -o flag for output capture #12538

@Rhovian

Description

@Rhovian

What variant of Codex are you using?

CLI

What feature would you like to see?

Problem

codex exec resume does not support the -o (output file) flag, unlike codex exec which does. This means the only way to capture output from a resumed session is piping stdout (e.g. 2>&1 | tail -80), which mixes the actual model response with tool-call noise (file reads, thinking steps, exec output).

Impact

When building automated workflows that use codex exec for an initial call (with -o for clean output capture) and then codex exec resume for follow-up rounds, the resume rounds produce significantly noisier output that's hard to parse programmatically.

Example workflow

# Round 1 — clean output via -o
codex exec -m gpt-5.3-codex -s read-only -o /tmp/review.md "Review these files..."

# Round 2 — no -o support, forced to pipe stdout
codex exec resume $SESSION_ID "I've revised based on your feedback..." 2>&1 | tail -80

The tail -80 approach captures Codex's internal tool calls (file reads, shell execs) alongside the actual review response, making it difficult to extract just the model's final answer.

Expected Behavior

codex exec resume should accept -o to write only the model's final response to a file, consistent with codex exec.

codex exec resume $SESSION_ID -o /tmp/review-round2.md "Re-review the changes..."

Workaround

Currently piping through tail or grep to try to isolate the response, but this is fragile since the number of tool-call output lines varies.

Will PR this as time allows, hopefully can get some eyes on it.

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