fix(mobile): restore the composer message when a send fails (port #3785) - #3787
Merged
trunk-io[bot] merged 1 commit intoJul 27, 2026
Merged
Conversation
Previously the mobile task composer cleared the typed text and attachments on submit and fire-and-forgot the send. A failed send (network/API error) only logged and showed an alert — the user's message and any picked attachments were lost. The send path now reports success/failure back to the composer across every branch of handleSendPrompt (queued-message edit, terminal-session resend, queue mode, steer/interrupt, and normal send). The composer still clears immediately and stays responsive; on failure it restores the submitted text and attachments, but only when the composer is still empty (the user hasn't started a new draft) and the failed submission is still the latest one (guarded by a monotonic submission id). The decision logic lives in a small pure helper module with Vitest coverage. Ports desktop PRs #3766 and #3785 to the mobile app. Generated-By: PostHog Code Task-Id: d27aba44-dcf9-4ed7-b588-128490732718
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
estefaniarabadan
approved these changes
Jul 27, 2026
trunk-io
Bot
deleted the
posthog-code/mobile-restore-composer-on-send-failure
branch
July 27, 2026 14:07
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.
Problem
On the mobile task composer, a failed send silently lost the user's work.
handleSendcleared the typed text and attachments and fire-and-forgot the send; whenhandleSendPromptrejected (network/API error) it only logged and showed a "Failed to send" alert — the message and any picked attachments were already gone.Changes
Ports the desktop behaviour from #3766 and #3785 (
fix(agent): preserve messages until send succeedsand its follow-upfix: clear sent messages without blocking the composer) to the mobile app.onSend/handleSendPromptreturnPromise<boolean>across every branch — queued-message edit, terminal-session resend, queue mode, steer/interrupt, and the normal send.submitComposerMessage.ts) so it is unit-testable without rendering React Native components.pendingPromptRecoveryStorenew-task recovery flow, haptics, keyboard dismissal, andtrackPromptSentanalytics.How did you test this?
submitComposerMessage.test.ts): successful send clears and stays cleared; failed send restores text + attachments; failed send does not restore when a new draft has been typed; a stale failure does not clobber a newer submission;isComposerEmptycases.pnpm --filter @posthog/mobile test— full mobile suite, 494 tests passing.biome checkclean on the changed files.Automatic notifications
Created with PostHog Code