Skip to content

Stop hidden terminal panes from exhausting renderer memory (experimental opt-in, default off) - #7375

Closed
brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/oom-hidden-pane-parking
Closed

brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/oom-hidden-pane-parking

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the Windows renderer OOM/hang under multi-agent load (#7175 / STA-476 diagnostic chain) by landing the hidden-view parking sub-feature of @Jinwoo-H's terminal performance initiative (#7214) as a standalone, byte-mode-only slice. All parking production code is copied byte-identical from orca-performance so #7214 later merges over it as a no-op — this is Jinwoo's feature shipped early, not a fork.

What changes: terminal panes hidden for ≥30s unmount their xterm/DOM/WebGL subtree; a pane-less byte watcher keeps bell / title / agent-completion / PR-link side effects alive per PTY (the missing piece that got the naive unmount reverted); revealing the worktree remounts panes through the existing tab-move reattach path. Measured on the shipped e2e memory spec: 8 hidden tabs → 1 live xterm/PaneManager instead of 9.

Impact / evidence — read before assuming this is a proven crash fix. This is not confirmed to be causing a lot of crashes. The evidence is a small, recurring symptom family, not a measured flood: #7175 is a single Discord reporter (Windows, 32GB, "Not responding"/crash with >3 parallel sessions); #7017 (closed) is a Mac M4/48GB user with 140GB app memory plus one follow-up confirming similar on Windows 11 / WSL — roughly three credible reporters across two issues, no telemetry quantifying reach. And memory is only the third-ranked suspected cause in #7175's own triage, behind renderer main-thread saturation (addressed by #7139) and main-process git polling (addressed by #7069). Parking targets the renderer memory mechanism specifically. Under sustained load with real memory pressure it is a large, OS-level win (per-process Windows numbers below: renderer −43%, total −42%), but it is genuinely partial: the main process creeps monotonically regardless of parking (parked PTYs still buffer in main), so parking bends and delays the OOM curve without flattening it — and that unaddressed main-side drift is the likely mechanism behind the 140GB outlier. The main-side relief is the fact-mode phase this build deliberately excludes (see below); it's tracked as a separate follow-up. Net: a real, substantial, partial renderer-side mitigation — which is why it ships opt-in for now. Confirming reach across the user base would still need a telemetry pull (renderer OOM / "not responding" events on Windows).

Update (current state): parking ships as an experimental opt-in, default OFF — surfaced under Settings → Experimental ("Park hidden terminals"). Gates read settings.terminalHiddenViewParking === true, so absent/null settings (including the pre-hydration window where the store initializes settings = null) resolve off. Out-of-the-box behavior is unchanged; the OFF path was audited as a no-op (see the OFF-path section below). The three authority/gate/query flags stay false. #7214 reconcile: restore the !== false gates + flip the default on to graduate.

What does NOT change (read this before flipping flags):

  • Parking is an experimental opt-in, default OFF, gated by terminalHiddenViewParking === true (Settings → Experimental). Zero behavior change out of the box; opting in parks hidden panes in byte mode, and the byte watcher keeps side effects alive so notifications are unaffected.
  • No main-process pipeline code ships. #7214's fact-mode emitter is not here, so terminalMainSideEffectAuthority / terminalHiddenDeliveryGate / terminalModelQueryAuthority are pinned false in constants.ts. Getting this wrong (authority on without the emitter) would silently kill parked-pane notifications; a guard test + a runtime park-refusal tripwire pin it.
  • Two reconcile points when #7214 lands its emitter (both marked in-code): (1) constants.ts — take #7214's true values for the three authority/gate flags; (2) terminal-parked-tab-watchers.ts — delete the extraction-only wouldParkedWatcherFactModeBeSilent tripwire (a rebase will NOT conflict on it, so it must be removed deliberately; it's harmless-but-dead once the channel exists). Every other parking production file is byte-identical to orca-performance.
  • Remote-runtime and SSH PTYs never park (isSnapshotBackedTerminalPty exclusion, tested).

Windows validation — prompt for a Windows agent on this branch

Validation: COMPLETE. Correctness on real Windows + macOS (real Claude Code park/reveal/input/resize/notify-while-parked, no garble, no lost output); definitive per-process memory run on Windows at HEAD 7047877d0; default-OFF no-op confirmed on Windows (fresh profile → terminalHiddenViewParking === false, nothing parks).

  • Harness: parking e2e spec 4/4 (including the 25-cycle byte-identical park/reveal test); unit suites green.

  • Real Claude Code park/reveal (macOS + Windows): parked a live Claude TUI, revealed it — pixel-faithful restore, unsubmitted draft preserved, first keystroke registered immediately, and a mid-park resize reflowed the TUI cleanly to the new width. Claude completed while parked → tab title took the ✳ idle prefix + sidebar attention/unread fired (the pane-less watcher parsed Claude's completion while unmounted); reveal restored the full conversation including the model response.

  • Per-process memory under sustained load (definitive run, 16 terminals / 8 worktrees, ~180s heavy PTY flood, real memory pressure ~4.1GB free). OS-level private working set walked from the main process down its child tree, sampled through the hold, parking ON vs OFF at matched load:

    Process OFF (16 live) ON (1 live, 15 parked) Δ
    Renderer 562 (peak 596) 322 (peak 368) −240 (−43%)
    GPU 161 95 −66 (−41%)
    Main 334 → 358 (climbing) 272 → 318 (climbing) −62 (−19%)
    PTY-shell fleet (~16) 410 130 −280
    Total private WS 1742 1007 −735 (−42%)
    Free RAM (avg / peak) 1508 / — 1813 / 2838 +305 avg

    Renderer-internal at the same moments: xterms 16 → 1, DOM ~2450 → ~968 (−60%). ≈16MB real renderer RSS reclaimed per parked terminal; scales ~linearly with terminal count (far larger at 40–60). Renderer is the single largest process, so parking targets the right one. Neither run crashed or went "Not responding" (the low-RAM box was not pushed to OOM by design).

  • Two important caveats from this run — (1) an earlier lighter run (12 terminals / 90s / low pressure) showed renderer RSS flat; that was a low-pressure measurement artifact — Chromium only returns freed pages to the OS under pressure, which is exactly the crash regime, so the −43% above is the representative result. (2) The main process creeps monotonically in both runs (141→358 OFF, 116→318 ON) and parking does not address it — parked PTYs still buffer in main. Parking is therefore a large but partial fix; the main-side buffer drift is tracked as a separate diagnose-first follow-up (it's the fact-mode phase this byte-mode build excludes).

  • Live parked-agent proof (the STA-476 scenario): a Codex agent's tab parked while the agent was working; it completed while parked; unread attention fired (worktree + tab + pane — written by the notification dispatch path itself, proving the parked watcher delivered the completion); reveal restored content on the same PTY and accepted typed input immediately (~2.7s reveal under 24-PTY load; quick switches never pay this thanks to hot-retain). OS toast was correctly suppressed for a focused window (unread evidence proves the dispatch ran).

  • Two Windows-only test-infra fixes came out of validation and are on the branch: fixture path canonicalization (ed552cf28) and script-file payload emission replacing a PowerShell-mangled node -e form (20390d7fc).

Earlier prompt for re-running Windows validation (kept for reference):

Spawn a Windows agent on branch brennanb2025/oom-hidden-pane-parking (git pull first) with this prompt:

You are on a Windows machine in a checkout of the orca repo on branch brennanb2025/oom-hidden-pane-parking (git pull first). Validate the hidden-terminal-pane parking extraction. All commands are separate lines (PowerShell — no &&).

  1. pnpm install — a first run may fail with EPERM on cpu-features; retry. If a later build complains about @xterm/addon-ligatures or the Electron binary, run pnpm install --force to repair the patch, then continue.
  2. Unit suites: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.test.ts src/renderer/src/components/terminal-pane/terminal-parking-byte-mode-guard.test.ts src/renderer/src/store/slices/terminal-shutdown-parked-watcher-dispose.test.ts — expect all green.
  3. e2e (real Electron): first pnpm run ensure:electron-runtime, then npx playwright test tests/e2e/terminal-hidden-view-parking.spec.ts tests/e2e/terminal-parked-memory.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1. Expect 6/6; on failure report the trace path. (The earlier "Expected e2e repo to be loaded" fixture failure was a Windows path-canonicalization mismatch, fixed on the branch — if it recurs, capture window.__store.getState().repos.map(r => r.path) from the trace/DevTools alongside the seeded temp path so we can see the exact string difference.)
  4. Manual OOM-scenario check — INDEPENDENT of steps 2-3, run it even if e2e misbehaves: pnpm dev, then enable the opt-in flag from the renderer DevTools console (Ctrl+Shift+I): await window.__store.getState().updateSettings({ terminalHiddenViewParking: true }). Create 6+ worktrees, launch an agent or long-running output command in 2-3 terminals each, then stay on one worktree ≥60s so the rest park (30s hysteresis). Confirm in DevTools: window.__terminalParkingDebug?.parkedTabIds() lists the hidden tabs, and heap/DOM node count (Memory tab) is far below an identical run with the flag false. Watch Task Manager: renderer memory should stay flat instead of climbing per worktree.
  5. Notification-while-parked: with an agent running in a hidden (parked) worktree, give it a task that finishes after parking kicks in; confirm the completion notification/unread dot still fires, then reveal the worktree and confirm terminal content and input work immediately.
  6. Report: parked tab counts, before/after memory numbers, whether "Not responding" ever appeared, and any notification misses.

Extraction inventory (vs plan)

  • 10 new renderer parking modules under terminal-pane/ + Terminal.tsx / TerminalPaneOverlayLayer.tsx (all byte-identical to orca-performance), 1 hunk each in use-terminal-pane-lifecycle.ts (unmount capture) and pty-transport.ts (initialAgentTitle seed).
  • Supporting seams the handoff plan under-specified, all verified against #7214: the agent-title-* split of agent-detection.ts (provides the tracker's initialTitle param), shared/github-links.ts + shared/terminal-github-pr-link-detector.ts moves, types-only shared/terminal-side-effect-facts.ts, settings:get-sync sync IPC + settings.getSync preload, e2e config/env plumbing.
  • Type-only optional declarations for pty.onSideEffect / getSideEffectSnapshot / setHiddenRendererPty (no preload implementations — #7214 makes them required + implemented).
  • NOT shipped (fact-mode/chain-only): pty-delivery-interest, terminal-view-attributes-publisher, pty-model-restore-channel, terminal-parser-handler-guard, shared/terminal-output-side-effects, the bell-detector shared move, all fact-mode preload bridges.

Validation

  • Static: typecheck (node/cli/web), full pnpm run lint (oxlint, switch-exhaustiveness, reliability-gate manifest, localization) — green.
  • Unit: full vitest suite (24,290 passed); parking suites = 5 copied Terminal performance initiative: pipeline fixes + term-speed-2 revival + PTY flow control (integration branch) #7214 suites + a new byte-mode guard test + a new shutdown-wiring regression test. (The one full-suite failure during development was main's own transient es.json breakage, since fixed on main; unrelated to this branch.)
  • e2e (first-ever runs of Terminal performance initiative: pipeline fixes + term-speed-2 revival + PTY flow control (integration branch) #7214's specs, local macOS): terminal-hidden-view-parking.spec.ts 4/4 (park + byte-identical TUI restore across 25 park/reveal cycles; bell/title side effects live while parked; exclusions honored), terminal-parked-memory.spec.ts 2/2, terminal-sleep-wake-restore.spec.ts pass. The specs opt in via updateSettings since this build defaults the flag off.
  • Measured memory (the [Bug] Windows: 'Not responding' and crash when running more than 3 sessions in parallel (32GB RAM) #7175 mechanism): 8 hidden tabs parked → 1 live xterm/PaneManager instead of 9 (parking disabled: 9/9 retained); heap 92.7MB vs 100.3MB at this small scale — the win scales with pane count (the field failure is ~350k retained DOM nodes across dozens of panes).
  • Product surface (Electron, full window): park → hidden-tab unmount → reveal restores identical terminal content; screenshots attached in the PR conversation.
  • Reliability gate: registered terminal-session.hidden-view-parking-byte-mode (experimental) in config/reliability-gates.jsonc with today's evidence runs.
  • Final-HEAD validation pass (independent validator, rebuilt e2e bundle at the tip): all three specs green (one pre-existing shared-fixture flake in the 25-cycle test — inherited from main's orca-app.ts, isolated re-runs 3/3 pass, not PR-blocking CI); untouched-default proof — a fresh profile without the settings key resolves terminalHiddenViewParking to false end-to-end (defaults merge before persisted settings), hidden tabs keep their pane manager, parkedTabIds() stays empty; reliability-gate command green (115 tests). Verdict: land.
  • Not validated here (accepted gaps): Windows OOM relief (needs a real Windows box — see the Windows prompt above); live SSH session (parking excludes SSH/remote PTYs — unit-proven exclusion, no new SSH runtime path exists); fact mode (not in this build); Linux run.

Risks, residual observations, and non-goals

  • Headline status: implemented, experimental opt-in (default OFF, byte mode). The parking mechanism is fully implemented and e2e-proven, and exposed under Settings → Experimental. Out-of-the-box behavior is unchanged; users opt in to get the memory relief while the restore path soaks on real multi-agent Windows workspaces. The three authority/gate flags remain false — no main-process emitter ships here.

  • Reveal-time side-effect parity (fixed in-branch). While parked, the renderer dispatcher buffers chunks the watcher already consumed; the reveal drain used to replay that backlog through the live processor (double-firing bell/completion) before the snapshot's clear wiped its content. The watcher now drops the backlog on dispose — snapshot owns content, watcher owned the side effects (unit + byte-for-byte e2e pinned).

  • Accepted residual: parked split whose PTY exits cleanly while parked. With no PaneManager, the tab close is deferred to protect surviving siblings; on reveal the dead leaf comes back as a fresh shell (same as app-restart restore) instead of closing like a mounted pane's leaf. Niche (split + exit-while-parked); tracked as a follow-up.

  • Accepted residual: hibernation kill flush. Parked watchers are disposed only after a successful hibernation kill (a kill failure must keep the watcher, or the tab goes silent — the fatal failure mode). Main's pre-exit flush can therefore mark a rare phantom unread on a hibernated pane; timers are cleared by the exit-time dispose so no OS notification fires.

OFF path = no-op (reviewed hard)

Because this defaults off, the code that runs for non-opters was audited to be behavior-identical to pre-parking main:

  • Gates read === true (not !== false), so a null/undefined settings object — e.g. the pre-hydration window where the store initializes settings = null — resolves off rather than transiently on.
  • The always-on unmount capture (capturedPanesByTabId) is bounded and cleaned by syncParkedTerminalTabWatchers (closed tabs) and pruneParkedTerminalWatchers (dead worktrees), both of which run ungated by the flag — no leak when off.
  • The new blocking settings:get-sync IPC is consulted only inside the parked byte watcher, which never starts when off — no new blocking IPC on any live/hot path.
  • Shutdown disposeParkedTerminalWatchersForPtyIds and the shouldDeferParkedPtyExitTabClose PTY-exit guard are no-ops on an empty watcher registry, so shutdown and tab-close behave exactly as before.
  • The initialAgentTitle transport param is unset on all live callers (only the parked watcher passes it), so the live output-processor path is byte-identical.
  • The agent-detection split and github-links move are import-consistent refactors (full typecheck green; existing suites cover them).
  • Inherited Terminal performance initiative: pipeline fixes + term-speed-2 revival + PTY flow control (integration branch) #7214 behavior (reviewed, accepted, opt-in only): a parked single-leaf tab whose shell exits doesn't auto-close until reveal (the reveal remount handles the dead PTY); OSC-52 clipboard writes are out of scope while parked.
  • The parked watcher parses bytes per chunk exactly like the mounted pane it replaces (no new hot-path cost); when parking is off, the only residual work is a bounded per-pane-unmount capture (kept to stay hunk-identical with #7214).
  • The sleep-wake e2e spec flaked twice under heavy parallel load during development at the shared launch fixture — root-caused to this branch having transiently reverted main's #7330 repo-load retry (restored in review round 1); passes consistently since.
  • types.ts field docs were corrected to state this build's real defaults (third, comment-only divergence from #7214).

Process

This PR ran Brennan's PR process end to end: design verification of the handoff plan against orca-performance (found and closed 4 plan gaps: the agent-title split dependency, shared/terminal-side-effect-facts.ts, the github-links cascade, the e2e config seam), implementation, independent completeness verification (10/10 pass), perf audit (no blocking issues; default-off is zero-timer), and a two-at-a-time adversarial review loop: round 1 found 2 real issues (missed terminals.ts shutdown-dispose wiring from #7214; the e2e fixture copy reverting #7330), round 2 found 2 in round 1's own fix (missing import in the split helper; doc refs), round 3 returned clean from both reviewers. Each fix landed with a regression test where applicable.

Refs: #7175, STA-476, extracted from #7214. cc @Jinwoo-H — files are copied verbatim from your branch (co-authored commits); the constants.ts byte-mode pinning block and the doc's status paragraph are the only intentional divergences, called out inline.

brennanb2025 and others added 5 commits July 4, 2026 14:26
…ew parking, byte mode, default off)

Extracts the self-contained "hidden-view parking" slice from PR #7214
(orca-performance) as a standalone fix for the Windows renderer OOM/hang
under multi-agent load (#7175 / STA-476): long-hidden terminal panes
unmount after a 30s hysteresis while a pane-less byte watcher keeps
bell/title/agent-completion side effects alive; reveal rides the existing
tab-move reattach path.

Byte mode only: no main-process side-effect emitter ships here, so
constants.ts pins terminalMainSideEffectAuthority / terminalHiddenDeliveryGate /
terminalModelQueryAuthority to false (the single intentional divergence from
#7214, reconciled by taking #7214's values when its emitter lands). The
parking kill switch terminalHiddenViewParking also ships default-OFF
(opt-in) until the memory win is confirmed in a soak.

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
…e (from #7214)

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
…fix restore, parking reliability gate

- Wire shutdownWorktreeTerminals → disposeParkedTerminalWatchersForPtyIds
  (byte-identical to #7214's terminals.ts hunk the extraction plan missed) so
  a slept/deleted worktree's teardown flush cannot mark unread or arm
  notification timers through a parked watcher; add a store-level regression
  test for the wiring.
- Rebuild tests/e2e/helpers/orca-app.ts as main's version + only the
  orcaAppExtraEnv/orcaAppExtraArgs fixture additions — the wholesale copy from
  orca-performance had silently reverted the #7330 repo-load flake fix. Split
  the seeded-test-repo helpers into their own module to stay under max-lines.
- Register the hidden-view parking byte-mode surface in the reliability gate
  manifest (experimental, renderer-unit layer, evidence from today's runs).
- State the real shipped defaults in the four settings docstrings (types.ts)
  instead of #7214's "defaults to true" wording.

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
…2e helper

- seeded-test-repo.ts: re-add the TEST_REPO_PATH_FILE import the round-1 split
  dropped (runtime-only ReferenceError on the worker's stale-repo fallback
  path — tests/e2e sits outside all typecheck configs), and drop the stray
  fixture JSDoc that came along with the extraction. Fallback verified by
  invoking createSeededTestRepo directly.
- types.ts: qualify the two See-references to authority docs that ship with
  PR #7214 rather than this branch.

Co-authored-by: Orca <help@stably.ai>
…ses not shipped)

The header was adapted for the standalone extraction but two body sections
still called fact mode "(default)" and phases 3-5 "(all shipped)" — the exact
byte-mode-pinning confusion this PR guards against.

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds terminal hidden-view parking, which unmounts hidden terminal pane UI while keeping PTY/session side effects alive through parked watchers and sidecars. It also adds new settings and IPC surfaces, shared side-effect fact types, cold-parking policy and lifecycle wiring, shared agent-title and GitHub-link refactors, E2E/debug support, a reliability gate, reference documentation, and expanded unit/E2E coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed but it does not follow the required template and omits Screenshots, Testing checkboxes, AI Review Report, Security Audit, and Notes sections. Restructure the PR description to match the template and add the missing Screenshots, Testing, AI Review Report, Security Audit, and Notes sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: an opt-in feature to reduce renderer memory from hidden terminal panes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/e2e/global-setup.ts (1)

56-97: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Duplicate git-repo seeding logic vs. the new seeded-test-repo.ts helper.

seeded-test-repo.ts's docstring says it was "Extracted from orca-app.ts (fixture host)" and createSeededTestRepo() there implements the exact same git init/config/README/CLAUDE.md/package.json/.gitignore/src/index.ts/worktree-add sequence. This file still inlines its own copy instead of calling the shared helper, so any future change to the seed fixture (e.g. adding a file, changing worktree naming) has to be made in two places or they will silently drift.

♻️ Proposed consolidation
-  // ── 2. Create a seeded test git repo ───────────────────────────────
-  // Why: each test run gets its own git repo so the suite is fully
-  // idempotent. No test depends on whatever repos the user has open.
-  // Why: realpathSync so the seeded path matches the store's repo.path on
-  // macOS, where os.tmpdir() (/var/...) symlinks to /private/var/... and the
-  // app canonicalizes repo.path via `git rev-parse --show-toplevel` on add.
-  const testRepoDir = realpathSync(mkdtempSync(path.join(os.tmpdir(), 'orca-e2e-repo-')))
-
-  execSync('git init', { cwd: testRepoDir, stdio: 'pipe' })
-  ...
-  writeFileSync(TEST_REPO_PATH_FILE, testRepoDir)
-  console.error(`[e2e] Test repo created at ${testRepoDir}`)
+  // Why: each test run gets its own git repo so the suite is fully
+  // idempotent. No test depends on whatever repos the user has open.
+  const testRepoDir = createSeededTestRepo()
+  console.error(`[e2e] Test repo created at ${testRepoDir}`)
src/renderer/src/store/slices/terminals.ts (1)

1845-1845: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Dispose parked PTY watchers during agent hibernation
shutdownCompletedAgentPaneForHibernation can still hit background tabs, and parked tabs remain tracked by the parked-watcher registry. unregisterPtyDataHandlers alone won’t stop those byte watchers from seeing the final stop/kill flush; mirror shutdownWorktreeTerminals here and dispose shutdownPtyIds watchers in both shutdown branches.

🧹 Nitpick comments (4)
tests/e2e/helpers/seeded-test-repo.ts (1)

13-29: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Static-analysis command-injection flags are false positives here.

Both ast-grep and OpenGrep flag the execSync calls (isValidGitRepo's git rev-parse, and git worktree add "${worktreeDir}") as command-injection risks. The interpolated values (repoPath used only as cwd, and worktreeDir built from os.tmpdir() + randomUUID()) are internally generated by the test harness, not attacker/user-controlled input, so there is no actual injection surface.

If you want to fully silence the linters rather than suppress them, execFileSync('git', ['worktree', 'add', worktreeDir, '-b', 'e2e-secondary'], { cwd: testRepoDir, stdio: 'pipe' }) avoids shell interpolation entirely.

Also applies to: 37-63

Source: Linters/SAST tools

tests/e2e/terminal-hidden-view-parking.spec.ts (1)

135-146: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated parking test helpers into a shared module.

skipUnlessParkingWired, readTerminalTabViewState, createActiveTerminalTab, and enableTerminalParking are re-implemented nearly identically in terminal-parked-memory.spec.ts (lines 71-82, 91-99, 122-148, 257-265). The enableTerminalParking comment even explicitly says "Same mutation path as the kill-switch test in terminal-parked-memory.spec.ts," acknowledging the duplication. Consolidating these into a shared tests/e2e/helpers/terminal-parking.ts would prevent the two specs from silently diverging as the parking machinery evolves.

#!/bin/bash
rg -n 'function (skipUnlessParkingWired|readTerminalTabViewState|createActiveTerminalTab|enableTerminalParking)' tests/e2e

Also applies to: 167-176, 209-231, 152-160

src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts (1)

238-241: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated mode-2031 reply expression.

mode2031SequenceFor(resolveTerminalColorSchemeMode(settings, getSystemPrefersDark())) is duplicated verbatim here and in parked-terminal-mode2031-responder.ts (lines 47-48). Consider extracting a small shared helper (e.g. sendMode2031ReplyFor(sendInput, settings)) in shared/terminal-color-scheme-protocol.ts so both responder paths stay in lockstep if theme-resolution logic changes.

♻️ Proposed shared helper
+// shared/terminal-color-scheme-protocol.ts
+export function sendMode2031Reply(
+  sendInput: (data: string) => void,
+  settings: Pick<GlobalSettings, 'theme'> | null | undefined
+): void {
+  sendInput(mode2031SequenceFor(resolveTerminalColorSchemeMode(settings, getSystemPrefersDark())))
+}
-  const sendMode2031Reply = (): void => {
-    const settings = useAppStore.getState().settings
-    sendInput(mode2031SequenceFor(resolveTerminalColorSchemeMode(settings, getSystemPrefersDark())))
-  }
+  const sendMode2031Reply = (): void =>
+    sendMode2031ReplyFor(sendInput, useAppStore.getState().settings)
src/shared/agent-title-identity.ts (1)

69-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a data-driven table for the agent-name lookups.

The repeated titleHasAgentName(title, 'x') → 'Y' blocks could be collapsed into an ordered array of [key, label] pairs and a loop, which would shrink this chain and make future agent additions a one-line change.

♻️ Proposed refactor
-  if (titleHasAgentName(title, 'codex')) {
-    return 'Codex'
-  }
-  if (titleHasAgentName(title, 'openclaude')) {
-    return 'OpenClaude'
-  }
-  if (titleHasAgentName(title, 'copilot')) {
-    return 'GitHub Copilot'
-  }
-  if (titleHasAgentName(title, 'grok')) {
-    return 'Grok'
-  }
-  if (titleHasAgentName(title, 'devin')) {
-    return 'Devin'
-  }
-  if (titleHasAgentName(title, 'antigravity') || AGY_AGENT_NAME_RE.test(title)) {
-    return 'Antigravity'
-  }
-  if (titleHasAgentName(title, 'opencode')) {
-    return 'OpenCode'
-  }
-  if (titleHasAgentName(title, 'mimo')) {
-    return 'MiMo Code'
-  }
-  if (titleHasAgentName(title, 'aider')) {
-    return 'Aider'
-  }
-  // Why: match explicit names before Claude's generic braille heuristic.
-  if (titleHasAgentName(title, 'cursor')) {
-    return 'Cursor'
-  }
+  // Why: match explicit names before Claude's generic braille heuristic.
+  const NAMED_AGENT_LABELS: readonly [string, string][] = [
+    ['codex', 'Codex'],
+    ['openclaude', 'OpenClaude'],
+    ['copilot', 'GitHub Copilot'],
+    ['grok', 'Grok'],
+    ['devin', 'Devin'],
+    ['opencode', 'OpenCode'],
+    ['mimo', 'MiMo Code'],
+    ['aider', 'Aider'],
+    ['cursor', 'Cursor']
+  ]
+  for (const [key, label] of NAMED_AGENT_LABELS) {
+    if (titleHasAgentName(title, key)) {
+      return label
+    }
+  }
+  if (AGY_AGENT_NAME_RE.test(title)) {
+    return 'Antigravity'
+  }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a174d5fd-e8ce-45fc-ac2b-2125dadccbf7

📥 Commits

Reviewing files that changed from the base of the PR and between ad329e2 and e39355d.

📒 Files selected for processing (51)
  • config/reliability-gates.jsonc
  • docs/reference/terminal-hidden-view-parking.md
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/preload/api-types.ts
  • src/preload/e2e-config.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneOverlayLayer.tsx
  • src/renderer/src/components/terminal-pane/agent-task-complete-policy.ts
  • src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.test.ts
  • src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts
  • src/renderer/src/components/terminal-pane/parked-terminal-mode2031-responder.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/terminal-hidden-delivery-gate.ts
  • src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts
  • src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.ts
  • src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts
  • src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts
  • src/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.ts
  • src/renderer/src/components/terminal-pane/terminal-parking-byte-mode-guard.test.ts
  • src/renderer/src/components/terminal-pane/terminal-parking-e2e-overrides.test.ts
  • src/renderer/src/components/terminal-pane/terminal-parking-e2e-overrides.ts
  • src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.ts
  • src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts
  • src/renderer/src/env.d.ts
  • src/renderer/src/lib/github-links.ts
  • src/renderer/src/store/slices/terminal-shutdown-parked-watcher-dispose.test.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/shared/agent-detection.ts
  • src/shared/agent-title-core.ts
  • src/shared/agent-title-identity.ts
  • src/shared/agent-title-status.ts
  • src/shared/constants.ts
  • src/shared/e2e-config.ts
  • src/shared/github-links.ts
  • src/shared/terminal-github-pr-link-detector.test.ts
  • src/shared/terminal-github-pr-link-detector.ts
  • src/shared/terminal-side-effect-facts.ts
  • src/shared/types.ts
  • tests/e2e/global-setup.ts
  • tests/e2e/global-teardown.ts
  • tests/e2e/helpers/orca-app.ts
  • tests/e2e/helpers/seeded-test-repo.ts
  • tests/e2e/terminal-hidden-view-parking.spec.ts
  • tests/e2e/terminal-parked-memory.spec.ts
  • tests/e2e/terminal-sleep-wake-restore.spec.ts

Comment on lines +29 to +37
// Why: production cold-park hysteresis is 30s with a multi-minute hot-retain
// window. The fast-park override must be scoped to THIS spec's app launches —
// mutating process.env at module scope leaked into later specs when a worker
// reloaded files without replaying this file's afterAll.
const PARKING_DELAY_MS = Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS) || 500

test.use({
orcaAppExtraEnv: { ORCA_E2E_TERMINAL_PARKING_DELAY_MS: String(PARKING_DELAY_MS) }
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

PARKING_DELAY_MS silently discards an explicit 0 override.

Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS) || 500 treats an explicit "0" env value the same as "unset" (0 is falsy), forcing 500ms instead of the requested 0ms delay. It also masks non-numeric values (NaN || 500) as a side effect, which happens to work but is unintentional.

🐛 Proposed fix
-const PARKING_DELAY_MS = Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS) || 500
+const parsedParkingDelayMs = Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS)
+const PARKING_DELAY_MS = Number.isFinite(parsedParkingDelayMs) ? parsedParkingDelayMs : 500

The identical pattern exists in terminal-parked-memory.spec.ts line 22.

📝 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.

Suggested change
// Why: production cold-park hysteresis is 30s with a multi-minute hot-retain
// window. The fast-park override must be scoped to THIS spec's app launches —
// mutating process.env at module scope leaked into later specs when a worker
// reloaded files without replaying this file's afterAll.
const PARKING_DELAY_MS = Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS) || 500
test.use({
orcaAppExtraEnv: { ORCA_E2E_TERMINAL_PARKING_DELAY_MS: String(PARKING_DELAY_MS) }
})
// Why: production cold-park hysteresis is 30s with a multi-minute hot-retain
// window. The fast-park override must be scoped to THIS spec's app launches —
// mutating process.env at module scope leaked into later specs when a worker
// reloaded files without replaying this file's afterAll.
const parsedParkingDelayMs = Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS)
const PARKING_DELAY_MS = Number.isFinite(parsedParkingDelayMs) ? parsedParkingDelayMs : 500
test.use({
orcaAppExtraEnv: { ORCA_E2E_TERMINAL_PARKING_DELAY_MS: String(PARKING_DELAY_MS) }
})

shutdownCompletedAgentPaneForHibernation already unregisters live pane
handlers before pty.kill to prevent phantom notifications from the teardown
flush, but a parked tab's byte watcher rides the dispatcher sidecar that call
does not touch. Dispose it after a successful kill — deliberately not before:
a failed kill leaves the session running and it must keep its watcher.

This is the hibernation analog of the worktree-shutdown wiring and does not
exist in PR #7214 yet (worth adopting there); regression tests cover both the
success and kill-failure paths. Also: "afterwards" → "afterward" in the
parking doc (static analysis).

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
@brennanb2025
brennanb2025 force-pushed the brennanb2025/oom-hidden-pane-parking branch from fc23a00 to badd6f2 Compare July 4, 2026 23:14
@brennanb2025

Copy link
Copy Markdown
Contributor Author

CodeRabbit follow-up (all four items triaged):

  • Dispose parked watchers during agent hibernation — adopted in badd6f26a: shutdownCompletedAgentPaneForHibernation now disposes the pane's parked byte watcher after a successful kill (deliberately not before — a failed kill leaves the session running and it must keep its watcher). Regression tests cover both paths. Note this wiring does not exist in #7214 yet; flagged as a reconcile/adopt item for that branch.
  • "afterwards" → "afterward" — fixed in badd6f26a.
  • PARKING_DELAY_MS discards an explicit 0 — declining: 0 means "no override" across this feature's whole override chain by design (preload/e2e-config.ts coerces 0→null, createE2EConfig requires > 0, getTerminalParkingPolicyOverrides requires > 0). Accepting 0 in the spec constant alone would diverge the spec from the app it drives, and a 0ms cold-park hysteresis isn't a meaningful configuration. The file is also byte-identical to #7214, which this PR deliberately preserves.
  • Duplicate git-repo seeding logic in global-setup.ts — declining here: the duplication predates this PR (main's orca-app.ts carried the same inline copy vs global-setup.ts); this branch only moved the existing copy into a named module. Consolidating means relocating TEST_REPO_PATH_FILE to avoid an import cycle — a reasonable standalone test-infra cleanup, out of scope for this extraction. Good follow-up candidate.

brennanb2025 and others added 2 commits July 4, 2026 16:25
Resolves the github-links.ts conflict with #7371: the parsing-core pieces
(GitHubIssueOrPRLink type, parseGitHubIssueOrPRLink signature) land in
src/shared/github-links.ts where this branch moved the core, and the
renderer-side pieces (HTTP_URL_PREFIX_RE, GitHubLinkQuery.directLink,
normalizeGitHubLinkQuery) stay in the lib shim.

Co-authored-by: Orca <help@stably.ai>
The seedTestRepo fixture matched store repo/worktree paths against the seeded
realpath with strict string equality, which fails on Windows when main's
canonicalized path differs in separators or drive-letter case — every spec
then dies at "Expected e2e repo to be loaded" before its own assertions
(observed on a real Windows validation run of this branch). Compare through
shared/cross-platform-path's normalizeRuntimePathForComparison instead,
matching node-side so the shared helper is used verbatim.

Co-authored-by: Orca <help@stably.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/e2e/helpers/orca-app.ts (2)

268-301: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the repeated normalized-repo-lookup logic.

Both polls fetch store.getState().repos, map to {id, path}, and find a match via normalizeRuntimePathForComparison(candidate.path) === repoPathKey. A small shared helper (e.g. findRepoByNormalizedPath(page, repoPathKey)) would remove the duplication, though the two callers differ slightly in fetch timing and return type.

Also applies to: 327-352


383-391: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Undocumented startsWith fallback in worktree matching.

The prefix-match fallback (worktreePathKey.startsWith(repoPathKey)) is a non-obvious heuristic beyond the exact-match case used elsewhere in this same function (line 288, 339). Since the secondary worktree is created as a sibling directory in createSeededTestRepo (not nested under the repo path), it's unclear what case this fallback is meant to catch. A short comment explaining the reasoning would help future maintainers, and reduces risk that this silently matches an unintended worktree in edge cases (e.g., a temp-dir path with a shared prefix).

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: 993b4bff-126b-4552-9e3d-50f93f8fae0d

📥 Commits

Reviewing files that changed from the base of the PR and between 1d4e70e and ed552cf.

📒 Files selected for processing (1)
  • tests/e2e/helpers/orca-app.ts

brennanb2025 and others added 2 commits July 5, 2026 09:05
… PowerShell)

The parked bell/title test was the suite's only nested-escaped-quote
`node -e "...\"...\""` invocation; Windows PowerShell 5.1 mangles that argv
form, so the payload was never emitted and the title assertion saw ConPTY's
spawn-time powershell.exe title (observed on a real Windows validation run —
the other five tests, which all use script files or quote-free inline forms,
passed). Emit through a script file like the rest of the suite, and re-assert
the OSC 0 title on an interval so conhost's own title updates cannot race the
store assertion.

Co-authored-by: Orca <help@stably.ai>
…parking ON

Resolve agent-detection.ts split-vs-monolith conflict by porting main's
Gemini/Pi title fixes (#5270 masquerade guard, isLegacyPiCompatibleTitle)
into the split module agent-title-core.ts; keep the compatibility barrel.

Flip terminalHiddenViewParking default OFF->ON (byte mode). The three
authority/gate/query flags stay false (no main emitter in this build).
Update the byte-mode guard test, docs, reliability gate, and e2e comments.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025 brennanb2025 changed the title Stop hidden terminal panes from exhausting renderer memory (opt-in hidden-view parking) Stop hidden terminal panes from exhausting renderer memory (hidden-view parking, default on) Jul 5, 2026
…e gates)

Move the parking toggle to Settings → Experimental and default it OFF:
- constants.ts default false; gates read `settings.terminalHiddenViewParking
  === true` (was `!== false`) so absent/null settings (e.g. pre-hydration,
  when the store initializes settings=null) resolve OFF, not ON.
- New Experimental UI toggle (TerminalParkingExperimentalSetting) + search
  entry, extracted into focused modules to satisfy max-lines.
- Restore default-off wording in types.ts, docs, reliability gate, guard test.
- #7214 reconcile: restore `!== false` gates + default-on when graduating.

OFF-path audited as a no-op: unmount capture is bounded and cleaned by
ungated sync/prune; the getSync blocking IPC is only used inside the parked
watcher (never starts when off); shutdown dispose + pty-exit defer are no-ops
on an empty registry; the initialAgentTitle param is unset on live callers.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025 brennanb2025 changed the title Stop hidden terminal panes from exhausting renderer memory (hidden-view parking, default on) Stop hidden terminal panes from exhausting renderer memory (hidden-view parking, experimental opt-in) Jul 5, 2026
@brennanb2025 brennanb2025 changed the title Stop hidden terminal panes from exhausting renderer memory (hidden-view parking, experimental opt-in) Stop hidden terminal panes from exhausting renderer memory (experimental opt-in, default off) Jul 5, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Parking memory validation — per-process, under sustained load

HEAD tested: 7047877d0b2cae563a94fbeb7faf5938775d191c (branch brennanb2025/oom-hidden-pane-parking)
pnpm install: clean, no --force needed.
Method: two runs, identical load, toggling only terminalHiddenViewParking. Each: mount 8 worktrees / 16 terminals, activate one (home), leave the other 7 worktrees hidden, then start sustained heavy PowerShell flood on all 16 PTYs and hold ~180 s. Per-process memory (Win32 WorkingSetPrivate) sampled every ~25 s at the OS level, rooted at the dev main process and walked down its child tree. Renderer-internal metrics (xterm/pane/parked/DOM/JS-heap) sampled via CDP every ~15 s.

Scope caveat, stated up front: this box only had ~4.1 GB free. Both runs floor-capped at 8 worktrees / 16 terminals (the machine, not the feature). I ran the ON side at that same matched load. I did not push to crash — with this little RAM that risked destabilizing the machine. Both runs stayed alive and mainResponding the whole time. The flood shells are synthetic output generators standing in for agent-CLI children.

Steady-state flood, per process (mean of 5 samples during the hold, MB)

Process OFF (16 live) ON (1 live, 15 parked) Δ
RENDERER 562 (peak 596) 322 (peak 368) −240 (−43%)
GPU 161 95 −66 (−41%)
MAIN 334 → 358 climbing 272 → 318 climbing −62 (−19%)
ELECTRON-other 239 180 −59
PTY-SHELL fleet (~16) 410 130 −280
TOTAL private WS 1742 1007 −735 (−42%)
Free RAM (avail) mean 1508, min 1027 mean 1813, peak 2838 +305 avg

Renderer-internal at the same moments: OFF xterm=16, DOM≈2450, heap≈85 → ON xterm=1, parked=15, DOM≈968, heap≈80 (DOM −60%).

The four questions, answered

1. Which process grows fastest / largest under load?
Two different processes win two different races:

  • Largest single process = RENDERER (596 MB peak in OFF). This is exactly what parking targets.
  • Fastest sustained grower = MAIN. It climbs monotonically and never recedes — 141→358 MB (OFF), 116→318 MB (ON) — in both runs. The PTY-SHELL fleet is also large in aggregate (~410 MB) but spread ~25 MB across 16 processes.

2. Does parking reduce the renderer working set at the OS level (and/or GPU/total)? — YES, all three.
Not just renderer-internal counts — this is OS-level per-process private working set at matched load: RENDERER −240 MB (−43%), GPU −66 MB (−41%) (fewer live xterm canvases), TOTAL −735 MB (−42%). That's ~16 MB of real renderer RSS reclaimed per parked terminal. Free RAM ran ~300 MB higher on average and repeatedly recovered above 2.5 GB, versus OFF pinned near 1 GB.

3. Does parking keep the app responsive/alive longer? — Yes, with more headroom.
Neither run crashed (I stopped short of OOM by design). But ON sustained materially more free memory (peaks 2.6–2.8 GB vs OFF's ~1.0 GB troughs) — i.e. more runway before the OOM wall. During the mount phase parking briefly costs a little (snapshot/teardown churn on near-empty terminals), so the payoff is specifically the sustained-load regime.

4. Reframe — is the renderer even the biggest/fastest grower, or is parking only partial?
Parking is a real, substantial mitigation that is also genuinely partial. It attacks the single largest consumer (renderer) hard — cutting ~240 MB renderer + ~66 MB GPU and freeing ~735 MB total here — and would scale roughly linearly with terminal count (far bigger at 40–60 terminals). But the main process keeps creeping regardless — parked PTYs still buffer in main — so parking delays and shrinks the OOM curve without flattening it. It buys headroom and time against the biggest single process; it does not stop the main-process drift that would eventually still push toward OOM under indefinite load.

Bottom line: parking bends the renderer curve decisively at the OS level (−43% renderer RSS, −42% total, +300 MB avg free) at matched 16-terminal load — real relief, aimed at the right (largest) process — but it's a partial fix because the main process remains a slow monotonic grower it doesn't address.

brennanb2025 and others added 3 commits July 6, 2026 17:09
…ort guard on e2e worktree prefetch

Co-authored-by: Orca <help@stably.ai>
…en-pane-parking

# Conflicts:
#	tests/e2e/helpers/orca-app.ts
While parked, the dispatcher buffers every chunk (no primary handler) that
the parked watcher has already consumed for side effects. Reveal's
registerPtyDataHandler drained that backlog through the live output
processor with attention enabled — double-firing bell/completion the
watcher already dispatched — and wrote up to 512KiB into the fresh xterm
only for the snapshot restore's 2J/3J clear to wipe it. Dispose now drops
the backlog: the snapshot owns content, the watcher owned the side
effects. Bytes arriving after dispose still buffer and drain normally.

Also reword the parked-exit comments to state the real dead-leaf reveal
behavior (fresh shell, app-restart restore semantics) instead of the
aspirational 'handles dead PTYs per leaf'.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #7448, which lands the same renderer-side fix — unmount hidden terminal panes' xterm/DOM/WebGL trees, keep the PTY and its bell/title/completion side effects alive, remount on reveal — with a more robust restore path:

  • remounts replay the seq-aligned main-process mirror instead of the sequence-less daemon-snapshot reattach path, so an actively-streaming terminal restores with no duplicated or lost lines
  • a 12-tab most-recently-viewed warm set + tunable dwell keeps active multitasking instant (vs. a flat 30s park)
  • scroll-position restore, resize-while-evicted remount, enable-time warm-set seeding, and a fail-open self-disable if replay ever fails structurally
  • parked panes keep BEL/title/status/agent-completion and exit handling at parity with mounted panes

Same experimental opt-in, default-OFF posture as this PR, and the same Windows OOM motivation (#7175, #7017) is covered by the same mechanism.

@Jinwoo-H — this PR was your #7214 parking slice shipped early; with #7448 landing instead, the parking phase of orca-performance will conflict rather than merge over as a no-op. The remaining phases are still very much wanted — especially the main-process side (parked PTYs still buffer in main, which neither PR addresses) — and should build on #7448's seams: the evicted-pane registry, the mirror replay path, and the pane mount policy. Happy to walk through those whenever useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant