Problem
When the message composer submits and the hub responds with a 4xx or 5xx (or the fetch fails outright), the composer clears the input -- the operator's typed text is destroyed. This is destructive at exactly the moment the operator most needs their text retained so they can retry without losing what they wrote.
Example: composer fires POST /api/sessions/:id/messages, hub returns 503 during a restart -> text discarded.
This is reproducible during any hub restart blip. @assistant-ui/react's composer clears composer.text synchronously the moment send is invoked, so by the time useSendMessage's mutation rejects the input is already gone.
Proposal
Don't clear the composer on error. Only clear on 2xx.
- On
2xx - clear input, finalise the optimistic render (today's behaviour).
- On
4xx / 5xx / network error - restore the input (don't destroy it), surface the error inline, allow retry.
- The operator can edit the retained text and retry without retyping.
Acceptance
Notes
- Composer wiring lives in
web/src/components/AssistantChat/HappyComposer.tsx and web/src/hooks/mutations/useSendMessage.ts.
- A small visual on the composer (red ring + inline error message) is welcome alongside text retention so the failure is obvious.
Problem
When the message composer submits and the hub responds with a 4xx or 5xx (or the fetch fails outright), the composer clears the input -- the operator's typed text is destroyed. This is destructive at exactly the moment the operator most needs their text retained so they can retry without losing what they wrote.
Example: composer fires
POST /api/sessions/:id/messages, hub returns 503 during a restart -> text discarded.This is reproducible during any hub restart blip.
@assistant-ui/react's composer clearscomposer.textsynchronously the moment send is invoked, so by the timeuseSendMessage's mutation rejects the input is already gone.Proposal
Don't clear the composer on error. Only clear on
2xx.2xx- clear input, finalise the optimistic render (today's behaviour).4xx/5xx/ network error - restore the input (don't destroy it), surface the error inline, allow retry.Acceptance
Notes
web/src/components/AssistantChat/HappyComposer.tsxandweb/src/hooks/mutations/useSendMessage.ts.