Skip to content

feat(codex): resume by session id instead of --last for parallel-safe…#24

Open
airmonitor wants to merge 1 commit into
skills-directory:mainfrom
airmonitor:codex-resume-by-id
Open

feat(codex): resume by session id instead of --last for parallel-safe…#24
airmonitor wants to merge 1 commit into
skills-directory:mainfrom
airmonitor:codex-resume-by-id

Conversation

@airmonitor

Copy link
Copy Markdown

… sessions

resume --last resolves to the newest recorded session scoped to the current cwd. When two Codex sessions run in the same cwd (e.g. several rounds against one repo), both resume the same target and the call hangs.

Switch the skill to capture each session's id and resume by it:

  • initial exec runs with --json (session id emitted as the thread_id of the thread.started event on stdout) plus -o <file> (clean final message written to a file, so JSONL on stdout does not lose the answer)
  • resume with codex exec resume "$SID" "PROMPT" instead of --last
  • temp files namespaced per-session $TAG so concurrent runs don't clobber

This is collision-free, fully parallel-safe, and preserves session context across rounds (verified: a resumed-by-id session recalls earlier turns). Updates Quick Reference, Following Up, the "When Codex is Wrong" resume example, and Error Handling. Existing stdin (</dev/null) and Execution-timeouts guidance is preserved unchanged.

… sessions

`resume --last` resolves to the newest recorded session scoped to the
current cwd. When two Codex sessions run in the same cwd (e.g. several
rounds against one repo), both resume the same target and the call hangs.

Switch the skill to capture each session's id and resume by it:
- initial exec runs with `--json` (session id emitted as the `thread_id`
  of the `thread.started` event on stdout) plus `-o <file>` (clean final
  message written to a file, so JSONL on stdout does not lose the answer)
- resume with `codex exec resume "$SID" "PROMPT"` instead of `--last`
- temp files namespaced per-session `$TAG` so concurrent runs don't clobber

This is collision-free, fully parallel-safe, and preserves session
context across rounds (verified: a resumed-by-id session recalls earlier
turns). Updates Quick Reference, Following Up, the "When Codex is Wrong"
resume example, and Error Handling. Existing stdin (`</dev/null`) and
Execution-timeouts guidance is preserved unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants