openai / openai/codex

TUI: Quickly interrupting a submitted prompt drops it from rollout history

Open
#38,395 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI session TUI
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.147.0 (reported as current/latest by codex doctor --json)

What subscription do you have?

ChatGPT authentication (the exact subscription tier is not exposed by the CLI)

Which model were you using?

gpt-5.6-sol, max reasoning, fast mode

What platform is your computer?

Linux 7.0.0-28-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

xterm.js in a browser, attached through tmux 3.4 (TERM=xterm-256color)

Codex doctor report
{
  "codexVersion": "0.147.0",
  "overallStatus": "warning",
  "authMode": "chatgpt",
  "model": "gpt-5.6-sol",
  "modelProvider": "openai",
  "wireApi": "responses",
  "websocketReachability": "ok",
  "platform": "linux-x86_64",
  "installation": "standalone",
  "terminal": "xterm-256color",
  "multiplexer": "tmux 3.4",
  "latestVersionStatus": "current version is not older"
}

The unrelated local paths and state inventory from the full doctor report are omitted.

What issue are you seeing?

If I submit a prompt in the interactive TUI with Enter and then press Escape soon after the turn starts, the TUI visibly echoes the submitted prompt and reports an interrupted turn, but the actual user prompt can be permanently absent from the rollout JSONL.

In one measured reproduction, the rollout contained:

15:24:09.897Z  event_msg: task_started
15:24:10.773Z  event_msg: turn_aborted (duration_ms: 865)

Between those events Codex wrote injected developer/user context, but it never wrote a response_item containing the prompt that I had submitted. The terminal scrollback still showed that prompt.

I then submitted a second prompt and received a normal assistant reply. The second prompt and reply were appended to the same rollout, but the first interrupted prompt was not backfilled. Resuming or independently reconstructing the session therefore cannot recover it.

This creates an ambiguous user contract: the TUI showed that the prompt was accepted and the turn started, but durable history behaves as if the prompt never existed. A follow-up such as “ignore my previous instruction” can now refer to the wrong persisted message. It is also unclear to the user whether the live model saw the interrupted prompt.

What steps can reproduce the bug?
  1. Start a new interactive Codex CLI session.
  2. Type a unique prompt and press Enter.
  3. As soon as the TUI enters the working state, press Escape to interrupt it.
  4. Observe that the submitted prompt remains visible in terminal scrollback and the turn is marked interrupted.
  5. Submit a second prompt and wait for a normal assistant reply.
  6. Inspect the session rollout under ~/.codex/sessions/.../*.jsonl, or resume the session.
  7. The second prompt and response are present, while the first prompt may be completely absent. The later turn does not backfill it.

The issue appears timing/phase dependent: other turns interrupted several seconds later already had their user message persisted. There does not appear to be a reliable user-visible boundary indicating when cancellation is safe.

What is the expected behavior?

Submitting a prompt and recording it in conversation history should have consistent semantics. Preferably the user message should be durably recorded before task_started, followed by a structured aborted status if Escape interrupts the turn.

Alternatively, if Escape occurs before submission is committed, the TUI should restore the text to the composer or explicitly mark it as “not submitted.” It should not both display the prompt as accepted and silently omit it from durable history.

Additional information
  • Reproduced in a newly created CLI session.
  • The missing prompt was not restored by a subsequent successful turn.
  • The actual thread ID and unredacted local rollout are available privately if a maintainer needs them.
  • This differs from #31239: that issue records thread_rolled_back and hides an older message that remains physically present. Here the newly submitted prompt never appears in the rollout at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the interruption sequence in a new interactive session, then inspect the rollout under ~/.codex/sessions/.../*.jsonl. Compare task_started, turn_aborted, and response_item events to determine when the submitted prompt is omitted. Done means an interrupted submitted prompt is durably represented, or the TUI restores it or explicitly marks it as not submitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.