Repository navigation
Description
Summary
The hidden-view parking system (terminalHiddenViewParking) is designed to free renderer memory by unmounting hidden terminal panes after 30 seconds. However, SSH PTYs and remote-server (remote:) PTYs are explicitly excluded from parking eligibility. For users whose entire workflow runs through SSH or a remote server (e.g. connecting to remote Windows or Linux machines), this means zero tabs ever get parked, and every hidden terminal retains its full xterm.js instance — including the complete scrollback buffer — in the renderer heap indefinitely.
Scope: This issue is specifically about SSH and remote-server terminal workflows — not local PTYs (which already support park/unpark via daemon snapshot replay).
Impact
Each unparked SSH/remote terminal holds roughly 10–20 MB in the renderer heap (5,000-row scrollback at ~2.6 KB/row of cell data, plus xterm rendering overhead). With 5–10 SSH or remote-server terminals open across multiple worktrees:
| Hidden SSH / remote terminals | Estimated renderer heap |
|---|---|
| 3 | ~40–60 MB |
| 5 | ~70–100 MB |
| 10 | ~150–200 MB |
This matches traces from production logs showing renderer heap growing from 23 MB (baseline) to 100–257 MB peak in sessions with zero unhandled rejections and zero other errors. The growth is triggered by agent runs producing large terminal output that fills the scrollback buffer, and is never reclaimed because the xterm instance is never parked.
Reproduction
- Configure ORCA to connect to a remote machine (Windows or Linux) via SSH or remote-server for all repos.
- Open 5+ terminal tabs across multiple worktrees. Run agents or commands that produce substantial output in each.
- Switch away from those tabs for > 30 seconds.
- Open Chrome DevTools → Memory → Take heap snapshot.
- Observe: xterm.js
BufferLine/Bufferobjects dominate the heap; retained heap remains at 100+ MB regardless of tab switching, and does not decrease over time.
Root cause
terminal-hidden-view-parking.ts excludes remote: PTYs and SSH PTYs from parking eligibility. The feature therefore provides no memory benefit to SSH-only and remote-server workflows — the most memory-intensive use cases.
Why SSH & remote-server PTYs are harder to park
I understand the exclusion likely exists because:
- Parking unmounts the xterm instance, destroying the in-memory scrollback.
- For local PTYs, the daemon snapshot/replay capability reconstructs history on re-hydrate.
- SSH relays and remote-server PTYs may not have equivalent snapshot support, making lossless park/unpark difficult.
Suggested mitigations (in order of implementation complexity)
Option A — Reduce scrollback depth for hidden SSH / remote tabs (low effort)
When an SSH or remote-server terminal tab transitions to "hidden beyond cold-park threshold," reduce xterm's active scrollback from the user's configured rows (e.g. 5,000) to a minimal value (e.g. 100–200 rows). The full buffer is already gone after re-hydration anyway once parking is fully supported; reducing it while hidden bounds the worst-case cost without requiring full park/unpark mechanics.
Option B — Compact in-memory snapshot for hidden SSH / remote tabs (medium effort)
When hiding an SSH or remote-server tab past the cold-park delay, serialize the scrollback to a compact format (e.g. plain-text lines stripped of ANSI color codes, or a binary cell dump) and release the xterm instance. Re-hydrate from the compact snapshot on reveal. Color fidelity is lost, but the tab remains functional and the memory cost drops by ~10×.
Option C — Extend daemon snapshot replay to SSH & remote-server PTYs (higher effort)
If the SSH relay / remote-server path (daemon side) can be extended to buffer the same PTY output snapshots that local PTYs already provide, those tabs become eligible for full park/unpark on the same path as local tabs.
Workaround
Users with SSH- or remote-server-heavy workflows can reduce terminalScrollbackRows (Settings → Terminal → Scrollback) from the default 5,000 to 1,000. This reduces per-terminal memory by ~80% and is currently the only available mitigation.
Environment
- Platform: macOS (Apple Silicon)
- ORCA: v1.4.135
- Connection: SSH / remote server (Windows machines; all repos via SSH or remote)
- Observed renderer heap peak: 257 MB (baseline 23 MB)
- All terminal tabs are SSH or remote-server PTYs — parking provides zero memory benefit
Related
- Issue [Bug]: Renderer crashes to white screen on macOS — unhandled rejections accumulate causing memory leak and ResizeObserver loop (v1.4.128–1.4.135) #8260 (renderer heap OOM / white screen) — partially related
- PR fix: stop renderer heap leak from unhandled terminal teardown rejections (#8260) #8279 — fixes unhandled rejection accumulation; does not address this parking exclusion
Activity
Zaradacht commentedon Jul 15, 2026
Additional field evidence: this also affects Orca remote-runtime PTYs, not only direct SSH PTYs.
Environment:
remote:and 8 localObserved over a 23-hour renderer lifetime:
renderer_memorybreadcrumbs: used JS heap grew from 215 MB to 1,545 MB over 11.9 hoursThe breadcrumbs contained no corresponding renderer unhandled rejections or remote-runtime errors, and there were no browser webviews retained. Git polling frequency was also too low to account for the sustained CPU.
The code path supports the same root cause described here:
isSnapshotBackedTerminalPtyrejects bothremote:runtime PTYs and SSH PTYs, so 15 of the 23 PTYs in this workspace could never enter hidden-view parking and retained their xterm renderer state indefinitely.PR #7448 appears to be the comprehensive fix: it adds bounded terminal pane eviction and includes a remote-runtime park/restore path. Linking this field report so the issue and implementation are connected.
iridite commentedon Jul 16, 2026
Confirming @Zaradacht's analysis, and adding field data from the SSH side after running v1.4.143 (which includes the rejection-fix from PR #8279).
Environment
ssh:<id>@@pty-<n>IDs)terminalHiddenViewParking: true,terminalScrollbackRows: 1000(reduced from 5000 mid-observation)What PR #8279 changed
Unhandled rejections dropped to zero and the crash rate fell significantly. But heap growth continued at the same rate — because the rejection accumulation was a side-effect leak, not the primary one.
Today's data (v1.4.143, 0 rejections all day)
Average growth rate: ~70 MB/hr. Zero rejections throughout.
Why this is the SSH PTY parking exclusion
The
14:35session: 5 SSH tabs open, all with 1000-row scrollback. Tab switches happened throughout but the hidden tabs never got their buffers trimmed becauseisSnapshotBackedTerminalPty()returns false for all of them. The xterm instance for each hidden SSH pane stayed fully allocated the entire time.Supporting PR #7448
PR #7448 (terminal pane eviction, opt-in, marked READY since Jul 7) is the comprehensive fix. Its design correctly covers both SSH PTYs and remote-runtime PTYs — it evicts the entire pane DOM + xterm instance on a timer and replays from the main-process mirror on reveal, rather than trying to trim inside the live xterm.
My PR #8655 (scrollback trim only) is a narrower stopgap with lower risk — but PR #7448 eliminates the problem structurally. Would strongly support enabling the experimental flag in a near-term build so users with long-lived SSH or remote-runtime workflows can opt in.
[-]SSH PTY tabs excluded from hidden-view parking causes unbounded renderer heap growth for SSH-heavy workflows[/-][+]SSH & remote-server PTY tabs excluded from hidden-view parking causes unbounded renderer heap growth[/+]AmethystLiang commentedon Jul 28, 2026
Related issues / tracking map
Keeping a single place for the remaining remote/SSH renderer RAM growth path.
remote:.Why not fully merge #6288 into this one
#6288 already shipped two real fixes (relay
psscan thrash + preload subscription leak). Closing this issue as “already fixed by #6288” would hide the still-open structural gap: SSH andremote:PTYs never enter hidden-view parking, so long-lived remote workflows keep full xterm instances forever.Fix PRs still relevant here
If maintainers prefer a single open tracker for remote/SSH renderer RAM, keep this issue (#8652) as the canonical one and fold new field reports here.