TUI: prompt edit after resume is refused when an earlier steer is missing from the summary transcript
What version of Codex CLI is running?
codex-cli 0.163.0
What subscription do you have?
ChatGPT (tier omitted; not relevant to a local TUI check)
Which model were you using?
Not relevant: the edit is refused locally before any request is sent
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal, PowerShell
Codex doctor report
not included; the relevant thread state is summarized below
What issue are you seeing?
After resuming a thread whose history contains a steer, editing a later prompt with Esc-Esc fails:
■ Failed to edit the selected prompt: the selected transcript prompt no longer matches the persisted thread
The thread itself is healthy: it answers new turns, and thread/revert to the same turn succeeds.
Related but distinct from #38865. There the steer is visible and selecting it hits the steer guard. Here the steer is not visible, so every prompt after it is off by one.
Root cause (as far as traced)
backtrack_revert_before_turn_id (codex-rs/tui/src/app_backtrack.rs) resolves the selection by its ordinal among visible user messages, counted from transcript_cells in the TUI, against every UserMessage in the hydrated persisted turns, steers included. It then requires the text at that ordinal to equal the selected prompt.
A steer is committed into the running turn as that turn's second UserMessage. The summary turn view does not carry it. On the affected thread, thread/turns/list returns:
| turn | summary view (default) user messages | itemsView: "full" user messages |
|---|---|---|
| T1 (interrupted) | P1 | P1, P2 (steer) |
| T2 (completed) | P3 | P3 |
| T3 (interrupted) | P2 resent | P2 resent |
If the resumed transcript draws T1 from the summary, as its one-prompt shape suggests, selecting T3's prompt (visible ordinal k) then resolves ordinal k in the full thread to P3. Because P3 is not equal to "P2 resent", the edit is refused. Selecting T2's prompt fails the same way against the steer and reports the steer error.
What steps can reproduce the bug?
- Send prompt P1 and, while the turn runs, send P2 so that it is committed as a steer into the same turn; interrupt.
- Send P3 and let it complete.
- Send another prompt P4.
- Quit and
codex resume <thread>. The pre-resume turns render from the paginated summary. - Esc-Esc, select P4, Enter. The edit fails with the message above. Prompts before the steer still edit fine.
These steps are reconstructed from the affected thread data and have not been re-run on a fresh thread yet. Thread id available on request.
What is the expected behavior?
The edit resolves the prompt the user selected. Two ways to get there: count visible prompts against the same projection the transcript was drawn from, or match by item id or client_id instead of by ordinal. Either way, a steer that is hidden in the transcript should not shift later prompts.
Additional information
The app-server path works. thread/revert { beforeTurnId: T3 } dropped exactly the intended turns, and thread/turns/list afterwards showed T2 as the newest turn.
(response from codex)
I tried this on 0.163.0 in Windows Terminal with PowerShell (Windows 11 build 26200). I steered the first turn, interrupted it, completed a second turn, then resent the steer text as a third turn and interrupted it. I got the same summary/full difference you saw. After quitting and resuming, though, both copies of the prompt were visible, and Esc-Esc on the later copy restored it to the composer. Paginated resume reads from thread/items/list, so the missing steer in the turn summary alone doesn't explain the failure.
Could you run /feedback from the affected thread, choose to include logs if you're comfortable, mention #56062, and reply here with the thread ID it prints? The original thread is useful even if you've already reverted it. If you'd prefer not to upload logs and can reproduce it again, a redacted list of the prompts visible in Esc-Esc alongside the ordered user-message turn/item IDs from thread/items/list before reverting would also help. Labels like P1/P2/P3 are enough; we don't need your prompt text.
Thanks for trying it. I uploaded feedback from the affected thread through the app-server feedback/upload call that /feedback uses, with logs included and #56062 in the reason.
Thread ID: 01a0a688-c836-7a51-b18a-258b95c6a5e1
The thread was reverted after the failure (thread/revert with beforeTurnId: 01a1615a-1436-72b2-b4e2-0a64634b5f52), so I also attached the pre-revert rollout segment as an extra log file. It is a hash-verified copy taken just before the revert.
Ordered user messages for the last turns, read from that pre-revert segment (item_completed events of type UserMessage). The labels match the issue body.
| turn | status | user message item | label |
|---|---|---|---|
01a1614f-9a8b-73f2-8b95-6aaea47c67b9 |
completed | 01a1614f-f027-7c11-97f2-743fc5032eb1 |
P0 |
01a16157-a857-73f0-a7c1-11879a8ac7fb |
interrupted | 01a16158-2152-7ac3-835d-1af5e95a68af |
P1 |
| same turn | 01a16158-3d07-75f0-a5c9-2c69e9f44542 |
P2 (steer, 7 s later) | |
01a16158-a711-7e91-b0ef-65ff1afc5d23 |
completed | 01a16158-aea6-7082-8477-67069a1bec7c |
P3 |
01a1615a-1436-72b2-b4e2-0a64634b5f52 |
interrupted | 01a1615a-268b-7fa0-8908-65f7e7dfde55 |
P2 resent (same text as the steer) |
The refused selection was the last prompt, P2 resent. Two corrections to the issue body. That prompt was the newest turn, so there was no separate P4 and the steps should end at "select the resent P2". And I did not record which prompts the Esc-Esc list showed, so the hidden steer as the cause is an inference from thread data that your repro argues against. The thread had been resumed several times before this (it spans eight rollout segments, the older ones zstd-compressed), which may matter for what the resumed transcript drew from. The failure was on 0.163.0. I have not reproduced it on a fresh thread.
Thanks for the bug report. This will be addressed in an upcoming release.