Repository navigation
Description
Summary
Codex Desktop's bundled Computer Use runtime can leave a ScreenCaptureKit stream running after the Computer Use interaction/session has ended. The stale stream continued producing roughly 55–56 frames per second with no consumer, driving WindowServer to about 50–60% CPU and 59% GPU on macOS.
Fully quitting Codex clears the condition. Closing the target application or ending the visible Computer Use interaction does not.
Environment
- macOS 26.5.2 (25F84), arm64
- Codex Desktop 26.721.41059 (build 5848)
- Bundled Codex CLI
0.146.0-alpha.3.1 - Computer Use runtime 26.721.1000502 (build 1000502)
- One active external display: 2560×1440 at 100 Hz
Reproduction
- Launch Codex Desktop on macOS.
- Use the bundled Computer Use capability to inspect/control another macOS app.
- Finish the interaction and fully quit the target app.
- Stop making Computer Use calls and inspect Activity Monitor using All Processes, sorted by
% GPU. - Inspect the running Computer Use helpers and recent
replayd/SkyComputerUseServiceunified logs.
The issue may be easier to reproduce after more than one Codex task/thread has loaded Computer Use. In this reproduction, two SkyComputerUseClient event-stream mcp processes remained connected to one SkyComputerUseService.
Actual behavior
After the target app had fully exited:
- No target-app process remained.
WindowServerwas approximately 56.6% CPU and 59.4% GPU.- Codex's own GPU process was below 1% GPU at the same time.
- One
SkyComputerUseServiceand twoSkyComputerUseClient event-stream mcpprocesses remained. replaydstill reported an active capture session attributed to theSkyComputerUseServicePID.
Representative sanitized log evidence:
FigVideoQueueGMStats: 334 frames enqueued in the last 6 seconds
recent frames: enqueued: 335, displayed: 0, evicted: 335
SCCaptureSession setupHealthMonitor: screenframeCount=279
fetchShareableContent... currentProcessID=<SkyComputerUseService PID>
The screenframeCount samples were taken five seconds apart, corresponding to roughly 55–56 captured frames per second. Frames continued to be generated even when none were displayed and all were evicted.
Resetting the current node_repl Computer Use client stopped one capture stream, but another stream continued at the same rate. WindowServer remained around 46–49% CPU during a separate 10-second top sample with no UI automation calls being made.
No GPU reset, GPU hang, AGX timeout, GPU fault, or Metal fault appeared in the same one-hour log window.
Expected behavior
When the Computer Use tool call/turn/session ends and there is no active consumer:
- its ScreenCaptureKit stream should stop;
- stale per-thread MCP clients should be disconnected or reaped;
SkyComputerUseServiceshould not continue producing frames that are immediately evicted;WindowServerGPU usage should return to its normal idle level.
Workaround
Fully quit Codex with Cmd-Q, wait for SkyComputerUseService and SkyComputerUseClient to exit, and reopen Codex.
Suggested fix
- Tie each ScreenCaptureKit stream to an explicit consumer/session lifetime.
- Stop and invalidate the stream when the last consumer disconnects or a turn ends.
- Add an idle guard: if frames are continuously evicted with no displayed/consumed frames, tear down the stream.
- Reap stale
event-stream mcpclients and prevent multiple abandoned clients from keeping capture alive. - Add a regression test that verifies helper count and active ScreenCaptureKit streams return to baseline after a Computer Use turn ends.
Related issue
- macOS Computer Use leaks SkyComputerUseClient turn-ended helpers #29157 tracks leaked
SkyComputerUseClient turn-endednotifier helpers. This report is related but distinct: the leaked clients here areevent-stream mcpclients and an active ScreenCaptureKit stream continues rendering at high frame rate, causing sustainedWindowServerGPU load.
Activity
galligan commentedon Aug 5, 2026
Confirming this on a newer build, with per-client CPU measurements that may help isolate the stranded stream.
Environment
Different display configuration, same symptom — so this does not appear to be specific to a particular refresh rate or external-display setup.
Observed
SkyComputerUseClient event-stream mcpclients accumulate against a singleSkyComputerUseServiceand are never reaped. The original report saw 2; this machine currently has 10, all children of the ChatGPT.appcodex ... app-server(pid uptime 21h39m).The part that may be diagnostic: per-client CPU is constant
Each leaked client burns a near-identical fraction of a core, independent of how long it has been alive:
The ratio does not decay as a client ages. That is consistent with each client holding its own fixed-rate periodic work item (e.g. a capture stream at a constant FPS) that continues after the consumer is gone, rather than a one-time cost or a slow drain. Practical consequence: total CPU cost scales linearly with the leak count — currently ~12% of one core, continuously, at 10 clients.
WindowServeron this machine has been sitting at 34–61% CPU with 2.2–3.9 GB resident across several days of observation, which is consistent with the mechanism described in this issue, though I have not independently confirmed the ScreenCaptureKit attribution here.Accumulation rate from a clean boot
Measured across a reboot boundary, so this is a clean-start rate rather than a long-tail accumulation:
event-streamclients/hour (10 clients at 21h39m app-server uptime)On the prior boot the accumulation was heavy enough to push a 128 GB machine into sustained memory pressure: swap file grew 3 GB → 4 GB with 3.2 GB in use, compressor at 19 GB, ~1.1 GB free. After reboot: swap 0, compressor 2.4 GB, 10 GB free. The reboot resolved it and the accumulation immediately began again, which points at lifecycle rather than any single runaway process.
Distinguishing this from the
turn-endedleakThis machine has zero
PPID=1orphans, so this is a distinct path from #26293 and #29157, even though it is the same binary:SkyComputerUseClient turn-endedhelpers, reparented tolaunchd(PPID=1)SkyComputerUseClient event-stream mcp, retained as live children of theapp-server, each holding ongoing periodic workBoth leak paths are reachable from the same install: the
turn-endednotifier is configured vianotify = [".../SkyComputerUseClient", "turn-ended"]inconfig.toml, while theevent-streamclients are spawned by the app-server itself.Related
SkyComputerUseClient mcpprocesses" alongsidenode_replandcodex app-server --listen stdio://helpersturn-ended/ PPID=1 variant described aboveQuitting and relaunching Codex clears the condition, matching the original report. Ending the Computer Use interaction does not.
galligan commentedon Aug 5, 2026
Follow-up to my measurements above, with what I think is a sharper statement of the lifecycle bug.
Each leaked
event-streamclient is 1:1 with a thread, and is stranded exactly when that thread goes idle.How to recover the mapping
The client processes carry no thread identity — args are byte-identical (
SkyComputerUseClient event-stream mcp), and a 1-hour-old client is structurally indistinguishable from a 14-hour-old one (both: 7 threads, 3 pipes, 2systmsockets, same fd profile).state_5.sqliteandlogs_2.sqlitehave no column linking a thread to an OS pid.But the mapping is recoverable by timestamp. For each client, compute
spawn_time = now - etimeand compare againstrecency_atin thethreadstable:Δ is exactly 0 for 8 of 12 clients, across spawn times spanning 14 hours. That is not coincidental alignment.
The four non-matches are the confirming case
Every unmatched client belongs to a thread whose
recency_atadvanced past the client's spawn time:So the correlation holds in both directions:
spawn_time == thread.recency_at— the thread's last activity is frozen at the moment its client spawned. Nothing has happened in that thread since. The client is stranded, yet it keeps its periodic work item alive indefinitely (~1.0–1.33% of a core, per my earlier comment).recency_athas moved on. The client is live.Why this may be useful for a fix
This narrows the bug from "helper processes accumulate" to something more specific: the client is spawned per-thread and is never torn down when its thread goes idle or is navigated away from. The teardown appears to be missing at exactly the point where a thread stops being the active one — not at app quit (which does clean up), and not at turn end (which is the separate #26293 / #29157 path).
It also means the leak count is bounded by "number of threads that have ever used Computer Use this app session," which matches what I observe: the clients accumulate roughly in step with distinct threads used, not with turns taken.
Side note for anyone working around this locally
The same correlation makes a safe local reaper possible without guessing: only kill clients whose spawn time matches an idle thread's
recency_at. Live threads fail to match automatically, so they are protected without needing to be identified. (Read the DB with?immutable=1to avoid lock contention with the running app.) This is a workaround, not a fix — the teardown still belongs in the app.galligan commentedon Aug 5, 2026
Correction to my previous comment. I suggested there that the spawn-time correlation "makes a safe local reaper possible." I tested that, and it does not work. Retracting it, and the reason why turns out to be more informative than the workaround would have been.
The experiment
Killed one stranded client with
SIGTERM— pid 17673, idle 14h42m, matched to a thread whoserecency_athad been frozen since the client spawned.The kill itself was clean: the process exited,
SkyComputerUseServicestayed up, the app-server stayed up, and the other ten clients were untouched. No collateral.But the app-server spawned a replacement within about one second, with the same parent. Watched for three minutes afterward:
Client count held at 11 → 11. The replacement accumulated 1.53 CPU-seconds over 166 seconds — 0.92% of a core, sustained — matching the 1.28–1.33% of the client it replaced. It is not a transient reconnect that idles out.
There is also a second-order problem. The replacement's spawn time is now, so it no longer coincides with any idle thread's
recency_at:So killing a stranded client converts it into one the correlation can never identify again. Applying the approach across all stranded clients would yield the same number of processes, the same CPU cost, and no way to detect them afterward. Do not use the workaround I described.
What this says about the bug
These clients are supervised, not merely leaked. The app-server maintains one per thread and restarts it when it dies.
That reframes the defect. It is not "teardown is missing at process exit" — teardown is being actively defeated by a supervisor that is doing what it was designed to do. The missing step is earlier: the thread is never deregistered as needing a Computer Use client when it goes idle, so the supervisor correctly keeps honoring a registration that should have been released.
That also explains cleanly why quitting the app is the only thing that clears the condition, as the original report noted: quitting destroys the supervisor along with the whole registration set. Nothing short of that can win, because anything short of that is arguing with a supervisor.
I do not think there is a viable user-side mitigation, and I would discourage anyone from building one — a scheduled reaper would burn CPU killing processes that immediately return.
Everything in my earlier comments still holds: the 1:1 spawn-time ↔
recency_atcorrelation (Δ = 0 across 8 of 12 clients), the per-client CPU cost, and the accumulation rate. The correlation remains a good way to observe which thread owns which client. It is just not a basis for acting on them.yangwuan55 commentedon Aug 6, 2026
Cross-link to #37062 — fresh WindowServer SIGABRT repro on 26.6 + cua_node dyld loop
Adding a same-day observation from #37062 (the dedicated crash issue): on macOS 26.6 (25G72, xnu
12377.161.13~4), the leak described here is reproducibly crashingWindowServerviaWSCaptureCreateIOSurfaceMachPortForWindowList → WSIOSurfaceDebugTallyAndAbort. Kernel emits "IOSurface count of 65024 approaching limit of 65536" twice in the minutes before the abort.A separate, possibly-related failure mode: 21
node-*.ipsforcua_node(all coalesce to slice87fbc746-7d47-3fd8-b0a3-97018cbf954b) abort indyld4::prepareafter 7.2 s, suggesting the ChatGPT.app bundle's dyld pointer cannot resolve to a real libnode location. May be downstream of the WindowServer abort; may be independent — root cause not isolated yet.Full stacks, PIDs, kernel timeline, workaround, frequency, and suggested fixes are in #37062. Happy to fold any of it back into this thread instead if a maintainer prefers.
coalitionName: ai.lark-channel-bridge.bot.codexon thecua_nodecrashes confirms these were spawned from a Codex session.asin76-svg commentedon Aug 8, 2026
Confirming this on a newer Computer Use runtime and through a non-Codex-Desktop frontend that launches the official Codex app-server.
Environment
codex app-server --enable goals@oai/sky0.6.2Observation
After a Paseo-managed Codex agent used Computer Use for a UI inspection and returned to idle, there were no further Computer Use tool calls, but the capture pipeline remained active:
SkyComputerUseServicestayed at about 23.8% CPU.replaydremained active.SkyComputerUseClient event-stream mcpprocesses remained as children of Codex app-server processes.SkyComputerUseClient turn-endedhelpers, so this is theevent-stream mcppath described here, not the separate notifier leak in SkyComputerUseClient processes spawned for turn-ended events remain alive as PPID=1 orphans #26293.macOS continued to treat the display as actively captured after the agent turn ended. One secondary effect was that macOS suppressed desktop notification banners while its global “show notifications when mirroring or sharing the display” option was disabled.
Lifecycle detail
Paseo keeps the Codex app-server and its
node_replkernel alive between turns. In@oai/sky0.6.2, the macOS path lazily caches a singleton Mac client/native-pipe transport, but the exported Sky API and Mac client declarations expose noclose,dispose, ordisconnectoperation. The bundled Computer Use skill also defines no end-of-task cleanup.In an earlier controlled check, resetting and then terminating the initiating
node_repland its session-specific Computer Use client did not stop frame decoding in the shared service. This is consistent with the supervised-client behavior already documented in this issue: killing an individual client is not a durable workaround.Recovery check
I sent a normal
SIGTERMonly toSkyComputerUseService; Paseo, Codex app-server, and all unrelated processes remained running. After 15 seconds:SkyComputerUseServicewas absent;replaydwas at 0.0% CPU;This clears the stale state but is only a reset, not a lifecycle fix. The service can start again on the next Computer Use request.
This reproduction suggests the regression test should also cover app-server consumers outside Codex Desktop: after the last Computer Use request/turn becomes idle, the ScreenCaptureKit stream and per-thread event-stream registration should be released even when the app-server itself remains alive. A supported macOS transport/session teardown API would also make frontend-level cleanup possible.
Chenyb2006 commentedon Oct 6, 2026
macOS / MacBook Air M5: idle Computer Use shared window causes sustained high load
Adding a related user reproduction report about sustained load while Computer Use is idle. The distinguishing trigger is simply leaving the Computer Use shared window open and visible; no automation actions need to be running.
Environment
Steps to reproduce
Expected behavior
An idle Computer Use shared window should have low, bounded overhead. Merely keeping it visible should not cause sustained high CPU/WindowServer/rendering load, substantial thermal pressure, or system-wide stuttering. Capture and rendering should back off when idle, and minimize/close should promptly release unnecessary work.
Actual behavior
Diagnostic limits and relation to this issue
This is a report of the user's observed behavior, not a fresh instrumented reproduction. Exact CPU percentages, frame-rate measurements, screenshots, and thermal telemetry are not attached; thermal throttling has not been independently verified.
The idle Computer Use / WindowServer load overlaps with this issue, but the minimize/close relief differs from the original report's persistent stream after interaction ends. I have not confirmed that it has the same ScreenCaptureKit lifecycle root cause. The visibility-dependent behavior may also be relevant to #30464. Please include the idle shared-window case when investigating capture/rendering overhead and lifecycle behavior.
giorgio-zamparelli commentedon Nov 1, 2026
Adding a trigger matrix and mechanism from current builds, on the CLI path rather than Codex Desktop threads.
Environment: macOS 26.6.2 (25G83), Apple M5 Max, two 6K and one 5K display at 60 Hz. Codex CLI 0.166.0 (Homebrew), ChatGPT 26.1016.62342, Computer Use 26.1015.1001540,
@oai/sky0.7.12,unified-computer-usethroughcua_repl.Method: each run made one read-only
cua.getApp('/System/Applications/Calculator.app')+getAXState()call, ended the turn a different way, and was timed againstreplayd'sSCCaptureSessionstart, stop andHealthlog lines.notifyrunningSkyComputerUseClient turn-ended-c 'notify=[]'turn_aborted: interrupted)turn_abortedin the rollout)codex resume <id>SkyComputerUseClientruns during a 95-minute stale capture (7 seen)SkyComputerUseServiceWhat this points to:
notify→SkyComputerUseClient turn-endedis the only signal I saw stop the streams. It fires fromAfterAgent, so never for an interrupted or killed turn.Stop/Interruptcleanup hooks from Treat bundled cleanup hooks as built-ins #42110 callcua_repl.turn_ended.node_replruns handlers registered withaddTurnEndedHandler; in this bundle the browser service registers one and@oai/skydoes not. That fits rows 2 and 3, but those hooks are hidden, so I could not observe whether the call itself was delivered.app-serverdoes, soterminal input stream closed; shutting down active threadis not reached on hangup.kill -HUPended the TUI in 70 ms with noturn_abortedin the rollout.SCStreamErrorDomain -3815), 75 minutes after its session was gone.Cost: three streams at about 50 fps on a static Calculator window, so it does not depend on window size or content.
codex resumeand a completed turnOne more observation, from a single run: after the SIGTERM, the service relaunched on demand with PPID 1 instead of as a child of ChatGPT.app, served
getAXStatewith no capture stream at all, and exited by itself about a minute after its last client went away. So these streams may not be needed for AX state.Possible fixes, service side first since it covers every path:
@oai/skyaddTurnEndedHandler, so the existingInterruptandStophooks work withoutnotify.Workaround:
pkill -TERM -x SkyComputerUseService.ARTISTA666 commentedon Nov 8, 2026
On macOS 26.6, ChatGPT 26.1103.41825 (build 25679), a Computer Use screen-capture stream remained active for about 10 minutes after the task ended and its completion signal was acknowledged.
A subsequent troubleshooting attempt started another stream. It stopped only after the user manually selected “Stop Sharing.”
Please investigate whether ScreenCaptureKit resources are released when a Computer Use task ends. The logs confirm the stream remained active, but do not establish continued interaction or data transmission.
ARTISTA666 commentedon Nov 9, 2026
Follow-up: The screen-sharing issue recurred after a computer-use task on Nov 9, 2026.
macOS 26.6 (25G72), Apple Silicon; Codex 26.1103.41825 (build 25679).
Redacted logs (UTC):
Please investigate why the capture stream remained active after the task finished.
Wulfgardr commentedon Nov 10, 2026
Could macOS Computer Use release the capture resources owned by a turn when that turn ends or is interrupted, and confirm that the native capture has stopped? The release would also need to protect other active sessions.
On my Mac, the sharing indicator attributed to ChatGPT stayed on after the agent finished, so I stopped sharing through the system UI. I did not instrument that incident, so I can't tell whether frames were still being acquired or transmitted.
An assistant's read-only inspection of ChatGPT 26.1103.60933 on macOS 27.3 found bundled
@oai/sky0.7.17. The installed unified-computer-use plugin already declares Stop, Interrupt and SubagentStop cleanup hooks, and my configuration already contains the SkyComputerUseClient turn-ended notifier.In the shipped code, the browser service registers
addTurnEndedHandlerand passessession_idandturn_idtofinishTurn. The inspection found no reference toaddTurnEndedHandlerin the macOS Sky modules. The Mac client caches native transports, and its declarations expose no session-release method. These are static observations: they don't establish that another native cleanup path is absent or that this caused the indicator to remain on. Hook delivery from T3 was not measured.Could the maintainers confirm the supported macOS release path? One possible approach is a bounded native release tied to the owning turn, with the native service also handling client disconnects. It should leave other owners active, reject late cleanup from an earlier generation, and report completion only after the owned capture resources have stopped.
Tests could cover completion, interruption, errors, disconnects, duplicate and late cleanup, an in-flight request, concurrent sessions and reacquisition. The same native stream observations should fail on the affected baseline and pass with the fix. No native fix has been tested.
m-szymanska commentedon Nov 23, 2026
Bug Report Draft for OpenAI —
SkyComputerUseServiceleaks 60 FPSScreenCaptureKitstream aftercodex execexits over SSHEnvironment
0.171.026.1117.41037(com.openai.sky.CUAService/SkyComputerUseService+SkyComputerUseClient)codex execusing nativecua_replover SSH (sshd-keygen-wrapper)Summary
When a one-shot
codex execturn interacts with a native macOS app viacua_repl(e.g.,Calculator.app) and exits,SkyComputerUseServicefails to release theScreenCaptureKit(replaydSCCaptureSession) 60 FPS window capture stream. The stream continues indefinitely aftercodex execterminates (~80%WindowServerCPU, ~30% GPU, ~72°C, ~4940 RPM fans) until the captured target app window is manually closed.Root Cause Evidence (macOS Unified Logs)
config.tomlregisters the bundled turn-end hook:codex execruns inside an SSH session (sshd-keygen-wrapper),SkyComputerUseClientattempts to notifySkyComputerUseServicevia AppleEvent, which macOS TCC rejects witherrAEEventNotPermitted:turn-endedfails silently andSkyComputerUseServicedoes not tear down theScreenCaptureKitstream when the MCP client disconnects or thecodex execprocess exits,replaydkeeps streaming 60 FPS BGRA frames of the target window indefinitely.osascript -e 'tell application "Calculator" to quit') immediately triggersnewConfigIsEmpty YES→figVideoRenderPipelineFinalize+xpc_connection_cancel()within 1.4 seconds, droppingSkyComputerUseServiceandreplaydback to0%CPU.Expected Behavior
SkyComputerUseServiceshould release itsScreenCaptureKit(SCCaptureSession) stream automatically when the originating MCP client /cua_replsession disconnects or exits, rather than relying solely on an AppleEventturn-endednotification that fails under SSH TCC contexts.turn-endedIPC is used, prefer a local Mach/Unix-socket/XPC mechanism or idle-capture timeout instead of an AppleEvent subject tosshd-keygen-wrapperTCC denial.johnsilvavlogs commentedon Nov 24, 2026
I saw this on an M1 Max MacBook Pro running macOS 27.2 (26B123), Codex Desktop 26.1117.41037 (29803), and Computer Use helper 26.1116.1001980 (1001980).
One
SkyComputerUseServicestarted two ScreenCaptureKit streams about three minutes apart. They ran for 126 and 123 minutes. The local chat histories I could check were between turns at both start times. I couldn't map either stream to a chat.WindowServeraveraged 56% of one CPU core, the helper averaged 14%, and system-wide GPU use was 31–39%.Could the helper log which consumer owns each stream and what triggers its release? That would help distinguish an intentional background capture from one left behind after an interaction.