Repository navigation
composer: restore typed text when thread:send fails - #73
Closed
Yash990-bit wants to merge 1 commit into
Closed
Yash990-bit wants to merge 1 commit into
Yash990-bit wants to merge 1 commit into
Conversation
This was referenced Oct 20, 2026
This was referenced Oct 31, 2026
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.
Summary
In
Composer.tsx, hitting Enter or clicking Send immediately calledsetText("")before awaiting the send operation. Whenthread:sendfails (e.g. runner is busy, working directory was removed, or an IPC error occurs), an error toast is surfaced to the user, but their typed message had already been wiped from the composer box.This PR ensures that
Composerpreserves the typed message and restores it ifonSendresolves tofalse(or rejects), while also keeping the unsent text state inApp.tsxsynchronized so the message is not lost across thread re-renders.What Changed
Composer.tsx:Props.onSendto acceptPromise<boolean | void> | boolean | void.submit()clears the box for immediate perceived responsiveness, but stores the typed text and restores it with focus ifonSendreturnsfalseor throws.submittingRefguard to prevent accidental duplicate submissions during an in-flight send.App.tsx:send()andsendDraft()now returnPromise<boolean>(trueon{ ok: true },falseon failure).setUnsentFor()saves the text for the thread (or newly created thread from draft) so switching or re-renders keep the user's input intact.ThreadView.tsx&DraftView.tsx:onSendprop signature to match.e2e/app.spec.ts:thread:sendfails (tested via missing worktree cwd), the error toast is surfaced and the composer restores the exact typed message.Testing
npm run build: built cleanly with no TypeScript or bundling errors.npm test: all 180 unit and engine tests pass.npx playwright test e2e/app.spec.ts: all 14 end-to-end browser tests pass.