No way to resume in non-interactive mode when session id is not outputted
Resolved 💬 7 comments Opened Sep 17, 2025 by jordan-BAIC Closed Oct 31, 2025
💡 Likely answer: A maintainer (pakrym-oai, contributor)
responded on this thread — see the highlighted reply below.
codex-cli 0.36.0
codex exec --json "<my message>" does not return a session id, and therefore I cannot then perform codex exec --json resume <session_id> "<my followup message"
using codex proto seems to have the opposite problem, it returns a session id but is not capable of resuming with it.
My workaround for now if getting the latest session id from the ~/.codex/sessions directory, but my application lets you run multiple prompts in rapid succession so this is not reliable.
7 Comments
https://github.com/openai/codex/issues/3712
Facing the same issue with vibe-kanban.
codex-cli 0.38.0 & codex-cli 0.39.0
You can use --last with exec.
@eadlam
I built a GUI for Codex CLI
GUI needs proto
https://github.com/milisp/codexia
Hi, can you please try
codex exec --experimental-json(will soon become the default--jsonbehavior) that returns thread_id in combination withcodex exec resume <thread_id>?@pakrym-oai This kind of works, however, cli flags and arguments from the first invocation aren't preserved in subsequent ones - in the screenshot below you can see that when we resume, it no longer outputs JSON. Maybe for JSON this isn't so bad, but there are other arguments (e.g.
skip-git-repo-check) that preclude this workaround.<img width="1123" height="487" alt="Image" src="https://github.com/user-attachments/assets/8a7ffe55-f276-4705-93a6-7061d950e5fa" />
The current command line parsing logic is a bit deficient and requires arguments to go between
codex execandresumetry
codex exec --experimental-json <other args> resume ....We are aware and working on this.