Skip to content

Defer desktop media uploads until send - #4522

Open
klopez4212 wants to merge 17 commits into
mainfrom
kennylopez-desktop-background-uploads
Open

Defer desktop media uploads until send#4522
klopez4212 wants to merge 17 commits into
mainfrom
kennylopez-desktop-background-uploads

Conversation

@klopez4212

@klopez4212 klopez4212 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • send desktop messages immediately while media uploads continue in background state across channel navigation
  • show immediate progress above the composer and keep Jump to latest above it
  • report the real media stages as Preparing, Processing, Converting, Uploading, and Finishing
  • use Buzz's shared spinner during local media work, then switch to the real percentage when byte transfer begins
  • animate phase-label and status-suffix changes without overlap or layout jumps
  • keep cancel, progress fill, message publication, and community-reset behavior coordinated with the background task
  • use raw Tauri IPC for large browser files so renderer-side byte serialization does not block initial feedback

Why

Desktop previously blocked sending while attachments uploaded in the composer. Large videos could also pause the renderer before progress appeared, and the progress pill said Uploading while native media processing was still underway. This makes the initial response immediate and describes the work actually happening.

Validation

  • cd desktop && pnpm check
  • cd desktop && pnpm typecheck
  • cd desktop && pnpm test (3,931 passed)
  • cd desktop && pnpm exec vite build --mode e2e
  • cd desktop && pnpm exec playwright test tests/e2e/file-attachment.spec.ts --project=smoke (11 passed)
  • focused native media tests (80 passed)
  • native Clippy with all targets and features
  • pre-push native suite (2,107 passed, 14 ignored; 3 diagnostics passed)

Updated phase snapshots are included in the PR comments.

Split from #4512 so the desktop and mobile changes can be reviewed independently.

Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026
@klopez4212
klopez4212 marked this pull request as ready for review August 3, 2026 13:15
@klopez4212
klopez4212 requested a review from a team as a code owner August 3, 2026 13:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9bd50eca0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/useMediaUpload.ts
Comment thread desktop/src/features/messages/ui/submitMessageEdit.ts Outdated
Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if (draft.sentDraftKey) {
drafts.markDraftSent(
draft.sentDraftKey,

P1 Badge Avoid clearing a newer persisted draft after upload completion

With a slow queued upload, a user can submit one message, begin another in the same channel, and navigate away, causing the newer text to be persisted under the same draft key. When the first upload later succeeds, this delayed call reaches markDraftSentEntry, which unconditionally calls clearDraftEntry, deleting that newer draft; the completion needs to clear only the captured draft version rather than whichever entry currently owns the key.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/useMentionSendFlow.ts
Comment thread desktop/src/features/messages/ui/MessageComposer.tsx Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60022c5487

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Comment thread desktop/src/features/messages/ui/MessageComposer.tsx
Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96fa445edc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/ComposerAttachments.tsx
Comment thread desktop/src-tauri/src/commands/media_raw.rs Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026
Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 891fc43fb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/MessageComposer.tsx
Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5697f36ada

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>
klopez4212 added a commit that referenced this pull request Aug 3, 2026
@klopez4212

Copy link
Copy Markdown
Contributor Author

🤖 Updated desktop upload-status snapshots using Buzz's shared loading spinner.

Processing

Local media work uses the shared indeterminate arc spinner instead of a misleading percentage.

processing-spinner

Uploading

The spinner transitions to byte-transfer progress once the upload begins.

uploading-percentage

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d47e8d6f29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>
…ckground-uploads

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f1b3e69bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/useMentionSendFlow.ts
Comment thread desktop/src/features/messages/ui/submitMessageEdit.ts Outdated
Comment thread desktop/src/shared/api/tauriMedia.ts Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>
…ckground-uploads

Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3de2e6c74b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Comment thread desktop/src/features/messages/ui/submitMessageEdit.ts Outdated
Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dddbec2bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/lib/backgroundMediaUploadStore.ts
Comment thread desktop/src/features/messages/ui/useMentionSendFlow.ts
Comment thread desktop/src-tauri/src/commands/media.rs
Signed-off-by: kenny lopez <klopez4212@gmail.com>
…ckground-uploads

Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

transcode_heic_path_to_jpeg_bytes(&tmp_input).map(|jpeg| (jpeg, None))

P2 Badge Pass cancellation into HEIC conversion

When the queued file is HEIC/HEIF, this final-tree branch still invokes the timeout-only transcode_heic_path_to_jpeg_bytes, unlike the video branch that now receives the cancellation token. Canceling during conversion therefore removes the task and progress UI but leaves ffmpeg consuming CPU and temporary disk until conversion completes or its 60-second timeout expires; use the cancellable ffmpeg path here as well.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/MessageComposer.tsx Outdated
@klopez4212

Copy link
Copy Markdown
Contributor Author

🤖 @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b63f42b1f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/messages/ui/MessageComposer.tsx Outdated
Signed-off-by: kenny lopez <klopez4212@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

transcode_heic_path_to_jpeg_bytes(&tmp_input).map(|jpeg| (jpeg, None))

P2 Badge Stop HEIC conversion when its upload is canceled

When a queued HEIC/HEIF attachment is canceled during the converting-image phase, this calls the timeout-only transcode helper without the task's cancellation token. The UI and task disappear immediately, but ffmpeg continues consuming CPU and temporary disk until conversion finishes or reaches its 60-second timeout; pass cancellation through the HEIC transcode path as is already done for video conversion.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

) {
return;
}
drafts.persistDraft(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain queued files when recovering an off-channel send

After a deferred send starts, if the user switches channels before the upload fails or is canceled, restoreComposerAfterFailure deliberately skips the live composer because its channel differs, while this persistence path stores only the text and previously uploaded savedImeta. The captured queuedAttachments are therefore discarded, so returning to the originating channel restores at most the text and silently loses the selected local files; keep an in-memory per-draft recovery entry or otherwise preserve those files until the user revisits the draft.

Useful? React with 👍 / 👎.

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.

1 participant