Repository navigation
Conversation
…ed agents don't freeze Move setBackgroundThrottling(false) out of the macOS-only block so the main window's renderer stays unthrottled when backgrounded on Windows and Linux too. When a window is minimized/occluded, Chromium otherwise stops requestAnimationFrame and throttles timers to ~1Hz, freezing xterm rendering and the agent status/elapsed timers — a long-running Claude Code session in the often-minimized floating workspace then appears stuck mid-turn even though its subprocess keeps running. The macOS-specific compositor forceRepaint on restore/show stays darwin-gated. Co-authored-by: Orca <help@stably.ai>
|
Ready to review this PR? Stage has broken it down into 2 individual chapters for you:
Chapters generated by Stage for commit a47eff5 on Jun 19, 2026 7:41pm UTC. |
Contributor
Author
|
Closing as obsolete and performance-regressive: the draft was never confirmed on the reporter OS and would permanently unthrottle the renderer on Windows/Linux. #7214 now owns hidden delivery, snapshots, bounded drains, and reveal reconciliation while preserving intentional platform throttling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status:⚠️ Tentative — fix is correct for a real gap, but not yet confirmed against the exact report
This closes a genuine cross-platform gap that produces the reported symptom, but I could not reproduce the permanent freeze on macOS (see Reproduction below), and the reporter's OS is currently unknown. If they're on Windows/Linux this is almost certainly their bug; if they're on macOS and only used the in-app minimize, more digging is needed. Opening as a draft so we can confirm the reporter's OS before merge.
TL;DR
createMainWindow.tsdisabled Chromium background throttling (setBackgroundThrottling(false)) only on macOS. On Windows and Linux the main-window renderer therefore throttles whenever the window is backgrounded (minimized/occluded):requestAnimationFramestops andsetTimeout/setIntervalcollapse to ~1 Hz. That freezes the terminal's xterm rendering and the agent status/elapsed timers, so a long-running Claude Code session in the (often-minimized) floating workspace looks stuck mid-turn — even though the agent's subprocess is still running fine underneath.The fix moves the one line that disables throttling out of the
darwin-only block so it applies on every platform. The macOS-specific compositorforceRepainton restore/show stays gated todarwin.The report
Discord (#bugs, 2026-06-19, from
_fraktall_): "I love the floating workspace! But I noticed Claude Code sessions there can get stuck if the floating workspace is minimized mid-assistant turn. Can you replicate?"The attached screenshot is Claude Code's own footer frozen at
(9m 41s · ↓ 2.6k tokens)— the spinner/elapsed timer stopped advancing. (9m 41swith only2.6koutput tokens is the signature of a long turn that's mostly waiting, e.g. on a tool call, with the timer as the only thing that should be moving.)Thread: https://discord.com/channels/1492228674081263786/1492228675272315163/1517431114682077306
Root cause
The "stuck" appearance is a renderer freeze, not a hang of the agent. The chain:
backgroundThrottling(which istrue), Chromium throttles the backgrounded page:requestAnimationFramecallbacks stop entirely, andsetTimeout/setIntervalare clamped to roughly once per second.9m 41sscreenshot).setTimeoutpump (pane-terminal-output-scheduler.ts) → terminal output barely advances while backgrounded.setIntervals (e.g.WorktreeCardAgents) freeze.Why macOS was already immune and Windows/Linux weren't: the existing
if (process.platform === 'darwin')block callssetBackgroundThrottling(false)(originally added to fix macOS browser-webview "black surface" repaint issues after occlusion/restore). A side effect of that call is that it also keeps the terminal/agent renderer alive when the window is backgrounded — but only on macOS. Windows and Linux never got that call, so they remained exposed to the freeze. This PR makes the freeze-immunity uniform.The change
src/main/window/createMainWindow.tsmainWindow.webContents.setBackgroundThrottling(false)above thedarwincheck so it runs on macOS, Windows, and Linux.restore/show→forceRepaint(mainWindow)handlers macOS-only: they target a macOS-specific compositor black-surface bug, andforceRepaintdoes a 1px window resize nudge that would add a visible flicker on other platforms without benefit (with throttling now off, Win/Linux repaint naturally on restore).src/main/window/createMainWindow.test.tssetBackgroundThrottling(false)is called fordarwin,win32, andlinux, while the repaint handlers register only ondarwin.Reproduction & investigation (full transparency)
I drove a real dev build via CDP and tested the exact scenario plus several harder variants:
pty-dispatcher.tsACKs in afinally), so there is no flow-control backpressure stall.onOpenChange(false)→visibility:hidden, panedisplay:none); the document stays visible, so output keeps draining and it recovers.requestAnimationFrameandsetIntervalkeep running at full rate anddocument.visibilityStatestaysvisible— i.e. the macOSsetBackgroundThrottling(false)guard is doing real work. Without that guard (the Windows/Linux situation), the backgrounded page throttles and the symptoms above follow.Why I couldn't capture a frozen screenshot on this machine (important caveat): the freeze needs Chromium throttling to actually engage, which requires (a) a platform/condition without the guard (Windows/Linux, or macOS occlusion pre-this-PR) and (b) no debugger attached — an attached CDP/DevTools client itself suppresses background throttling. On an instrumented macOS build neither holds, so it always recovers. I reproduced the action, the no-deadlock fact, and the protection mechanism, but not the literal frozen frame.
Verification
vitest run src/main/window/createMainWindow.test.ts→ 54 passed (incl. the new cross-platform test)tsgo --noEmit -p config/tsconfig.node.json→ cleanoxlinton the changed files → cleandarwin); onlywin32/linuxgain it. The macOS path is unchanged, and my earlier macOS minimize/restore Claude test already validates it.Risk & tradeoffs
setBackgroundThrottling(false)keeps the renderer running (incl. rAF) while the window is backgrounded → slightly higher CPU/GPU when minimized. For an agentic terminal app this is the desired behavior (you minimize so agents keep working), and it's exactly what macOS has shipped with already. The output scheduler still suspends rendering for individually hidden panes, so the cost is bounded.setBackgroundThrottlingis a stable Electron API on all platforms; no platform-specific code paths added.How to confirm on Windows/Linux (test plan)
Open question for the reporter
What OS, and did the freeze come from the in-app floating-workspace minimize alone (Orca still in foreground) or from also backgrounding the whole Orca window? Their answer confirms whether this is the complete fix or whether a macOS-specific path also needs attention.
Made with Orca 🐋