Skip to content

[Bug]: Closed SSH tabs return after relaunch, agent sessions get mixed up, and Orca runs hot #15136

Closed

Description

@gaolongxi

Operating system

macOS

Orca version

1.4.184

Details

Details

After using an SSH-backed workspace with long-running Codex terminals for several hours, Orca keeps using CPU and the MacBook becomes noticeably hot.

Restarting Orca reduces the load temporarily, but the problem eventually returns.

Steps to reproduce

  1. Open an SSH-backed workspace.
  2. Run Codex in one or more terminal tabs.
  3. Keep the sessions open for several hours and switch between tabs or workspaces.
  4. Check Orca's processes in Activity Monitor.

Expected behavior

Once terminal output has settled, the renderer and GPU processes should return close to idle.

Actual behavior

Orca continues using CPU across its main, renderer, and GPU processes:

  • Immediately after relaunch and workspace restore: around 30–36% combined
  • After the initial restore settles: around 17–27% combined

The MacBook remains warm and battery drain increases.

Diagnostics

The following events appeared repeatedly in:

~/Library/Application Support/Orca/logs/main.trace.ndjson

2125 terminal_replay_guard_wedged_release
 950 terminal_webgl_diagnostic
  39 terminal_park_verdict_churn

All terminal_replay_guard_wedged_release events were associated with the same terminal pane.

Most WebGL diagnostics were:

kind: webgl-atlas-reset
reason: visibility-resume
reason: settled-reveal
reason: tab-reveal

The park diagnostics showed the same terminal changing state 3–11 times within one second.

After restarting Orca, another 33 terminal_replay_guard_wedged_release events and 3 WebGL atlas resets occurred during the first minute.

This happened in the same workspace where closed terminal tabs were restored after relaunch, although I do not know whether both problems have the same root cause.

Activity

  1. added theissue type on Aug 17, 2026
  2. OrcaWin commented on Aug 18, 2026

    @OrcaWin
    Collaborator

    Related to #12447 (closed SSH tabs resurrecting on reattach). Leaving this open: the title mentions restored closed tabs, but the body and diagnostics are a distinct heat/CPU issue (terminal_replay_guard_wedged_release, WebGL atlas resets, park churn).

  3. nwparker commented on Aug 18, 2026

    @nwparker
    Contributor

    We merged a few PRs related to this they just aren't released yet. Might solve the issues 🤔

    If you can update to the latest hourly build, that'd tell us.

    Image

    To see the above, OPTION click the update area

  4. nwparker commented on Aug 28, 2026

    @nwparker
    Contributor

    Leaving this open. The one-line side note is fixed; the CPU/heat problem the body actually documents is not. @OrcaWin's read above is correct and stands.

    Fixed: "closed terminal tabs were restored after relaunch". #16752 makes a user close of a remote terminal tab durable — it records a client-local tombstone (src/shared/closed-terminal-tab-tombstones.ts), which remote-workspace-session-merge.ts uses to drop a tab the host still lists but this client watched the user close. It also fixes the tombstone map being stripped from the session schema on every launch, which is the part that specifically mattered for "after relaunch".

    Not fixed — the actual subject of this report. Nine terminal-tab PRs landed and not one of them touches the code behind your three counters:

    diagnostic code touched?
    terminal_replay_guard_wedged_release ×2125 src/renderer/src/components/terminal-pane/replay-guard.ts no
    terminal_webgl_diagnostic ×950 (webgl-atlas-reset) src/renderer/src/lib/pane-manager/pane-manager-registry.ts no
    terminal_park_verdict_churn ×39 src/renderer/src/components/terminal-pane/terminal-park-verdict-flip-telemetry.ts no

    So there is no reason to expect your CPU numbers to move, and I would not want this closed on the strength of the tab fix.

    The thread worth pulling is that all 2125 wedged-release events are on a single pane, and your webgl-atlas-reset reasons are all reveal-shaped (visibility-resume, settled-reveal, tab-reveal) while the park verdict for that same pane flips 3–11 times per second. A pane whose park verdict is flapping would be repeatedly hidden and revealed, each reveal re-uploading the glyph atlas and re-arming the replay guard — which would make the park churn the driver and the other two counters symptoms, rather than three separate faults. That is a hypothesis, not something I have confirmed.

    If you can get onto an hourly build past these merges, a fresh main.trace.ndjson would be genuinely useful — my expectation is that the closed-tab restoration stops and all three counts stay where they are, and confirming that narrows this issue to the park/reveal loop.

  5. nwparker commented on Aug 28, 2026

    @nwparker
    Contributor

    Dug into the CPU/heat half. @OrcaWin's hypothesis holds — park churn is the driver, the WebGL atlas resets and the wedged replay guards are downstream of it. PR: #17009.

    How I confirmed it. I found the same signature in a local 25-hour main.trace.ndjson, which let me look at the raw crumbs rather than just the counts:

    terminal_park_verdict_churn  x10 — every one for the SAME tabId
      trigger=burst  flips=3..6  elapsedMs=75..153  windowMs=1000  pinnedForMs=60000
    

    Two things there settle it:

    1. 3–6 flips in 75–153 ms is 20–45 park/reveal flips per second on one pane — your "3–11 times within one second", worse.
    2. The bursts recur 60 008 / 60 020 / 60 012 ms apart, which is exactly the pinnedForMs window. There is already a circuit breaker that pins a flapping tab unparked for 60 s after 3 flips in a second. It engages, goes quiet, expires, and the very next flip 8–31 ms later re-bursts. Some crumbs report flips: 6, which is only possible if flips kept accumulating while a pin was live.

    So the brake was running but pressing on nothing. It was silencing its own warning light for 60 s at a time while the pane kept remounting underneath, which is why nine tab-related PRs could land without moving your numbers.

    Atlas resets in my log came out visibility-resume 122 / settled-reveal 122 — a perfect 1:1 pair, matching your reason mix. And the replay guard fits mechanically: a reveal replays the buffer with a 10 s parse probe; if the pane is unmounted again before xterm drains, the write never parses and releases as wedged 10 s later. 2125 of those on one pane ≈ 2125 reveal→re-park cycles, at the ~170 ms flat remount cost the code itself cites — roughly 6 minutes of pure remount CPU, plus the churn of allocating and destroying a multi-megabyte terminal buffer 2000 times.

    Root cause. The park verdict is worktree-level park OR per-tab cold park, plus a separate activation-deferred branch. The flip pin was counted on the combined verdict but applied only to the per-tab cold-park list, so a loop driven by the worktree-level verdict (or the deferred branch) short-circuited straight past it. The underlying flip is the known self-referential one: "can the byte watchers cover this tab once its pane is gone?" is answered from state that mounting or unmounting that same pane rewrites. The module's own docstring had already flagged the gap — "read a repeating burst crumb for one tab as 'damping did not reach the oscillating input'" — and a repeating burst crumb is precisely what your trace and mine both show.

    Fix. Apply the pin to the rendered verdict rather than to one of its inputs, and expire pins for every live tab so damping lapses on its own instead of re-arming forever. On a deterministic repro: 400 flips / 200 pane mounts → 4 flips / 3 mounts, settled.

    One thing I could not close out, honestly. This stops the remount thrash, but it does not remove the self-referential coverage predicate underneath. The breadcrumb records that the verdict flipped, not which input decided it, so I could not pin down from code reading alone which term flips for your SSH panes specifically. Carrying the deciding input in the crumb is the follow-up.

    If you do get onto a build with #17009, a fresh main.trace.ndjson would be the clean confirmation: terminal_park_verdict_churn should stay at roughly a crumb a minute but terminal_replay_guard_wedged_release and the reveal-shaped webgl-atlas-reset counts should fall sharply, since they were paying for the flips that crumb was hiding. Thanks for the diagnostics — the three counters together are what made this findable.

  6. nwparker commented on Aug 28, 2026

    @nwparker
    Contributor

    The performance half of this report is now fixed — #17009, merged.

    What was actually happening

    The hypothesis in my earlier comment held: park churn was the driver, and the atlas resets and wedged replay guards were symptoms. But the real finding was sharper than that.

    The loop was already known, it already had a brake, and the brake was wired to nothing.

    The rendered verdict is coldParkTerminalPanes || (per-tab cold park), plus a separate activationDeferredMountTabIds branch (use-terminal-tab-cold-parking.ts:303). The existing flip pin filtered only the per-tab cold list, so a loop driven by the worktree-level verdict — the canWatcherCoverParkedTerminalTab veto at Terminal.tsx:1035-1046 — short-circuited straight past it. getParkVerdictUnparkPinUntilMs was cold-set-only for the same reason, which is why pins expired on a forever-60s cadence. The module's own docstring had predicted this exact failure mode.

    Independent reproduction

    Rather than working only from your counters, the same signature was found in a separate local 25h main.trace.ndjson, which gave raw crumbs instead of totals:

    • all churn events on one tab, trigger=burst, flips=3..6 in elapsedMs=75..153 → 20–45 flips/sec (worse than the 3–11 in your trace)
    • bursts recurring at 60008 / 60020 / 60012 ms — exactly pinnedForMs
    • some bursts reporting flips: 6, which is only possible if flips accumulated while a pin was live — the pin silenced its own breadcrumb and stopped nothing
    • visibility-resume 122 / settled-reveal 122, a perfect 1:1, matching your reveal-shaped reasons

    Your 2125 wedged guards ≈ 2125 reveal→re-park cycles × the code's own ~170 ms flat remount ≈ 6 minutes of pure remount CPU, plus multi-MB glyph-buffer alloc/free ~2000×. That is the heat.

    The fix

    Apply the pin to the rendered verdict rather than one of its inputs, and expire pins for every live tab. Not a new threshold, not a debounce — the same already-derived brake, moved from an input to the actuator.

    flips pane mounts renders
    before 400 200 401 (hard stop)
    after 4 3 6, settled

    Honest limit

    This stops the remount thrash. It does not remove the self-referential coverage predicate underneath. The breadcrumb records that the verdict flipped, not which input decided it, so the specific flipping term for your SSH panes could not be isolated from static reading. Attributing the driver in the crumb is the follow-up.

    If you can get onto a build past this merge, a fresh main.trace.ndjson would confirm it directly — the expectation is terminal_park_verdict_churn collapsing toward zero and both terminal_replay_guard_wedged_release and webgl-atlas-reset falling with it. If they don't, that would be genuinely useful to know, because it would mean a second driver.

    Closing on the strength of the reproduction and the measured numbers. Please reopen if your counters don't move.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingos:macosIssues affecting macOS

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions