fix(agent): preserve messages until send succeeds#3766
Conversation
|
😎 Merged successfully - details. |
9dbd327 to
b27454c
Compare
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/ui/src/features/sessions/components/SessionView.tsx:320-321
**Successful send clears newer draft**
When a user starts typing the next message while the previous request is pending, the successful-send path unconditionally clears the live editor, erasing the newer message and its saved draft.
### Issue 2 of 2
packages/ui/src/features/sessions/components/SessionView.tsx:315-318
**State guard permits duplicate sends**
When two submission events occur before React commits the first state update, both callbacks read `isSendingPrompt` as false and start a request, causing duplicate agent prompts or a duplicate queued message.
Reviews (1): Last reviewed commit: "fix(agent): preserve messages until send..." | Re-trigger Greptile |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
84a2384 to
427da82
Compare
There was a problem hiding this comment.
Low-risk UI fix to composer clear/resend logic; the two Greptile P1 concerns (duplicate sends, clearing a newer draft) are both visibly addressed in the diff via the sync ref lock and content-comparison guard, and Greptile reacted 👍 to the fixes. Test coverage added for the failed-send path.
- Author wrote 0% of the modified lines and has 10 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 46L, 2F substantive, 64L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (64L, 3F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 72fff49 · reviewed head 427da82 |
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
Problem
A failed message request can clear the composer before the server acknowledges it, leaving users without the text they attempted to send.
Changes
Keep composer content in place while a message is being sent. Disable repeat submission during the request and clear the composer only after a successful acknowledgement.