Skip to content

[Bug] Codex resume command uses invalid argument ordering #228

@srausser

Description

@srausser

Summary

Resuming an Ouroboros workflow can fail against current Codex CLI builds because the generated command puts resume before global codex exec options such as -C. With codex-cli 0.116.0, this produces error: unexpected argument '-C' found and the resume attempt aborts.

Impact

This blocks resuming interrupted orchestrator sessions even when the underlying session is otherwise valid. In practice it makes resume unusable on current Codex CLI versions and can cascade into a second failure mode where the orchestrator session is marked terminal.

Environment

  • Ouroboros version: 0.26.0b7+sam.rawqa1
  • OS: macOS 15.7.3
  • Python version: 3.14.1
  • Installation method: local wheel/dev install
  • Model/provider: Codex CLI
  • Codex CLI version: 0.116.0
  • Relevant flags/config: ouroboros run workflow <seed> --debug --resume <session_id>

Steps to reproduce

  1. Start any workflow run and obtain a resumable orchestrator session id.
  2. Interrupt the process.
  3. Run ouroboros run workflow <seed_file> --debug --resume <session_id>.
  4. Observe the command Ouroboros emits for Codex resume.

Expected behavior

Ouroboros should build a valid Codex command for resume, with global codex exec options appearing before the resume subcommand. The session should resume normally.

Actual behavior

Ouroboros builds a command shaped like this:

codex exec resume <session_id> --json --skip-git-repo-check --output-last-message <tmp> -C <cwd> --full-auto

Codex CLI rejects it with:

error: unexpected argument '-C' found
  tip: to pass '-C' as a value, use '-- -C'
Usage: codex exec resume [OPTIONS] [SESSION_ID] [PROMPT]

Logs or error output

2026-03-26T16:21:18.202545Z [info     ] codex_cli_runtime.task_started command=['/opt/homebrew/bin/codex', 'exec', 'resume', '019d2aea-4539-7103-a9a7-9416bae87668', '--json', '--skip-git-repo-check', '--output-last-message', '/var/folders/.../ouroboros-codex-xqay5e3r.txt', '-C', '/Users/sam/src/genie/finance', '--full-auto']
2026-03-26T16:21:18.279754Z [error    ] orchestrator.session.failed    error="error: unexpected argument '-C' found\n  tip: to pass '-C' as a value, use '-- -C'\nUsage: codex exec resume [OPTIONS] [SESSION_ID] [PROMPT]\nFor more information, try '--help'."

Minimal reproduction

Any interrupted workflow session resumed via:

ouroboros run workflow /path/to/seed.yaml --debug --resume <session_id>

against codex-cli 0.116.0.

Acceptance criteria for fix

  • Resume commands place --json, --output-last-message, -C, permission flags, and similar global exec options before resume.
  • ouroboros run workflow <seed> --resume <session_id> works with current Codex CLI versions.
  • Unit coverage exists for the exact command ordering used for resume.
  • A failed command-shape mismatch does not silently regress in future Codex CLI integrations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReproducible defect or broken behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions