codex exec --ephemeral backfills turn items via thread/read(includeTurns=true)

Resolved 💬 1 comment Opened Apr 4, 2026 by garitar Closed Apr 6, 2026

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() calls maybe_backfill_turn_completed_items() on every TurnCompleted
  • maybe_backfill_turn_completed_items() currently calls thread/read with include_turns: true when turn.items is empty
  • codex-rs/app-server/src/codex_message_processor.rs rejects includeTurns for 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:

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-exec no 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.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗