Skip to content

[Bug]: Tapping "Remove from draft" while editing a queued message on mobile leaves the file attached #46208

Done

Description

@viktorce

Before submitting

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

Area

apps/mobile

Steps to reproduce

Use a development build paired to a dev server, with a text file saved on the device.

  1. In Settings, open "Chat" and switch "While the agent is running" to Queue.
  2. Start a thread with "Replay (dev)" on "Long stream" and send go so a turn streams.
  3. Type Read , tap +, choose "Choose Files", pick the text file, and send. Images, PDFs, and videos do not open the file screen in step 5.
  4. Tap "1 queued", then tap the queued row's text to open "Editing queued message".
  5. Tap the file chip, tap the menu button at the top right to open "File actions", and tap "Remove from draft".
  6. Save the edit with the checkmark.
  7. Close the queue sheet if it is open, stop the running turn, and tap the play button in the composer, labeled "Resume thread", to send the queued message.

Expected behavior

"Remove from draft" should remove the file from the queued message. In a normal draft, it removes the file, and the sent message is Read with no attachment.

Actual behavior

On iOS, the chip leaves the text. The keyboard stays up, and the strip above the text still shows the file. The sent message shows Read with an attachment card that opens the file. The stored message keeps the file in its attachment list and context. On Android, the sent message also showed the attachment card and the stored message kept the file. There, "Remove from draft" left the composer unfocused with only Read and the checkmark, so nothing on screen showed the file stayed attached. Deleting the chip with backspace on iOS and Android left the file in the strip and on the sent message. The backspace runs used a text file only.

Everything below comes from reading the code. removeFromDraft in apps/mobile/src/features/files/AttachmentFileScreen.tsx removes the attachment only from the edit's draft, through removeComposerDraftAttachment, and then goes back. Existing attachments are not in that draft. They live in existingAttachments in apps/mobile/src/state/queued-run-edit.ts. Only the strip's remove button calls removeQueuedRunEditAttachment. saveQueuedRunEdit in apps/mobile/src/state/use-thread-composer-state.ts sends existingAttachments again. The zip view's remove button also calls removeFromDraft. Deleting the chip with backspace, cut, or typing over it ends in setComposerDraftText, which drops a non-image file from a normal draft and cannot reach existingAttachments. PDF and video files are affected the same way, and tapping their chip opens a preview with no remove action. Image attachments are not part of this report, because deleting an image's chip keeps the image in a normal draft too. #45106 fixed the opposite direction, where the strip's button left the chip.

Impact

Minor bug or occasional failure

Version or commit

Runs were on 1f2df01d81, with the removal and save code unchanged on 7380d2a73e.

Environment

macOS, iOS 27.2 iPhone 17 simulator, Android 16 Medium Phone API 36 emulator, "Replay (dev)" on Long stream

Logs or stack traces

No response

Screenshots, recordings, or supporting files

"File actions" menu with "Remove from draft".
File actions menu with Remove from draft

iOS composer after "Remove from draft", with harbor-notes.txt in the strip.
iOS composer after Remove from draft, with harbor-notes.txt in the strip

Android composer after "Remove from draft", unfocused with no strip.
Android composer after Remove from draft, unfocused with no strip

Sent message with the harbor-notes.txt card.
Sent message with the harbor-notes.txt card

Workaround

Focus the composer, then remove the file with the remove button in the strip above the text.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions