fix: 7 core-interaction bugs (silent send loss, image/speech robustness)#130
Merged
Conversation
Seven correctness bugs in the session composer: - sessions.ts sendMessage: await the prompt submission and rethrow on failure instead of a fire-and-forget .catch(), so handleSend's existing restore-draft-and-alert catch actually runs. - pasteFromClipboard: route pasted images through toJpeg() so they get the same resize/compress treatment as picked/captured photos. - pickFromLibrary/pickFromCamera: wrap toJpeg() in try/catch (and switch to Promise.allSettled for the multi-select batch) so one bad asset doesn't silently drop the whole batch; surface a new imageFailed alert. - pickFromLibrary: cap selection at 10 images. - useSpeech: abort the native recognition session on unmount so the mic doesn't stay hot after leaving the screen. - Surface useSpeech's error via Alert, keyed on the error value so it fires once per distinct error. - Undo on the revert banner now also clears the composer, since it was prefilled by the edit flow and could otherwise be sent as a duplicate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T12AhSnQVrSxNnvwfCx2z6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seven verified correctness bugs from an adversarial review of edit/revert, image attachments, and speech input. All confirmed against the code; typecheck clean, 193 tests pass.
High impact
sendMessagefire-and-forgot the prompt POST, sohandleSend's restore-draft + "Message not sent" alert was dead code. On a flaky network the composer cleared, the optimistic bubble vanished, and the text/photos were gone silently. NowsendMessageawaits submission (fast —/prompt_asyncresolves before the streamed response) and rethrows, so the draft restores and the user gets an alert.Image attachments
2. Clipboard-pasted images skipped resize/compression (full-res PNG data URIs → huge payloads). Now routed through
toJpeg.3. Unguarded conversion dropped photos silently; one bad asset in a multi-select discarded the whole batch. Now try/catch +
Promise.allSettled+ a failure alert.4. No image-count cap → OOM risk on huge selections. Added
selectionLimit: 10.Speech
5. Recognition was never stopped on unmount — mic stayed hot (privacy indicator on, battery drain). Added an unmount
abort().6. Speech errors (mic-permission-denied, recognition failures) were captured but never shown. Now alerted.
Edit/revert
7. "Undo" after an Edit left the composer prefilled → tapping Send created a duplicate. Undo now clears the composer.
i18n en+zh kept in parity (new
imageFailed*/speechError*keys).🤖 Generated with Claude Code
https://claude.ai/code/session_01T12AhSnQVrSxNnvwfCx2z6