Repository navigation
Prevent hidden terminal TUI overlap - #7054
Conversation
Co-authored-by: Orca <[email protected]>
|
Ready to review this PR? Stage has broken it down into 5 individual chapters for you: Chapters generated by Stage for commit 84da95d on Jul 1, 2026 11:05pm UTC. |
📝 WalkthroughWalkthroughChangesThis PR unifies the terminal output scheduler's parsed-callback handling by renaming Sequence Diagram(s)Diagrams included above within the hidden review stack artifact illustrate the onParsed callback propagation and hidden output atlas recovery decision flow. Related PRs: None specified. Suggested labels: area:terminal, area:testing Suggested reviewers: None specified. 🐰 A callback hopped through queues so neat, 🚥 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.ts (1)
486-542: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the multi-fire semantics of
onParsedfor split chunks.When a single queued write exceeds the take limit, the split remainder retains
chunk.onParsedvia the{ ...chunk, ... }spread (Line 512-515), so the same caller-suppliedonParsedgets pushed intoparsedCallbacksagain on the nexttakeQueuedChunkcall. A single logical write can therefore invoke the caller'sonParsedmore than once (once per underlyingterminal.writesplit), which is non-obvious from reading the code and differs from "notified once when my data is parsed" intuition. This is exercised by the new "keeps parsed callbacks on large background chunks split by the scheduler" test, so it's intentional — but a short comment here would save future readers from re-deriving this.📝 Suggested comment
data += chunk.data.slice(0, remaining) + // Why: keep onParsed on the retained remainder so large writes that get + // split across multiple terminal.write calls still fire once per split + // segment (callers must tolerate multiple invocations for one write()). if (chunk.onParsed) { parsedCallbacks.push(chunk.onParsed) }As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 16cc3043-b1d4-4fe5-b6d2-ac182c79a444
📒 Files selected for processing (4)
src/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.tssrc/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.ts
Co-authored-by: Orca <[email protected]>
Hidden terminal TUI redraws now request the existing bounded global WebGL atlas recovery after their hidden xterm write parses. Hidden bytes still stay on the hidden/background write path; this does not add hidden foreground painting, fitting, PTY resizing, or replay clearing behavior.
Boundary: this targets renderer pixel recovery for hidden regular terminal tabs. It does not change PTY byte transport, disable WebGL, or alter Claude Code itself.
Summary
onParsedcallbacks that work for foreground and background writes.Design and review
Design review completed clean after tightening hidden-output data flow, background callback invariants, split DEC marker parsing, skipped-byte state reset, and validation coverage.
Completeness verification returned verified. Headline behavior status: implemented.
Perf audit returned clean. The recovery uses the existing coalesced burst and adds no polling, subprocesses, resize path, or unbounded timer fanout.
Code review loop completed in 3 rounds. Two medium findings were fixed before the final round returned clean from both reviewers:
Broad app consistency
Source of truth: xterm's parsed buffer is canonical, and renderer pixels should refresh from that buffer after risky output/replay/paste/visibility transitions.
Compared surfaces: desktop terminal output path, regular terminal tabs, split panes, shared pane-manager WebGL atlas registry, image paste recovery, light/heavy visibility resume, wake recovery, SSH/remote bytes after they reach xterm, and terminal actions/settings surfaces.
Mismatch fixed: hidden background TUI output can now request the same post-parse shared WebGL atlas recovery that foreground risky output and visibility recovery already use, without turning hidden bytes into foreground output.
Manual validation
Verdict from merge-confidence validation: land.
Electron identity:
devRepoRoot=/Users/thebr/orca/workspaces/orca/dottybackdevBranch=brennanb2025/overlapping-tui-outputdevLabel=dottyback @ brennanb2025/overlapping-tui-outputProduct scenario:
9335; renderer port5175because5173was occupied.demo-projectwas unavailable in the fresh profile, so a disposable non-Orca repo was registered and removed afterward.ORCA_STREAM_B_ONLY.ORCA_STREAM_A_ONLY.hasA=true, hasB=false; Terminal 2hasA=false, hasB=true.pendingPtyCount=0,pendingChars=0.Screenshot evidence kept out of git:
.tmp/orca-hidden-tui-terminal2-active-clean.png.tmp/orca-hidden-tui-terminal1-after-switch-clean.png.tmp/orca-hidden-tui-terminal1-final-context.pngConsole/log inspection:
Cleanup:
Accepted validation gap: live Claude Code sessions were not run; validation used Claude-like deterministic TUI streams through the real Orca terminal renderer.
Checks
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/components/terminal-pane/terminal-webgl-atlas-recovery.test.tspassed, 323 tests.pnpm exec oxlint src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.ts src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts src/renderer/src/components/terminal-pane/pty-connection.ts src/renderer/src/components/terminal-pane/pty-connection.test.tspassed.pnpm run typecheckpassed.pnpm run lintpassed with existing warnings only during manual validation.git diff --checkpassed.Post-PR stabilization
Not run per Brennan's explicit instruction to skip post-PR validation and only do manual testing. This PR has not been merged.
Made with Orca 🐋