Summary
On Windows, every codex exec invocation emits an ERROR line on stderr after the answer has already streamed successfully:
ERROR codex_core::session: failed to record rollout items: thread <uuid> not found
The <uuid> is the same session id printed in the Codex banner at the top of the run, so the thread store is failing to locate a thread that this very run just created.
The stdout answer is correct, but the stderr line is scary-looking and is misinterpreted by automation wrappers (e.g. agent harnesses that parse stderr to decide whether to retry). In our case, it caused silent retries of every codex exec call, roughly doubling latency and burning extra quota.
Environment
codex-cli 0.125.0 (also reproduces on 0.126.0-alpha.1)
- Node
v24.14.0 (npm-global install: @openai/codex)
- Windows 11 IoT Enterprise LTSC 2024, build
10.0.26100.8246
- Shell: Git Bash (MSYS) on Windows
- Auth: ChatGPT Plus
- Persistent state:
~/.codex/ exists and is writable; ~14 rollout files written today without other obvious problems
Reproduction
Trivial — runs from any working directory:
$ codex exec --full-auto --skip-git-repo-check "what is 2+2? answer in one word"
OpenAI Codex v0.125.0 (research preview)
--------
session id: 019dc1b7-3d0f-7da2-8ac6-41f9ea486cec
--------
user
what is 2+2? answer in one word
codex
Four
2026-04-24T22:58:28.273202Z ERROR codex_core::session: failed to record rollout items: thread 019dc1b7-3d0f-7da2-8ac6-41f9ea486cec not found
tokens used
7,973
Four
The ERROR line appears on every invocation, on a freshly-created session, with the very session id from the banner.
Expected behaviour
A run that creates a session, streams an answer to stdout, and exits cleanly should not emit ERROR codex_core::session: failed to record rollout items: thread <uuid> not found for the session it just created. Either:
- the rollout-recorder should successfully find the just-created thread, or
- if the rollout write is intentionally skipped (e.g. exec runs in some "limited persistence" mode), the message should not be logged at
ERROR level — or shouldn't reference a "not found" thread at all.
Source-code pointers
So the chain is: rollout-recorder → thread-store lookup by the active session's thread id → ThreadNotFound → wrapped and logged at ERROR by the session module.
Related issues (similar class, but different exact symptom)
The Windows + codex_exec thread-store interaction looks like an active sore spot. Filing this one because the exact error string thread <uuid> not found for a just-created session does not appear in the existing issues.
Impact
- Cosmetic noise for interactive users.
- For agent / wrapper integrations that parse stderr to detect failures, it can trigger silent retries — wasting quota (especially significant on ChatGPT Plus) and inflating wall-clock latency. We hit this in a Claude Code subagent that wraps
codex exec: a single delegation produced two codex exec invocations because of this stderr line.
Workarounds
- Filter stderr in wrappers:
codex exec ... 2> >(grep -v 'failed to record rollout items: thread' >&2).
- Don't read this for failure-detection — check stdout completion or exit code instead.
Summary
On Windows, every
codex execinvocation emits anERRORline on stderr after the answer has already streamed successfully:The
<uuid>is the same session id printed in the Codex banner at the top of the run, so the thread store is failing to locate a thread that this very run just created.The stdout answer is correct, but the stderr line is scary-looking and is misinterpreted by automation wrappers (e.g. agent harnesses that parse stderr to decide whether to retry). In our case, it caused silent retries of every
codex execcall, roughly doubling latency and burning extra quota.Environment
codex-cli 0.125.0(also reproduces on0.126.0-alpha.1)v24.14.0(npm-global install:@openai/codex)10.0.26100.8246~/.codex/exists and is writable; ~14 rollout files written today without other obvious problemsReproduction
Trivial — runs from any working directory:
The ERROR line appears on every invocation, on a freshly-created session, with the very session id from the banner.
Expected behaviour
A run that creates a session, streams an answer to stdout, and exits cleanly should not emit
ERROR codex_core::session: failed to record rollout items: thread <uuid> not foundfor the session it just created. Either:ERRORlevel — or shouldn't reference a "not found" thread at all.Source-code pointers
codex-rs/thread-store/src/error.rs—ThreadNotFound { thread_id }with format"thread {thread_id} not found".codex-rs/core/src/session/mod.rs— emitsfailed to record rollout items: <inner>.So the chain is: rollout-recorder → thread-store lookup by the active session's thread id →
ThreadNotFound→ wrapped and logged at ERROR by the session module.Related issues (similar class, but different exact symptom)
channel closed#16300 — RolloutRecorder shutdown race emitschannel closed(different inner error, same wrapping log).codex_execapply_patchdeletes lose file content; references that exec starts threads in "Limited persistence mode".The Windows +
codex_execthread-store interaction looks like an active sore spot. Filing this one because the exact error stringthread <uuid> not foundfor a just-created session does not appear in the existing issues.Impact
codex exec: a single delegation produced twocodex execinvocations because of this stderr line.Workarounds
codex exec ... 2> >(grep -v 'failed to record rollout items: thread' >&2).