Skip to content

[Bug]: Image compression recreates a discarded composer draft and blocks Undo #36731

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Type a prompt in a thread and paste a screenshot that needs resizing.
  2. While the image is preparing, switch to another thread and discard the source thread's draft from the sidebar.
  3. Allow compression to finish. The discarded thread shows an unsent draft again.
  4. Alternatively, type in a new-thread draft, navigate away and back so its sidebar row is present, paste the image, discard that active draft while preparing, then click Undo after compression finishes.

The deterministic repro uses a generated PNG wider than the image limit, runs production compression, and holds createImageBitmap until discard has finished. No provider is needed.

Expected behavior

Discard stays effective after compression finishes, and Undo restores the saved prompt.

Actual behavior

Late compression recreates an image-only draft for the discarded target. The thread's unsent-draft marker returns. For the discarded new-thread draft, Undo shows “Failed to restore draft” with “The draft has new content.” and does not restore the draft.

Impact

Minor bug or occasional failure

Version or commit

pingdotgg/main @ 96735d7

Environment

Linux, Chromium, web client with isolated scenario state. Client-side composer intake; provider independent.

Logs or stack traces

The supplied hook repro fails for both discard targets on main. Paired real-app scenarios also fail on base and pass with cancellation at discard. Found by the bughunt, independently confirmed by Claude Opus 5.5, and reproved for this fix.

Screenshots, recordings, or supporting files

New-thread Undo failure · Thread draft resurfaces

Workaround

Let image preparation finish before discarding.

Activity

  1. added
    vouch:trusted
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions