fix(dgw): TRP live-shadow sizing + large-line panic#1816
Conversation
Let maintainers know that an action is required on their side
|
… panic
Two TRP-only shadow-streaming bugs:
1. Size header was emitted with width/height swapped and non-standard row/col keys (read columns from bytes[2..4] instead of [0..2]). Read columns from [0..2], rows from [2..4], and emit a standard asciicast v2 {width,height} header so clients size the terminal correctly.
2. AsyncReadChannel::poll_read copied an entire decoded line into the caller's ReadBuf without bounds, panicking when a line exceeded the buffer (e.g. a full-screen htop redraw > 8 KiB). Copy only what fits and buffer the remainder across reads.
Post-setup resize events emitted stale dimensions because header.col/row were only updated before setup. Read the size payload in both cases.
7546d9b to
8ba6c42
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes two TRP-only issues in the terminal “live-shadow” streaming path by correcting terminal sizing metadata in emitted asciicast JSON and preventing panics when decoded lines exceed the caller’s read buffer.
Changes:
- Make
AsyncReadChannel::poll_readhandle oversized decoded messages by buffering unread remainder across reads (avoids panics on large redraw lines). - Fix TRP resize decoding to read
[columns, rows]and emit standard asciicast v2 header fields (width/height) instead of non-standardrow/col.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/terminal-streamer/src/trp_decoder.rs | Adds buffering for oversized decoded lines; fixes TRP resize payload decoding and resize event emission logic. |
| crates/terminal-streamer/src/asciinema.rs | Updates header JSON to standard asciicast v2 width/height fields with correct axis mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Two TRP-only shadow-streaming fixes (cast path unaffected):
{width, height}header with the correct axis. The decoder read columns from the wrong half of the size-change payload and emitted non-standardrow/col, so clients sized the terminal transposed.AsyncReadChannel::poll_readcopied a whole decoded line into the caller'sReadBufunchecked, panicking when a line exceeded it (e.g. an htop full-screen redraw > 8 KiB). Now copies what fits and buffers the rest across reads.