Hard problem 01
The chat that never stopped loading
- Problem
- Some runs left an endless loader, or a tool indicator that never cleared. The causes crossed the agent backend, the streaming transport and the React chat state.
- What I did
- Traced the failure paths end to end, backend to UI, instead of patching the symptom.
- A connect fast path: reopening a chat no longer builds a full agent or waits on an MCP handshake.
- Deadlines composed below the platform’s kill limit, so the service always times out first and can say so.
- A finished event on every code path, an orphan guard, single-flight agent construction, and model-stream errors sanitized instead of left hanging.
- In the UI, a run-phase state machine and a bounded connect phase with retry replaced implicit loading flags.
- Result
- Closed by coordinated backend and UI changes in Aug 2026, with two postmortems. No before-and-after incident rate was measured.