Problem
When the message composer submits a message and the hub responds with a 4xx or 5xx, the composer clears the input -- the operator's typed text is gone. This is destructive on errors, which is exactly when the operator most needs their input retained so they can retry or save it.
Example: composer fires POST /api/sessions/:id/messages, hub returns 503 during a restart -> text discarded.
Proposal
Don't clear the composer on error. Only clear on a successful 2xx.
Recommended approach:
- Optimistically render the message as "sending" but keep a copy of the input bound.
- On
2xx -- clear input, finalise the optimistic render.
- On
4xx / 5xx / network error -- restore the input (don't ever destroy it), surface the error inline, allow retry.
Acceptance
Notes
Problem
When the message composer submits a message and the hub responds with a 4xx or 5xx, the composer clears the input -- the operator's typed text is gone. This is destructive on errors, which is exactly when the operator most needs their input retained so they can retry or save it.
Example: composer fires
POST /api/sessions/:id/messages, hub returns 503 during a restart -> text discarded.Proposal
Don't clear the composer on error. Only clear on a successful
2xx.Recommended approach:
2xx-- clear input, finalise the optimistic render.4xx/5xx/ network error -- restore the input (don't ever destroy it), surface the error inline, allow retry.Acceptance
Notes
web/src/components/Composer*.tsx(or wherever the message composer lives) foronSubmit+ setState reset order.