Repository navigation
fix(terminal): bound paired-client renderer work - #12081
Conversation
b462c1f to
86459ea
Compare
📝 WalkthroughWalkthroughThe runtime now filters decorative title events independently for each listener while preserving non-title terminal facts. The renderer separates remote output gating from pause support, handles Mode-2031 subscription facts, skips hidden output, and restores serialized output after visibility returns. Tests cover paired-client title delivery and legacy hosts that cannot pause output. Reliability-gate documentation adds assertions, evidence runs, performance bounds, known gaps, and demotion conditions. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Greptile SummaryThis PR fixes two independent but related over-delivery problems in the paired-terminal renderer path. Both are verified by new deterministic unit tests and the updated headed/headless integration oracles.
Confidence Score: 5/5Safe to merge — both change paths are narrow and independently tested; no shared state regressions identified. The changes are well-scoped: the per-listener title gate is a pure additive filter over an existing delivery loop with correct init/cleanup on subscribe and PTY disposal, and the legacy host gating simply extends an already-exercised snapshot-restore path to a class of host that previously fell through an early-return branch. New unit tests cover the 64-PTY decorative bound, late-subscriber recovery, semantic-fact preservation, and the full legacy hidden-output shape. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Adds per-listener title deduplication gate for terminalSideEffects client events; renames makeMobileTitleGateKey to makeDecorativeTitleGateKey; cleanly separates excluded-listener logic from new title-gate logic; PTY tracker disposal propagates correctly to all listener maps. |
| src/renderer/src/components/terminal-pane/pty-connection.ts | Splits remoteOutputPausedPtyId into remoteOutputGatedPtyId + remoteOutputFactConsumerPtyId to separate output gating from side-effect consumer registration; legacy hosts (supported=false) now gate hidden xterm writes locally and trigger snapshot restore on reveal; capable-host path behaviorally unchanged. |
| src/main/runtime/orca-runtime.test.ts | Adds a 64-PTY x 10-frame synthetic title test validating zero decorative client events after first semantic frame, per-client late-subscriber recovery, semantic bell and idle transitions on both clients, and full local frame preservation. |
| src/renderer/src/components/terminal-pane/pty-connection.test.ts | Adds a legacy-host test that validates hidden xterm writes are suppressed when setOutputPaused returns false, a single authoritative snapshot is written on reveal, and post-reveal live data flows normally. |
| config/reliability-gates.jsonc | Updates invariant, oracle, coverage notes, demotion rule, and red/green evidence to cover the 64-PTY title bound and legacy no-output-pause gating; adds three new evidence runs; adds a gap note about legacy packaged-host full-headed oracle coverage. |
Reviews (1): Last reviewed commit: "fix(terminal): bound remote hidden rende..." | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bd915f04-a42c-4ae0-a71d-ae7e6ed17275
📒 Files selected for processing (5)
config/reliability-gates.jsoncsrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.ts
| expect(transport.setOutputPaused).toHaveBeenLastCalledWith(false) | ||
| expect(transport.serializeBuffer).toHaveBeenCalledWith({ scrollbackRows: 5000 }) | ||
| callbacks.onData?.(live, { | ||
| seq: hidden.length + live.length, | ||
| rawLength: live.length | ||
| }) | ||
| await flushAsyncTicks(20) | ||
|
|
||
| const written = pane.terminal.write.mock.calls.map((call) => String(call[0])).join('') | ||
| expect(written).toContain(snapshot) | ||
| expect(written).toContain(live) | ||
| expect(written).not.toContain(hidden) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the single-snapshot bound.
toHaveBeenCalledWith passes if the connection serializes more than once. Add an exact call-count assertion after the live chunk.
Based on PR objectives, reveal must restore one authoritative snapshot.
Proposed test assertion
expect(written).toContain(snapshot)
expect(written).toContain(live)
expect(written).not.toContain(hidden)
+ expect(transport.serializeBuffer).toHaveBeenCalledTimes(1)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| expect(transport.setOutputPaused).toHaveBeenLastCalledWith(false) | |
| expect(transport.serializeBuffer).toHaveBeenCalledWith({ scrollbackRows: 5000 }) | |
| callbacks.onData?.(live, { | |
| seq: hidden.length + live.length, | |
| rawLength: live.length | |
| }) | |
| await flushAsyncTicks(20) | |
| const written = pane.terminal.write.mock.calls.map((call) => String(call[0])).join('') | |
| expect(written).toContain(snapshot) | |
| expect(written).toContain(live) | |
| expect(written).not.toContain(hidden) | |
| expect(transport.setOutputPaused).toHaveBeenLastCalledWith(false) | |
| expect(transport.serializeBuffer).toHaveBeenCalledWith({ scrollbackRows: 5000 }) | |
| callbacks.onData?.(live, { | |
| seq: hidden.length + live.length, | |
| rawLength: live.length | |
| }) | |
| await flushAsyncTicks(20) | |
| const written = pane.terminal.write.mock.calls.map((call) => String(call[0])).join('') | |
| expect(written).toContain(snapshot) | |
| expect(written).toContain(live) | |
| expect(written).not.toContain(hidden) | |
| expect(transport.serializeBuffer).toHaveBeenCalledTimes(1) |
Summary
Reproduction
The pre-fix 64-PTY title harness delivered 576 client events after the first semantic frame. The fixed path delivers zero after convergence while retaining all 640 local frames.
The pre-fix legacy protocol harness kept hidden bytes on the xterm path and never requested a reveal snapshot. The fixed path performs no hidden xterm writes, restores the authoritative snapshot once, and continues live output.
Verification
Behavior and risk
Current hosts keep host-side output pause and ordinary parking unchanged. Visible terminals and local title animation are unchanged. Older hosts still transport hidden raw bytes because they cannot understand the pause opcode, but the client no longer feeds those bytes through xterm; reveal pays one bounded snapshot repaint to recover exact visible state.