Skip to content

Bug: failed Inbox attachment upload clears the unsent reply draft #3558

Closed

Description

@yannickmonney

Problem

If an Inbox reply's attachment upload fails, the UI treats the send callback as successful and clears the unsent draft and file selection even though no reply was sent. This is pre-existing behavior, also noted as left open in #3552, rather than a new regression introduced by that PR.

Evidence and reproduction

Reviewed at a6cb1777b84500e77546b0a95e8d9b0890357db7 in an isolated local checkout. In conversation-panel.tsx:310–318, attachment-upload errors show a toast and return normally. In message-editor.tsx, handleSendMessage awaits that callback and then clears the body, attached files and improvement instruction, and fires the sent callback.

A focused test using the existing real ConversationPanel with its backend upload mutation mocked to reject confirms that editor.onSave(...) resolves undefined instead of rejecting; five existing panel tests pass and this new failure-propagation regression fails. The editor's existing failure-preservation behavior requires a rejection. This is local component/source evidence; an actual mailbox send was not performed.

User-level reproduction to verify locally:

  1. Type a reply and attach a file.
  2. Make the local upload service refuse or fail the upload.
  3. Press Send.
  4. The upload-failed toast appears, but the unsent body/files are cleared; no reply was queued.

Expected and acceptance

  • A failed upload or refused upload mint preserves the exact draft and selected files and allows retry.
  • Use an explicit failure outcome or propagate the rejection to the existing editor contract; avoid two duplicate error toasts.
  • Ensure no sent/remount/undo-consumed callback fires on failure.
  • Cover a newly selected file, an attachment-only reply, and an undone reply combining an already-stored file with a new file whose upload fails.
  • Add regression coverage across the panel/editor boundary and verify in a real browser against an isolated local upload failure. No production testing.

This should be a focused follow-up; it does not require changing the successful send or attachment-ownership contract.

Activity

  1. added
    priority: medium
    bug
    service: platform
    on Sep 27, 2026
  2. yannickmonney commented on Sep 27, 2026

    @yannickmonney
    ContributorAuthor

    Implementation is in progress on branch fix/preserve-reply-after-upload-failure. The same swallowed upload error also occurs in new-email compose, so the fix covers both Inbox reply and compose drafts with one consistent failure contract. Local tests only; no external mail or production activity.

  3. yannickmonney commented on Sep 27, 2026

    @yannickmonney
    ContributorAuthor

    Implemented in #3566 at e37986bb05696a5f4e106c3f094c9785a0e45ac2. The same swallowing catch existed in New email, so the accepted scope covers both reply and compose. Both use the editor's existing rejection contract and one editor-owned failure toast with backend refusal detail.

    The local Chromium regression uses the real panes, Milkdown editor, persistence and mutation hooks. It verifies:

    • Refused upload URL generation, refused/network/malformed uploads, and refused sends after upload retain the body, selected file, improvement instruction, mounted editor and compose fields.
    • Attachment-only drafts remain retryable; no sent or undo-consumed callback fires on failure; one error toast is shown.
    • Retry submits the original file and clears the draft only after success, once.
    • An undo-restored reply plus a newly selected file survives upload failure.

    Current main has no stored-file undo payload. The mixed stored/new-file acceptance case is therefore an integration check for #3552; this focused fix does not import that feature. #3552 should retain this rejection/toast contract when adding stored attachments.

    Validation: 15 Chromium tests, 28 focused UI tests, 24 translation checks, changed-file lint/type-check, manual-test gate and security scan passed. The final full check passed on pinned Bun 1.4.2: 55/55 tasks (42 cached), with fresh runs of 3,812 platform UI tests and 77,926 server tests. The obsolete compose locale key is removed from every applicable catalog. Full SAST also exited 0 with no findings (3,980 files / 467 rules); its report notes 35 partially analyzed files, 17 size exclusions, and timeouts in the English catalog and a Microsoft Graph fixture. All upload/send responses were synthetic; no production testing or mailbox/provider calls were made.

  4. yannickmonney commented on Oct 4, 2026

    @yannickmonney
    ContributorAuthor

    Already fixed on main by #3566 (squash 80759c7af2a5e24ec2ee9b80b985ea4516aeef40, merged 2026-09-28). This independent confirmation is from Tale agent #2, TALE-359 run 554ef899-2405-42cc-8bfd-e575c9b857fe, following the manager's answer on TALE-125. #3566's body has no closing keyword, so this issue stayed open.

    Independence: #3566 was opened on 2026-09-27 at 22:28Z, before TALE-125 existed and before this review role began. Its body and its ten commits carry only the shared GitHub principal and name no agent or run. Nothing in my own work history records it.

    Source at main 6524150fe

    • Every upload failure now throws (conversation-panel.tsx:276-311), so onSave rejects. That covers an invalid attachment, a refused upload mint, a non-OK upload (throw await backendErrorFromResponse(result)) and a malformed storageId.
    • MessageEditor clears only after a successful save (message-editor.tsx:280-299). It clears the body, the files and the improvement instruction, and calls onMessageSent, only after await onSave(…) resolves.
    • One toast on failure: the catch shows a single "Couldn't send message" toast with the refusal detail. The upload hook is quiet (errorToast: false, :179-181).

    Tests

    • inbox-upload-failure.browser.test.tsx runs 13 real-Chromium tests through the real panel and editor. They cover reply and New email, five failure kinds, an attachment-only reply, and an undone reply that combines a stored file with a new file.
    • Local run on main 6524150fe: 13/13 pass.
    • Mutant: making the editor clear the draft and call onMessageSent on failure, which is the original bug, fails all 13.
    • CI: Browser job 111311079393 (run 37159463082, at 20b6d441b) passed this file (13 tests) among 43 files and 307 tests. services/platform/app/features/conversations/ is identical between 20b6d441b and 6524150fe.

    Disclosed residual gap, not a blocker: the failures are simulated inside the test with a fetch stub and an adapter spy. No local stack with a refusing upload service was run. The manager accepted this for the reconciliation.

    Closing as completed.

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

    bugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions