Repository navigation
Conversation
📝 WalkthroughWalkthroughRefactors terminal visible-snapshot fallback handling to support alternate-screen PTYs through prepared snapshots and headless emulation. Updates fallback decisions while excluding cursor transcript reads. Live and leaf terminal summaries now derive previews from visible snapshot content when applicable. Tests expand coverage for provider snapshots, headless output, retained output, cursor reads, serialization failures, and line limits. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.test.ts (1)
12777-12780: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert that the renderer serializer is never invoked.
not.toHaveBeenCalledWithpermits calls with different arguments, allowing this regression coverage to pass despite an unintended snapshot request.Proposed fix
- expect(nonblankSerializeBuffer).not.toHaveBeenCalledWith('pty-1', { - scrollbackRows: 0, - altScreenForcesZeroRows: false - }) + expect(nonblankSerializeBuffer).not.toHaveBeenCalled() - expect(shortBlankSerializeBuffer).not.toHaveBeenCalledWith('pty-1', { - scrollbackRows: 0, - altScreenForcesZeroRows: false - }) + expect(shortBlankSerializeBuffer).not.toHaveBeenCalled()Also applies to: 12905-12908
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
7397-7411: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLarge inline snapshot type is duplicated verbatim across two new functions.
The full snapshot shape (
data,cols,rows,cwd,lastTitle,seq,source,oscLinks,alternateScreen,scrollbackAnsi,pendingEscapeTailAnsi) is repeated inline as bothprepareVisibleSnapshotFallback's return type andreadVisibleSnapshotLines's parameter type. Extracting a shared type alias would remove the drift risk if this shape changes later (e.g. a new field added toserializeTerminalBuffer's return type would need to be manually mirrored in both places).♻️ Suggested extraction
+type VisibleTerminalBufferSnapshot = { + data: string + cols: number + rows: number + cwd?: string | null + lastTitle?: string + seq?: number + source?: 'headless' | 'renderer' + oscLinks?: TerminalOscLinkRange[] + alternateScreen?: boolean + scrollbackAnsi?: string + pendingEscapeTailAnsi?: string +} + private async prepareVisibleSnapshotFallback(ptyId: string): Promise<{ - snapshot: { ... } | null + snapshot: VisibleTerminalBufferSnapshot | null isAlternateScreen: boolean }> { ... } private async readVisibleSnapshotLines( ptyId: string, - snapshot: { ... } | null = null + snapshot: VisibleTerminalBufferSnapshot | null = null ): Promise<string[]> { ... }Also applies to: 7429-7442
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: cd6169a8-c847-4dce-b1e1-a494feaf318a
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
|
Closing as superseded — the linked issue(s) for this PR were fixed by another change that has already been merged.
Superseding merge: #9078 Thank you for the contribution! If anything remains unaddressed, please open a new issue or PR against current |
Summary
terminal readandterminal shownow surface the visible rows of active full-screen TUIs for provider-backed, headless, SSH, and remote-runtime terminals when no renderer serializer is mounted. First-call alternate-screen reads and previews now stay aligned even when retained transcript history is empty.The runtime still reuses its existing provider, headless, and renderer snapshot authority, while cursor pagination, normal-screen output, renderer-only blank-tail fallback, and
terminal liststay on their prior paths.Closes #8746.
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts- passed,Test Files 1 passed (1),Tests 709 passed (709)pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts -t "surfaces headless alternate-screen output through terminal read without renderer serializer"- passedpnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts -t "surfaces headless alternate-screen output through terminal show preview"- passedpnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts -t "keeps retained output when visible snapshots are unavailable"- passedpnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts -t "keeps first provider-backed alternate-screen read and show aligned when the retained transcript is empty"- passedpnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts -t "does not touch provider snapshots for first cursor reads on provider-preferred PTYs"- passedpnpm run typecheck:node- passedpnpm exec oxlint src/main/runtime/orca-runtime.ts src/main/runtime/orca-runtime.test.ts- passedpnpm exec oxfmt --check src/main/runtime/orca-runtime.ts src/main/runtime/orca-runtime.test.ts- passedAI Review Report
Security Audit
The change only selects and parses terminal snapshot data already available inside the runtime. Review verified bounded read and preview output, fail-open handling for unavailable snapshots, unchanged IPC exposure, and the absence of new command execution, filesystem access, authentication, secret handling, dependency, or renderer-trust risk.
Notes
terminal listkeeps its retained preview and does not serialize each listed terminal. Cursor-based reads remain transcript pagination. Full lint, full typecheck, full test, and build remain CI-gated. No UI or Electron code changes.ELI5
terminal read/showoften missed what a full-screen TUI was displaying. They now surface the visible alternate-screen rows for remote and headless terminals.