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
[Bug]: Preview tabs from other threads stay alive as hidden, unthrottled webviews until restart (13 tabs, ~2.7 GB) #15579
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
Over a working day, let agents in several threads call preview_open (13 tabs across a few threads here).
Never close those previews by hand. The agents never call preview_close either.
Switch to another thread with the preview panel closed and leave the app running.
Expected behavior
Preview tabs that the user can't see, in threads they're not looking at, should be throttled, frozen or discarded. They should also be closed eventually, for example when the thread is idle, archived or deleted. They shouldn't keep a full renderer running for the rest of the session.
Actual behavior
Nothing ever closes them. The desktop trace log shows 13 createTab and 0 closeTab since start. ElectronBrowserHost mounts a HostedBrowserWebview for every session in every thread. Hidden ones are only moved offscreen with CSS, and there is no backgroundThrottling, freeze or discard. The pages keep running scripts, including the ad and tracker iframes of the visited sites. PreviewManager holds the sessions in memory until an explicit close(), and ResourceCleanupService doesn't close previews.
Measured 2026-10, with the T3 Code window visible on another thread and no preview panel open:
18 renderer processes, about 2.7 GB PSS in total. Most of that is the preview tabs; the main window is one renderer.
The main process "Gamepad polling" thread wakes about 245 times a second; the same thread in another Chromium browser here is idle. T3 Code itself doesn't use the Gamepad API, so this is presumably a script on one of the preview pages calling navigator.getGamepads() (fingerprinting scripts do this).
None of this is visible in the UI, so the user can't tell that the previews are still open.
Related: #14966 (sessions outlive a deleted thread), #14730 (inactive macOS previews keep rendering) and #13610 (orphaned hidden tab leaks GPU memory). This issue is the Linux, cross-thread version: threads that are neither deleted nor orphaned.
Impact
Major degradation or frequent failure
Version or commit
v0.0.45 (desktop)
Environment
NixOS, Linux 7.2.8, GNOME (Wayland), Intel Lunar Lake laptop on battery
Workaround
Restart T3 Code (preview sessions aren't persisted), or open each thread and close its previews.
Thanks so much for the careful measurements, @davidvornholt, they made this easy to trace. I checked it on current main (eac52f0087) and on v0.0.45 (6c8fed35dd), and the relevant code is the same on both: preview tabs you aren't looking at stay mounted as live Chromium guests for the rest of the session.
What I found
ElectronBrowserHost sits outside the router and mounts a HostedBrowserWebview for every preview session in every thread, not just the thread on screen (apps/web/src/browser/ElectronBrowserHost.tsx). A thread stays in that index as long as it has sessions (syncActivePreviewThread in apps/web/src/previewStateStore.ts).
closeTab runs only when the React guest unmounts (apps/web/src/browser/desktopTabLifetime.ts), which happens only after an explicit preview.close from the UI or from preview_close / t3_preview_close. Closing the panel or switching threads doesn't close tabs.
On Linux, an inactive guest is parked at (-100000, -100000) with visibility: hidden (apps/web/src/browser/hostedBrowserWebviewStyle.ts). data-preview-rendering="suspended" is only a marker for automation. Nothing calls Chromium freeze or discard, and nothing destroys the guest.
The webview preferences are only contextIsolation=false,sandbox=true,nodeIntegration=false (apps/desktop/src/preview/WebviewPreferences.ts). Electron's default background throttling only applies once Chromium considers the page backgrounded, and the guest is temporarily set to setBackgroundThrottling(false) while recording or in picture-in-picture.
The repo never calls navigator.getGamepads(), so the Gamepad polling wakeups very likely come from a script inside one of those guests, which fits your theory.
ResourceCleanupService only cleans up terminals and attachments, and thread deletion, archive, and settlement don't touch previews (apps/server/src/orchestration-v2/ThreadDeletion.ts).
How this differs from the related issues you linked:
Really suspending inactive guests (panel closed, other thread, and not recording, in picture-in-picture, or held by automation). That could mean freezing them, which keeps page state, or discarding the webview and recreating it from the session URL when the thread is shown again, which frees the memory but reloads the page.
Keeping recording, picture-in-picture, and automation on the existing renderingActive path.
Separately, closing previews when a thread is idle or settled, the way idle terminals already close. That would change current behavior, since tabs are kept today so they're still there when you come back.
Restarting the app or closing each thread's previews remains the workaround for now.
Reopening: #16961 (merge d9f7c0c) still listed Fixes for this issue, but the hidden-tabs commit was reverted before merge (f3bbe7f — Revert "fix(web): hidden browser tabs on macOS stop painting"). main still keeps inactive macOS guests paintable via keepPaintableWhenInactive: isMacPlatform(...), so this is not fixed yet.
Additional measured incident on macOS with the newer server-hosted browser path. Posting here to avoid duplicating the broader retained-preview report; the headless rendering path may warrant separate tracking. Related: #17090.
Environment:
T3 Code Nightly 0.0.46-nightly.20261009.2861, installed commit 3b6af0bd1600.
macOS 26.6, build 25G72, Apple Silicon (Mac17,9), 15 CPU cores, 48 GiB RAM.
Managed chrome-headless-shell 154.0.8037.92.
The user reported mild lag across the system. During read-only inspection:
A T3-owned headless browser's graphics process consumed 140.9% CPU in a timed top sample and 153.7% in a separate rolling ps reading (100% = one core).
Browser launch flags included --disable-gpu --enable-unsafe-swiftshader --force-device-scale-factor=2 --disable-background-timer-throttling --disable-renderer-backgrounding.
Its graphics process used --use-angle=swiftshader-webgl.
The browser had been running for approximately 4 hours 42 minutes and was parented by the T3 backend.
T3's Electron GPU/interface processes and WindowServer were also busy; total system CPU still had about 60% idle capacity.
Memory pressure was normal, swap was zero, data-volume free space was about 846 GiB, and pmset -g therm reported no thermal/performance warning.
preview_status and t3_preview_list for the diagnostic thread returned no tabs. These tools are thread-scoped, so this does not establish that tabs in other threads were inactive or had no automation consumers. Their individual visibility was not inspected.
At the user's request to close previews, SIGTERM was sent only to the identity-verified shared headless browser root process. Its graphics process and all managed headless-browser processes then disappeared; the T3 desktop and backend remained running. A subsequent timed system sample had 72.4% CPU idle (the preceding sample had 74.9%). This was a short live observation, not a controlled benchmark, and no claim is made that all perceived lag was resolved. The browser was stopped at process level because the available normal tab-close tool only covered the diagnostic thread; preview-session metadata cleanup was not verified.
This supports investigating the CPU cost and lifecycle of retained server-hosted browser tabs on local macOS installations, in addition to the earlier native webview reports. It does not establish a memory leak, an exact reproduction sequence, or that SwiftShader alone caused the system-wide lag. Inactive tabs without automation, recording, or viewing consumers should suspend rendering, and users should be able to discover and close retained tabs across threads.
Measurements and this comment prepared with Codex on the user's behalf.
Adding another symptom from #20890 (closed as a duplicate of this one): when the project is a browser game or any page that autoplays audio, every lingering preview tab keeps playing its own copy of the soundtrack. After a few rounds of agent checks across threads, you hear dozens of copies of the same loop playing over each other, and the UI gives no way to tell which tabs are making the noise. Settling the threads doesn't stop it either. On macOS here (v0.0.45).
I've opened #20893 in Ideas for user-facing controls (mute preview tabs by default, an audio indicator, "Mute all" / "Close all preview tabs") as a stopgap alongside the lifecycle fix here.
Another measured incident, on Windows, much larger than the original report.
Environment:
T3 Code (Beta) 0.1.9, Windows 11 Home, 64 GB RAM, WSL2 backend.
About eight threads open; agents in several of them had used preview tools over the session.
Measured with Get-CimInstance Win32_Process before a restart:
Process type
Count
Working set
renderer
116
16.7 GB
main
1
0.6 GB
gpu-process
1
0.3 GB
utility
1
0.1 GB
The largest renderer held 1.7 GB; most of the others held 0.1 to 0.3 GB each.
Effect: Windows was at 49 of 64 GB used. WSL could not get its memory back, and it used 6 of 8 GB of swap. The whole machine lagged.
After a full quit and restart of T3 Code: 5 processes, 0.9 GB. Windows went down to 31 GB used, and WSL went back to 0 swap.
I can't confirm that every one of the 116 renderers was a retained preview tab, because they were gone after the restart. The growth pattern and the full recovery after the restart match this issue.
Another measured incident, on a low-memory Mac with a remote environment. Two details may be new: killing the renderers does not help, and settled threads keep their tabs.
Environment:
T3 Code Nightly 0.1.9-nightly.20261110.4478, macOS 26.3, MacBook Air with 8 GB RAM.
The desktop app connects to a remote environment on another machine. All of the threads ran there.
What happened:
I ran about 16 threads in one batch. Each produced an HTML page, and a preview tab opened for it.
All the threads settled within an hour. None were archived. Their 19 preview tabs stayed open.
Four days later, the desktop app held 19 preview renderers. top showed 150 to 370 MB each, mostly compressed. That came to about 4 GB on an 8 GB machine, with swap at 4.5 of 5 GB.
renderer-history.ndjson showed each one as "surface":"preview", with a tabId of [remoteEnvironmentId, threadId, …, tab_x].
Killing the renderer processes does not work. PreviewManager re-registers every webview, and all 19 renderers came back within seconds. The desktop trace shows render-process-gone and then registerWebview for each tab.
What worked was a reload of the main window. The tab list lives only in that window's memory, so the tabs did not come back. Swap fell from 4.5 GB to 2.9 GB.
The existing ServerBrowser idle policy does not cover these tabs. It has AGENT_TAB_LIMIT = 8, SERVER_TAB_LIMIT = 32 and AGENT_TAB_IDLE_MS = 30 min, but desktop webview tabs have no limit and no expiry.
Suggested fix, in order of preference:
Destroy a hidden tab's webview after N minutes. Keep its URL, title and favicon, and load it again when the user opens that preview panel. Tabs in settled threads qualify sooner.
Add a setting to close a thread's desktop preview tabs when it settles or is archived.
Cap live preview webviews across all threads, and suspend the least recently used tab first.
Adding my experience and a vote for automatically closing a thread’s previews when it settles.
On T3 Code Beta 0.1.9, on an Apple Silicon MacBook Pro with 24 GiB RAM, my Mac was getting hot and RAM pressure remained high. Inspection found previews from completed/settled threads still loaded.
We closed 27 old preview tabs through T3’s UI, leaving active previews, conversations and current work open. Approximate observations before and after:
Total T3 process memory reported by macOS top (including compressed memory): 8,063 MiB → 3,470 MiB, about 4.5 GiB released.
T3 process count: 41 → 17.
macOS kern.memorystatus_vm_pressure_level: 2 → 1.
These were live observations, not a controlled benchmark; other work continued during cleanup. The heat investigation also found a busy macOS suggestd process, so I’m not attributing all the heat to T3.
My preferred workflow is simple: settle a thread → close its preview tabs and release their renderers, while keeping conversations, files and active threads intact. Ideally keep the last URLs available to reopen, and offer an opt-out if some users want previews to stay live. Merely hiding a preview or stopping its dev server doesn’t solve the retained RAM problem.
This seems to belong here rather than #34681, which explicitly leaves preview lifetime/memory cleanup out of scope. Happy to see this addressed through the existing upstream work rather than needing a custom app build.
Measurements collected with Codex; posted at my request.
Activity
juliusmarminge commentedon Oct 4, 2026
Note
Grok responding on behalf of Julius.
Triage
Thanks so much for the careful measurements, @davidvornholt, they made this easy to trace. I checked it on current
main(eac52f0087) and on v0.0.45 (6c8fed35dd), and the relevant code is the same on both: preview tabs you aren't looking at stay mounted as live Chromium guests for the rest of the session.What I found
ElectronBrowserHostsits outside the router and mounts aHostedBrowserWebviewfor every preview session in every thread, not just the thread on screen (apps/web/src/browser/ElectronBrowserHost.tsx). A thread stays in that index as long as it has sessions (syncActivePreviewThreadinapps/web/src/previewStateStore.ts).closeTabruns only when the React guest unmounts (apps/web/src/browser/desktopTabLifetime.ts), which happens only after an explicitpreview.closefrom the UI or frompreview_close/t3_preview_close. Closing the panel or switching threads doesn't close tabs.(-100000, -100000)withvisibility: hidden(apps/web/src/browser/hostedBrowserWebviewStyle.ts).data-preview-rendering="suspended"is only a marker for automation. Nothing calls Chromium freeze or discard, and nothing destroys the guest.contextIsolation=false,sandbox=true,nodeIntegration=false(apps/desktop/src/preview/WebviewPreferences.ts). Electron's default background throttling only applies once Chromium considers the page backgrounded, and the guest is temporarily set tosetBackgroundThrottling(false)while recording or in picture-in-picture.navigator.getGamepads(), so the Gamepad polling wakeups very likely come from a script inside one of those guests, which fits your theory.ResourceCleanupServiceonly cleans up terminals and attachments, and thread deletion, archive, and settlement don't touch previews (apps/server/src/orchestration-v2/ThreadDeletion.ts).How this differs from the related issues you linked:
preview_resizetimeout. These tabs were never evicted.Likely fix area
A few options a maintainer could weigh:
renderingActivepath.Restarting the app or closing each thread's previews remains the workaround for now.
A maintainer will decide on the fix direction.
juliusmarminge commentedon Oct 8, 2026
Note
Grok responding on behalf of Julius.
Reopening: #16961 (merge
d9f7c0c) still listedFixesfor this issue, but the hidden-tabs commit was reverted before merge (f3bbe7f— Revert "fix(web): hidden browser tabs on macOS stop painting").mainstill keeps inactive macOS guests paintable viakeepPaintableWhenInactive: isMacPlatform(...), so this is not fixed yet.TheCommandCat commentedon Oct 9, 2026
Additional measured incident on macOS with the newer server-hosted browser path. Posting here to avoid duplicating the broader retained-preview report; the headless rendering path may warrant separate tracking. Related: #17090.
Environment:
0.0.46-nightly.20261009.2861, installed commit3b6af0bd1600.Mac17,9), 15 CPU cores, 48 GiB RAM.chrome-headless-shell154.0.8037.92.The user reported mild lag across the system. During read-only inspection:
topsample and 153.7% in a separate rollingpsreading (100% = one core).--disable-gpu --enable-unsafe-swiftshader --force-device-scale-factor=2 --disable-background-timer-throttling --disable-renderer-backgrounding.--use-angle=swiftshader-webgl.pmset -g thermreported no thermal/performance warning.preview_statusandt3_preview_listfor the diagnostic thread returned no tabs. These tools are thread-scoped, so this does not establish that tabs in other threads were inactive or had no automation consumers. Their individual visibility was not inspected.At the user's request to close previews, SIGTERM was sent only to the identity-verified shared headless browser root process. Its graphics process and all managed headless-browser processes then disappeared; the T3 desktop and backend remained running. A subsequent timed system sample had 72.4% CPU idle (the preceding sample had 74.9%). This was a short live observation, not a controlled benchmark, and no claim is made that all perceived lag was resolved. The browser was stopped at process level because the available normal tab-close tool only covered the diagnostic thread; preview-session metadata cleanup was not verified.
This supports investigating the CPU cost and lifecycle of retained server-hosted browser tabs on local macOS installations, in addition to the earlier native webview reports. It does not establish a memory leak, an exact reproduction sequence, or that SwiftShader alone caused the system-wide lag. Inactive tabs without automation, recording, or viewing consumers should suspend rendering, and users should be able to discover and close retained tabs across threads.
Measurements and this comment prepared with Codex on the user's behalf.
rene-demonsters commentedon Oct 17, 2026
Adding another symptom from #20890 (closed as a duplicate of this one): when the project is a browser game or any page that autoplays audio, every lingering preview tab keeps playing its own copy of the soundtrack. After a few rounds of agent checks across threads, you hear dozens of copies of the same loop playing over each other, and the UI gives no way to tell which tabs are making the noise. Settling the threads doesn't stop it either. On macOS here (v0.0.45).
I've opened #20893 in Ideas for user-facing controls (mute preview tabs by default, an audio indicator, "Mute all" / "Close all preview tabs") as a stopgap alongside the lifecycle fix here.
test(desktop): relay must not force Playwright focus emulation onto h…
test(desktop): reproduce #15579, relay forces focus emulation onto hi…
test(desktop): reproduce #15579, focus emulation expires under a pend…
hanhyperfx commentedon Nov 14, 2026
Another measured incident, on Windows, much larger than the original report.
Environment:
0.1.9, Windows 11 Home, 64 GB RAM, WSL2 backend.Measured with
Get-CimInstance Win32_Processbefore a restart:The largest renderer held 1.7 GB; most of the others held 0.1 to 0.3 GB each.
Effect: Windows was at 49 of 64 GB used. WSL could not get its memory back, and it used 6 of 8 GB of swap. The whole machine lagged.
After a full quit and restart of T3 Code: 5 processes, 0.9 GB. Windows went down to 31 GB used, and WSL went back to 0 swap.
I can't confirm that every one of the 116 renderers was a retained preview tab, because they were gone after the restart. The growth pattern and the full recovery after the restart match this issue.
jtksystems commentedon Nov 15, 2026
Another measured incident, on a low-memory Mac with a remote environment. Two details may be new: killing the renderers does not help, and settled threads keep their tabs.
Environment:
0.1.9-nightly.20261110.4478, macOS 26.3, MacBook Air with 8 GB RAM.What happened:
topshowed 150 to 370 MB each, mostly compressed. That came to about 4 GB on an 8 GB machine, with swap at 4.5 of 5 GB.renderer-history.ndjsonshowed each one as"surface":"preview", with atabIdof[remoteEnvironmentId, threadId, …, tab_x].Killing the renderer processes does not work.
PreviewManagerre-registers every webview, and all 19 renderers came back within seconds. The desktop trace showsrender-process-goneand thenregisterWebviewfor each tab.What worked was a reload of the main window. The tab list lives only in that window's memory, so the tabs did not come back. Swap fell from 4.5 GB to 2.9 GB.
The existing
ServerBrowseridle policy does not cover these tabs. It hasAGENT_TAB_LIMIT = 8,SERVER_TAB_LIMIT = 32andAGENT_TAB_IDLE_MS = 30 min, but desktop webview tabs have no limit and no expiry.Suggested fix, in order of preference:
andrewslabbert commentedon Nov 16, 2026
Adding my experience and a vote for automatically closing a thread’s previews when it settles.
On T3 Code Beta 0.1.9, on an Apple Silicon MacBook Pro with 24 GiB RAM, my Mac was getting hot and RAM pressure remained high. Inspection found previews from completed/settled threads still loaded.
We closed 27 old preview tabs through T3’s UI, leaving active previews, conversations and current work open. Approximate observations before and after:
top(including compressed memory): 8,063 MiB → 3,470 MiB, about 4.5 GiB released.kern.memorystatus_vm_pressure_level: 2 → 1.These were live observations, not a controlled benchmark; other work continued during cleanup. The heat investigation also found a busy macOS
suggestdprocess, so I’m not attributing all the heat to T3.My preferred workflow is simple: settle a thread → close its preview tabs and release their renderers, while keeping conversations, files and active threads intact. Ideally keep the last URLs available to reopen, and offer an opt-out if some users want previews to stay live. Merely hiding a preview or stopping its dev server doesn’t solve the retained RAM problem.
This seems to belong here rather than #34681, which explicitly leaves preview lifetime/memory cleanup out of scope. Happy to see this addressed through the existing upstream work rather than needing a custom app build.
Measurements collected with Codex; posted at my request.