mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-10-06 08:02:04 +00:00
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.