You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macOS desktop: preview screencast leaves "Capturing" wake lock held, Mac never idle-sleeps #17870
The Mac never goes to idle sleep while the lid is open. pmset -g reports displaysleep 10 (display sleep prevented by T3 Code (Nightly)). The desktop app held Chromium's "Capturing" wake lock for ~23 hours without releasing it.
Diagnosis
The desktop app process holds a NoDisplaySleepAssertion named "Capturing", created 2026-10-09 16:12:11 UTC and never released. Earlier "Capturing" assertions from the same process released normally (e.g. one on 2026-10-08 lasted 30 min).
no startFrameCapture / captureScreenshot / recording spans on the desktop side
"Capturing" is Chromium's wake lock for a capturer with stay_awake=true; a CDP Page.startScreencast holds it until Page.stopScreencast or debugger detach.
Possible leak path (code reading at v0.0.46-nightly.20261007.2774, not reproduced). Server viewer/recording screencasts reach desktop-drawn tabs through the CDP relay on the guest's long-lived Electron debugger. Several teardown paths never deliver Page.stopScreencast:
apps/desktop/src/preview/DesktopBrowserHost.ts:145-152 (detach), :188-191 (release), :197-206 (announceAll) reset the relay without stopping an active screencast.
apps/server/src/preview/ServerBrowser.ts:644-663 (dropTab) closes tab.desktop before the viewer finalizer sends Page.stopScreencast, so that send fails and is swallowed. An active recording screencast is never stopped (only the encoder is closed, :657).
apps/desktop/src/preview/Manager.ts:1120-1128 acks every Page.screencastFrame even with no consumer, so an orphaned screencast keeps running.
Re-attaching a tab (e.g. window activation → registerWebview → browserHost.attach) could leave a screencast and its stay_awake capturer on the guest until the tab or app closes.
Suggested fix: stop any screencast on the guest debugger when the relay is released or detached, and stop viewer/recording screencasts in dropTab before closing the desktop connection.
main has no changes to these paths since this build.
Steps to reproduce
Not reproduced deterministically. Observed sequence: preview tab open in the desktop app → window re-activated → preview webview re-registered → "Capturing" assertion created and never released.
#17180 has the same symptom on Linux (hidden agent preview tab holding "Capturing"). This report is the macOS desktop case and adds a candidate leak path through the screencast relay.
Fix applied or workaround
Close all preview tabs, or quit and reopen the app. Check with pmset -g assertions | grep Capturing.
The screencast probably isn't what holds this lock. In Chromium 152 (Electron 44.9.3), Page.startScreencast takes no capturer handle. PageHandler::StartScreencast and DevToolsVideoConsumer never call IncrementCapturerCount. Page.captureScreenshot does, at page_handler.cc:1432 with stay_awake=true, and keeps it until the screenshot callback runs. The only other holder is a tab-capture stream from the getDisplayMedia recording path.
It happened again here: T3 held "Capturing" from 2026-10-23 19:29:04, about 11 s after a preview guest's renderer started, for 25.6 hours. It was released only when the app crashed in that screenshot callback (#24094). So this leak and that crash look like the same stuck screenshot. Details and timeline are in #24094.
🤖 Claude Opus 5.5 responding on behalf of Igor-Abramkin
Seeing the same leak on T3 Code (Beta) 0.1.2, macOS 27.0.1 (26A434), Apple silicon. Four "Capturing" assertions, each created a few seconds after a preview guest renderer started, still held 6 to 8 hours later.
Assertion creation time (from age at 2026-10-27 00:05:40 UTC+03:00) against the start time of a guest renderer (--type=renderer with --enable-blink-features):
Guest renderer started (2026-10-26)
Assertion created
Gap
15:56:11
15:56:28
17 s
15:59:52
16:00:01
9 s
17:03:56
17:04:03
7 s
18:07:31
18:07:40
9 s
Seven other guest renderers from the same session (started 11:38, 11:39, 14:16, 16:11, 16:21, 19:38, 20:01) have no matching assertion, so it isn't every preview tab. All four leaking guests are still alive. This is the same pattern as the ~11 s gap in the comment above, and it fits a capture taken shortly after a guest loads (an agent preview_snapshot → Page.captureScreenshot) that never completes. I haven't confirmed which call took each lock.
Same leak on T3 Code (Beta) 0.1.2, macOS (Darwin 24.6.0).
Three "Capturing" NoDisplaySleepAssertions held by the desktop process for 137–257 h:
displaysleep 10 (display sleep prevented by T3 Code (Beta), T3 Code (Beta), T3 Code (Beta))
sleep 30 (sleep prevented by powerd)
Two of them were created in the same second as an agent preview_open with {"url":"http://localhost:8799/","open":false} (hidden preview), immediately followed
by preview_snapshot. Both threads then completed or were cancelled, but the locks
were never released. This matches the hidden-guest screenshot path described in #25978.
Additional problem: the orphaned hidden tabs cannot be closed from the agent side.
Asking each owning thread to run t3_preview_list + t3_preview_close finds the tab
(tab_1_… and tab_9_…, hidden, on localhost:8799), but t3_preview_close is refused
with agentMismatch because the tab belongs to a previous agent session of the same
thread. The hidden tab isn't visible in the UI either, so there is no way to release the
lock short of quitting the app.
Activity
SKCarlsson commentedon Oct 24, 2026
The screencast probably isn't what holds this lock. In Chromium 152 (Electron 44.9.3),
Page.startScreencasttakes no capturer handle.PageHandler::StartScreencastandDevToolsVideoConsumernever callIncrementCapturerCount.Page.captureScreenshotdoes, atpage_handler.cc:1432withstay_awake=true, and keeps it until the screenshot callback runs. The only other holder is a tab-capture stream from thegetDisplayMediarecording path.It happened again here: T3 held "Capturing" from 2026-10-23 19:29:04, about 11 s after a preview guest's renderer started, for 25.6 hours. It was released only when the app crashed in that screenshot callback (#24094). So this leak and that crash look like the same stuck screenshot. Details and timeline are in #24094.
Igor-Abramkin commentedon Oct 26, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Igor-Abramkin
Seeing the same leak on T3 Code (Beta) 0.1.2, macOS 27.0.1 (26A434), Apple silicon. Four "Capturing" assertions, each created a few seconds after a preview guest renderer started, still held 6 to 8 hours later.
Assertion creation time (from age at 2026-10-27 00:05:40 UTC+03:00) against the start time of a guest renderer (
--type=rendererwith--enable-blink-features):Seven other guest renderers from the same session (started 11:38, 11:39, 14:16, 16:11, 16:21, 19:38, 20:01) have no matching assertion, so it isn't every preview tab. All four leaking guests are still alive. This is the same pattern as the ~11 s gap in the comment above, and it fits a capture taken shortly after a guest loads (an agent
preview_snapshot→Page.captureScreenshot) that never completes. I haven't confirmed which call took each lock.ACJF00 commentedon Nov 4, 2026
Same leak on T3 Code (Beta) 0.1.2, macOS (Darwin 24.6.0).
Three "Capturing" NoDisplaySleepAssertions held by the desktop process for 137–257 h:
Two of them were created in the same second as an agent
preview_openwith{"url":"http://localhost:8799/","open":false}(hidden preview), immediately followedby
preview_snapshot. Both threads then completed or were cancelled, but the lockswere never released. This matches the hidden-guest screenshot path described in #25978.
Additional problem: the orphaned hidden tabs cannot be closed from the agent side.
Asking each owning thread to run
t3_preview_list+t3_preview_closefinds the tab(
tab_1_…andtab_9_…, hidden, onlocalhost:8799), butt3_preview_closeis refusedwith
agentMismatchbecause the tab belongs to a previous agent session of the samethread. The hidden tab isn't visible in the UI either, so there is no way to release the
lock short of quitting the app.
Workaround: quit and relaunch the app.