Skip to content

fix(dgw): TRP live-shadow sizing + large-line panic#1816

Merged
Benoît Cortier (CBenoit) merged 5 commits into
masterfrom
fix/trp-shadow-streaming
Jun 17, 2026
Merged

fix(dgw): TRP live-shadow sizing + large-line panic#1816
Benoît Cortier (CBenoit) merged 5 commits into
masterfrom
fix/trp-shadow-streaming

Conversation

@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor

Two TRP-only shadow-streaming fixes (cast path unaffected):

  • Sizing: emit a standard asciicast {width, height} header with the correct axis. The decoder read columns from the wrong half of the size-change payload and emitted non-standard row/col, so clients sized the terminal transposed.
  • Panic: AsyncReadChannel::poll_read copied a whole decoded line into the caller's ReadBuf unchecked, 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.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) marked this pull request as ready for review June 12, 2026 16:23
… 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.
@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) changed the title fix(terminal-streamer): TRP live-shadow sizing + large-line panic fix(dgw): TRP live-shadow sizing + large-line panic Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_read handle 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-standard row/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.

Comment thread crates/terminal-streamer/src/trp_decoder.rs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread crates/terminal-streamer/src/trp_decoder.rs Outdated

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread crates/terminal-streamer/src/trp_decoder.rs Outdated
@CBenoit Benoît Cortier (CBenoit) enabled auto-merge (squash) June 17, 2026 15:18
@CBenoit Benoît Cortier (CBenoit) merged commit 9a0c1e6 into master Jun 17, 2026
42 checks passed
@CBenoit Benoît Cortier (CBenoit) deleted the fix/trp-shadow-streaming branch June 17, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants