Repository navigation
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Remote clients repeatedly receive the same terminal-tab metadata, which can leave file browsing waiting behind background updates on a slow link. This reduces that metadata without compressing private text or skipping updates: a synthetic 17-terminal workload uses 49.2% fewer bytes.
What Changed
An authenticated desktop subscription can advertise
remote-runtime.snapshot-deflate.v1. The host then compresses only the structure ofsession.tabs.subscribe/subscribeAllreplies before the existing encryption step; the client restores the original result before normal validation and routing. Titles, paths, prompts, messages, unknown fields and unknown field names travel separately, uncompressed but still encrypted. Old peers and explicit opt-out keep the original replies.The codec uses fresh level-1 compression contexts, caps input/restored results at 256 KiB, bounds decompression and literal references, and retains the existing outbound queue limits. Terminal bytes, file responses, authentication, connection ownership and state ordering are unchanged. Malformed compressed replies fail visibly and close the subscription.
Why
The real desktop path encrypts JSON before WebSocket transmission. Enabling WebSocket compression alone would mostly remove base64 overhead, rather than compressing repeated JSON. Compressing the entire plaintext snapshot would create a same-message secret/attacker-input length oracle, since agent status includes prompts and messages. The separate uncompressed text array avoids that correlation; fresh dictionaries alone would not. This approach also avoids introducing state deltas, dropping intermediate updates, or changing the transport scheduler.
This is a focused improvement to the inventory stream, not a claim that the reporter's deployment is fully fixed. Its stream attribution and actual WAN behavior have not been reproduced.
Linked Issue
Refs #22151. Kept open because real-deployment confirmation and other subscription/replay traffic remain outside this PR's evidence.
Visual Proof
N/A — no UI layout or rendering changes. The proof is encrypted transport integrity plus reproducible bandwidth measurements; no user runtime or visible application windows were touched.
Testing
CI status: the upstream pull-request workflows require maintainer approval and have not executed. Local validation below is not a claim of green upstream CI.
macOS arm64 / Node 24.18.0: 15 focused suites, 113 tests passed, including real localhost WebSocket + E2EE roundtrips, current/legacy capability combinations, explicit opt-out, reconnect to current state, malformed compressed data, exact snapshot and terminal-byte integrity, incompressible traffic, queue overflow/drain, and equal-length secret/attacker-input noninterference. Unknown fields and
__proto__roundtrip without entering the compression dictionary. Existing socket auth, heartbeat, shared-control subscription and backpressure suites also pass.ORCA_BACKGROUND_LAUNCH=1 pnpm tc:node,pnpm tc:cli, andpnpm run check:code-quality:changed origin/mainpass;git diff --cached --checkpasses. The full application build and full test suite were not run. Windows/Linux/SSH-host execution and rendered Electron checks were not run; the required electron skill is unavailable.Reproduce the benchmark:
ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \ src/main/runtime/rpc/runtime-bandwidth.test.ts \ src/shared/remote-runtime-snapshot-compression-cost.test.ts \ --maxWorkers 1 --disableConsoleInterceptThe workload is typed session-tab metadata with distinct IDs, titles, paths and agent statuses, plus 2.1 KB/s of terminal payload. Three 34-second cycles each contain 30 seconds of 500 ms snapshot updates and a four-second 100 ms burst; small file-list/file-read replies share the connection twice per second. Actual E2EE payload lengths and WebSocket headers feed a deterministic FIFO model at 0.8 Mbps and 74 ms RTT. These are modeled RPC delays, not measured WAN latency; loss, TCP/VPN overhead, kernel buffering, handler time and encoder scheduling are excluded.
The 17-terminal baseline averages 60.1 KB/s. Regression targets are at least 40% fewer bytes, at least 80% lower modeled p95, max below one second, and peak modeled backlog below 128 KiB. These replace the initial 70% reduction proposal to preserve confidentiality. Every snapshot and terminal frame is retained and verified.
Review follow-up: input-side JSON structural limits now return the original uncompressed response, just like output-side capacity limits; invalid JSON still throws. The deep-input regression failed before the fix and passed afterward. Node 26.9.0's larger compressed output measured 119/131/525 ms p95, 119/133/754 ms maxima, and 8,990/10,514/72,534-byte peak queues for 15/17/20 terminals. The previous 500 ms / 64 KiB thresholds were Node-24-specific; the portable acceptance criteria above preserve a subsecond maximum and large relative improvement without requiring identical zlib output. The codec and benchmark passed 14 tests on Node 26; the three benchmark cases also passed on Node 22.22.0 and Node 24.18.0.
The separate 500-message encoder measurement used 231 ms of CPU (0.46 ms/message), 8.9 MB peak sampled heap growth, 87 KB retained heap growth after GC, and 19.9 MB RSS growth; wall p95/max were 1.29/11.27 ms on this shared development host. These are diagnostic measurements, not portable limits; native allocator retention contributes to RSS. Compression is synchronous with no retained peer dictionaries or added work queue.
Full contract, test commands, bounds and measurements: remote runtime bandwidth reference.
October 22 integration: merged main at
70ab09ca2fb3, preserving the current asynchronous authenticated handshake, credential-revision checks, mobile execution-host routing, and bounded replies. Capability negotiation and explicit opt-out now run through the current handshake. Updated the loopback fixtures to use the current connection and authenticated-principal contracts. The 14 relevant suites pass 88 tests, covering codec bounds and confidentiality, real encrypted WebSocket roundtrips, legacy/opt-out behavior, backpressure, shared-control keepalives, device-key authorization, and reply-size guards. Node, web, CLI and process-host test typechecks pass; changed-code quality has zero findings across 16 code files, and commit lint/React Doctor/formatting hooks pass. The synthetic bandwidth regression still satisfies its 40% minimum reduction and latency/backlog bounds; this does not establish real WAN performance or close #22151. No rendered UI, native Windows/Linux, physical devices, or live SSH acceptance was run.AI Disclosure
Implemented and tested with OpenAI Codex.
Review
Readiness audit follow-up: reproduced the two failing existing socket-auth assertions and updated their exact expected capability lists for the new default. Added an authenticated WebSocket dispatch-boundary test covering negotiated runtime compression, legacy runtime replies, and unchanged mobile replies. The client, dispatch-boundary and encrypted integration suites pass 31 tests across 3 files. Node typecheck and changed-code quality were rerun for this change.
Self-reviewed the authenticated capability boundary, exact reconstruction, private-text separation, malformed input bounds, and mixed-version fallback. Coordinator reviewed the design and confidentiality mitigation.
Agent skill upstream boundary
Notes
No OS-specific behavior, new native dependencies, local execution fallback, or Git-worktree assumption. Ordinary traffic size and public structural-state changes remain observable; this is not padded traffic-analysis protection. Free-text-heavy/oversized snapshots, terminal replay, unrelated streams and incompressible traffic can still saturate a link; this PR adds no universal latency guarantee or priority scheduler.
Rollback by disabling subscription capability advertisement (
snapshotCompression: false) or returning legacy replies from the host wrapper. No persisted state or migration is involved; reconnect needs no prior dictionary. Keep the decoder during a staged rollback while capable hosts may still send negotiated replies.Checklist