Files
tty7/crates
l0ng-ai c84f761783 fix(mobile): read frames cancel-safely so a slow link can't desync a stream (#1093)
read_frame awaits the header and the payload separately and keeps nothing
between them, so dropping it mid-frame discards the bytes it has read and
leaves the stream inside a payload. The next read takes terminal output for
a length: "Frame of 2086478377 bytes exceeds the limit" is `)"]|` off a
pane running jq, seen on a phone over 4G.

Three callers drop it routinely:
- the phone app batches output with timeout(16ms, PaneReader::next), which
  fires whenever a large frame is still arriving on a slow link;
- the gateway's control and pane loops race it in select! against outgoing
  events and output, so a paste while a pane prints can lose input bytes.

Add FrameReader to tty7-mobile-proto: it keeps a partial frame in a Decoder
and only awaits a single read(), which takes nothing when dropped. Use it in
PaneReader, ControlReceiver and both gateway loops. read_frame stays for the
one-shot reads whose stream is abandoned on a timeout, and says so.
2026-10-04 16:17:40 +08:00
..