core-agent-ide/docs
Charley Cunningham 26a7cd21e2
tui: preserve remote image attachments across resume/backtrack (#10590)
## Summary
This PR makes app-server-provided image URLs first-class attachments in
TUI, so they survive resume/backtrack/history recall and are resubmitted
correctly.

<img width="715" height="491" alt="Screenshot 2026-02-12 at 8 27 08 PM"
src="https://github.com/user-attachments/assets/226cbd35-8f0c-4e51-a13e-459ef5dd1927"
/>

Can delete the attached image upon backtracking:
<img width="716" height="301" alt="Screenshot 2026-02-12 at 8 27 31 PM"
src="https://github.com/user-attachments/assets/4558d230-f1bd-4eed-a093-8e1ab9c6db27"
/>

In both history and composer, remote images are rendered as normal
`[Image #N]` placeholders, with numbering unified with local images.

## What changed
- Plumb remote image URLs through TUI message state:
  - `UserHistoryCell`
  - `BacktrackSelection`
  - `ChatComposerHistory::HistoryEntry`
  - `ChatWidget::UserMessage`
- Show remote images as placeholder rows inside the composer box (above
textarea), and in history cells.
- Support keyboard selection/deletion for remote image rows in composer
(`Up`/`Down`, `Delete`/`Backspace`).
- Preserve remote-image-only turns in local composer history (Up/Down
recall), including restore after backtrack.
- Ensure submit/queue/backtrack resubmit include remote images in model
input (`UserInput::Image`), and keep request shape stable for
remote-image-only turns.
- Keep image numbering contiguous across remote + local images:
  - remote images occupy `[Image #1]..[Image #M]`
  - local images start at `[Image #M+1]`
  - deletion renumbers consistently.
- In protocol conversion, increment shared image index for remote images
too, so mixed remote/local image tags stay in a single sequence.
- Simplify restore logic to trust in-memory attachment order (no
placeholder-number parsing path).
- Backtrack/replay rollback handling now queues trims through
`AppEvent::ApplyThreadRollback` and syncs transcript overlay/deferred
lines after trims, so overlay/transcript state stays consistent.
- Trim trailing blank rendered lines from user history rendering to
avoid oversized blank padding.

## Docs + tests
- Updated: `docs/tui-chat-composer.md` (remote image flow,
selection/deletion, numbering offsets)
- Added/updated tests across `tui/src/chatwidget/tests.rs`,
`tui/src/app.rs`, `tui/src/app_backtrack.rs`, `tui/src/history_cell.rs`,
and `tui/src/bottom_pane/chat_composer.rs`
- Added snapshot coverage for remote image composer states, including
deleting the first of two remote images.

## Validation
- `just fmt`
- `cargo test -p codex-tui`

## Codex author
`codex fork 019c2636-1571-74a1-8471-15a3b1c3f49d`
2026-02-13 14:54:06 -08:00
..
agents_md.md Rename hierarchical_agents to child_agents_md (#9215) 2026-01-14 19:14:24 +00:00
authentication.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
CLA.md chore: subject docs/*.md to Prettier checks (#4645) 2025-10-03 11:35:48 -07:00
config.md [connectors] Support connectors part 1 - App server & MCP (#9667) 2026-01-22 16:48:43 -08:00
contributing.md [Codex][CLI] Gate image inputs by model modalities (#10271) 2026-02-02 18:56:39 -08:00
example-config.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
exec.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
execpolicy.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
exit-confirmation-prompt-design.md feat(tui): retire the tui2 experiment (#9640) 2026-01-22 01:02:29 +00:00
getting-started.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
install.md feat(core): add configurable log_dir (#10678) 2026-02-05 01:23:30 +00:00
js_repl.md Add js_repl_tools_only model and routing restrictions (#10671) 2026-02-12 15:41:05 -08:00
license.md chore: subject docs/*.md to Prettier checks (#4645) 2025-10-03 11:35:48 -07:00
open-source-fund.md chore: subject docs/*.md to Prettier checks (#4645) 2025-10-03 11:35:48 -07:00
prompts.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
sandbox.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
skills.md Point skills docs to developer documentation site (#8407) 2025-12-21 16:18:58 -08:00
slash_commands.md Replaced user documentation with links to developers docs site (#8662) 2026-01-02 13:01:53 -07:00
tui-alternate-screen.md fix: add tui.alternate_screen config and --no-alt-screen CLI flag for Zellij scrollback (#8555) 2026-01-09 18:38:26 +00:00
tui-chat-composer.md tui: preserve remote image attachments across resume/backtrack (#10590) 2026-02-13 14:54:06 -08:00
tui-request-user-input.md tui: make Esc clear request_user_input notes while notes are shown (#10569) 2026-02-03 16:17:06 -08:00
tui-stream-chunking-review.md feat(tui): pace catch-up stream chunking with hysteresis (#10461) 2026-02-03 15:01:51 -08:00
tui-stream-chunking-tuning.md feat(tui): pace catch-up stream chunking with hysteresis (#10461) 2026-02-03 15:01:51 -08:00
tui-stream-chunking-validation.md feat(core): add configurable log_dir (#10678) 2026-02-05 01:23:30 +00:00