codex exec --ephemeral backfills turn items via thread/read(includeTurns=true)
What version of Codex CLI is running?
codex-cli 0.117.0
What subscription do you have?
Authenticated personal account via Codex desktop app / CLI login. The exact subscription tier is not surfaced in the CLI output available to me here.
Which model were you using?
gpt-5.4
What platform is your computer?
Darwin 25.4.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
Codex desktop app integrated terminal on macOS. No tmux/screen/zellij.
What issue are you seeing?
codex exec --ephemeral --json can try to backfill turn.items after turn/completed by issuing thread/read(includeTurns=true). App-server rejects that combination for ephemeral threads, so the CLI logs this warning during completion:
thread/read failed while backfilling turn items for turn completion: thread/read: thread/read failed: ephemeral threads do not support includeTurns
On a minimal repro, the command still writes the requested output and exits 0, but it emits the warning every time. In a larger replay based on a real analysis prompt, I also saw turn.completed, the same warning, and then the process stayed alive until killed.
I localized the source path in the current tree:
codex-rs/exec/src/lib.rs:run_exec_session()callsmaybe_backfill_turn_completed_items()on everyTurnCompletedmaybe_backfill_turn_completed_items()currently callsthread/readwithinclude_turns: truewhenturn.itemsis emptycodex-rs/app-server/src/codex_message_processor.rsrejectsincludeTurnsfor ephemeral threads
So exec --ephemeral is making a completion-time request that app-server explicitly disallows.
What steps can reproduce the bug?
Minimal repro on my machine:
printf 'Reply with exactly: ok\n' | codex exec \
-C /tmp/openai-codex-latest \
--sandbox read-only \
--skip-git-repo-check \
--ephemeral \
--json \
-m gpt-5.4 \
-o /tmp/codex-ephemeral-repro/out.md \
-
Observed result:
- output file contains
ok - process exits 0
- stderr contains:
thread/read failed while backfilling turn items for turn completion: thread/read: thread/read failed: ephemeral threads do not support includeTurns
I also reproduced the same warning on a longer frozen prompt replay that had previously hung after turn.completed.
What is the expected behavior?
codex exec --ephemeral should not attempt a completion-time thread/read(includeTurns=true) backfill against ephemeral threads. The command should complete without that invalid-request warning, using the live notification state it already collected.
Additional information
I have a small patch ready on a fork branch in case it is useful and you want to invite a PR:
- branch:
garitar:codex/skip-ephemeral-turn-backfill - compare URL: https://github.com/garitar/codex/compare/main...codex:codex/skip-ephemeral-turn-backfill
What the patch does:
- thread through
config.ephemeral - skip
maybe_backfill_turn_completed_items()for ephemeral threads - add a unit test covering the new gate
Local verification on that branch:
cargo test --manifest-path codex-rs/Cargo.toml -p codex-exec- patched
codex-execno longer emits the backfill/includeTurns warning on the minimal repro and still writes the correct output
I checked for an existing matching issue/PR before filing this, but did not find one for this exact backfill/includeTurns behavior.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗