SIGN IN SIGN UP

fix(screentracker): make writeStabilize Phase 1 non-fatal when agents don't echo input (#208)

Fixes #123.

- Make Phase 1 (echo detection) of `writeStabilize` non-fatal on timeout -- proceed to Phase 2 instead of returning HTTP 500
- Guard non-fatal path with `errors.Is(err, util.WaitTimedOut)` so context cancellation still propagates
- Reduce Phase 1 timeout from 15s to 2s (terminal echo is near-instant)
- Extract `writeStabilizeEchoTimeout` and `writeStabilizeProcessTimeout` constants
- Log at Info level (not Warn) since non-echoing agents hit this on every message
- Add doc comment on `formatPaste` in `claude.go` documenting the ESC limitation with TUI selection prompts
- Add tests for non-echoing agents (reacts, unresponsive, context-cancelled)

## Known limitation

For TUI selection prompts (numbered/arrow-key lists), this fix eliminates the 500 but does **not** deliver the correct selection -- the `\x1b` (ESC) in bracketed paste cancels the selection widget. The correct approach is `MessageTypeRaw`. Documented via a comment on `formatPaste` in `lib/httpapi/claude.go`.

Also discovered a separate issue during smoke-testing: #209 (fixed in #215, included in this branch).

> 🤖 Written by a Coder Agent. Reviewed by several humans and a veritable army of robots.


Co-authored-by: 35C4n0r <70096901+35C4n0r@users.noreply.github.com>
C
Cian Johnston committed
00ff7ffdc4badcf68b3903dd799cf6e2d4370d86
Parent: d42b9ac
Committed by GitHub <noreply@github.com> on 4/10/2026, 11:34:40 AM