Skip to content

Bug: composer 4xx/5xx clears typed text - must retain on error #15

@heavygee

Description

@heavygee

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:

  1. Optimistically render the message as "sending" but keep a copy of the input bound.
  2. On 2xx -- clear input, finalise the optimistic render.
  3. On 4xx / 5xx / network error -- restore the input (don't ever destroy it), surface the error inline, allow retry.

Acceptance

  • Submit -> 500/502/503/network error -> composer text is not cleared
  • Submit -> 400/401/403 -> composer text is not cleared, error surfaces inline
  • Submit -> 2xx -> composer clears as today
  • Operator can edit the retained text and retry without re-typing

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions