Feature request: --session-id flag to set session UUID at launch
Summary
codex supports resume <uuid> to resume a specific session. However, there is no way to set the session UUID at launch time (analogous to Claude Code's --session-id <uuid>).
Use Case
I'm building TUICommander (https://github.com/stefanospin/tuicommander), a terminal orchestrator that manages multiple AI agent sessions across branches and worktrees. When the user switches branches, we persist terminal state and later restore it with the correct session.
Current workaround: After launching codex, scan ~/.codex/sessions/ for the newest JSONL file and extract the UUID from its filename. This couples us to undocumented filesystem layout.
With --session-id: We generate a UUID before launch, pass codex --session-id <uuid>, and save it. On restore: codex resume <uuid>. Clean, deterministic, no filesystem scraping.
Proposed API
codex --session-id <uuid> # Start a new session with this UUID
codex resume <uuid> # Resume that session later (already works)
This is exactly what Claude Code implements with claude --session-id <uuid> + claude --resume <uuid>.
Alternatives Considered
- Filesystem scraping of ~/.codex/sessions/: works but undocumented, may break
- Interactive picker via codex resume: not scriptable
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗