Skip to content

fix: deleted composer images must not reach the model - #635

Closed
justrach wants to merge 2 commits into
mainfrom
cursor/stale-image-attach-4ffc
Closed

fix: deleted composer images must not reach the model#635
justrach wants to merge 2 commits into
mainfrom
cursor/stale-image-attach-4ffc

Conversation

@justrach

Copy link
Copy Markdown
Owner

Fixes #634.

A screenshot pasted into the composer and then removed before submit was still sitting on the pending-image queue. The visible prompt looked text-only; the first user message still carried native input_image blocks. Two pastes could also become four blocks (same payload twice).

What changed

  • Submit is marker-gated for composer pastes. Ctrl-V / drop insert [Image #N] and mark the slot from_composer. consumePromptImages keeps those payloads only while [Image], [Image #N], or @[path] is still in the prompt.
  • /image and /paste stay sticky. Command-staged images still ride the next text-only line. /image clear now clears the whole queue, not just the last slot.
  • Identical b64 collapses so a double-stage cannot emit four blocks from two pastes. @[path] restage skips a path already in the queue.
  • TUI chips can actually leave. Backspace on an empty composer drops the last chip; Ctrl+U / Cmd+Delete clears chips with the draft; overlay backspace/x detaches the previewed chip.
  • ask_user runs the same retain-filter before flush, so a deleted chip in the clarification prompt does not leak either.

Tests

  • Composer paste + deleted markers → 0 input_image blocks
  • [Image #2] keeps only that slot
  • Duplicate b64 → one block
  • /image-style (no composer flag) still sends with a text-only prompt
  • TUI: empty-composer backspace, typed backspace does not drop chips, Ctrl+U clears chips, overlay backspace detaches

Tier 1 green on push (1684 unit tests, 436 TUI).

Open in Web Open in Cursor 

Pasted screenshots stayed on the pending-image queue after the user
deleted the composer chip, so a text-only submit still sent native
vision blocks (and a double-stage could emit four from two pastes).

Submit now keeps composer payloads only while [Image], [Image #N], or
@[path] remains; /image and /paste stay sticky. Identical b64 collapses.
The TUI backspace/Ctrl+U path detaches chips so the composer matches
what the request will send.

Fixes #634
Headless -p prints "turn still going" on stdout from model call 2
(ADR 0020). The boundary script required stdout to be exactly the
final reply, so CI zig failed after that pulse landed on main.
@justrach

Copy link
Copy Markdown
Owner Author

Already on main via 278 (#634). Closing as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleted pasted images remain attached and are sent to the model

2 participants