Idle agent tab slot reclamation fix for t3code's 32-tab browser limit
Discovered from README cross-links · today
Agent tabs that sat idle now free a slot so new tabs can open past the cap.
What they did
The author fixed a bug in the t3code server where idle agent tabs could fill the 32-tab browser limit and block new tabs until a restart. The change makes explicit agent opens reclaim the longest-idle hidden agent tab once it has been idle for 30 minutes, while protecting viewed tabs, human-owned tabs, and the requesting agent's own limit. They kept the patch narrow under a focused obvious-bug exception: it restores idle-slot recovery for the existing browser budget, pulls in only the visibility signal needed from an earlier PR (#23589), and adds no broader thread-lifecycle cleanup or new workflow. Implementation was done with Claude Opus 5.5 via Claude Code, with review, a visibility correction, and verification by GPT-6.1 Sol via Codex. Evidence was gathered on macOS 27.0.1 arm64 with Electron 44.10.0 and a packaged main build, plus a Linux Electron run. They showed that at 32 real native tabs a new caller's exact request is refused on baseline, then on the fixed head a new caller opens tab 33, hidden tab 02 closes, the count stays at 32, and the shown tab keeps its unsaved note. They also tested a separate native PiP window, a native renderer reload followed by another real 31-minute wait at server offset 0, main-window close and macOS reactivation, and Linux Electron. Some phases used an explicitly labelled server-only +31-minute clock offset; the head runs used real idle time.
How it went
The fix works across the tested scenarios: new callers get a slot, the oldest hidden tab is reclaimed, the tab count stays at 32, and shown tabs keep their unsaved notes through PiP, renderer reload, main-window close/reactivation, and on Linux. Three visibility-replay tests pass. The patch is deliberately narrow and does not touch broader thread-lifecycle behavior.
Worth knowing
The macOS runs used unsigned packaged apps with isolated profiles, synthetic MCP caller scopes, and a fixture-only active-turn bypass; capacity, ownership, visibility, and reclamation logic were unchanged. Renderer reload and main-window close destroy guest DOM state, so notes proven protected afterward were entered after those operations. Not tested: signed/notarized release installation, updater behavior, real provider credential lifecycle, and same-backend bootstrap-FD reconnect. The head exposes one main window. Some phases relied on a labelled server-only clock offset rather than real elapsed time.
Wiring
Work happens in the t3code server tab-capacity code path. The fix hooks into the explicit agent-open request handler: before refusing a new tab at the 32-tab browser budget, it checks for the longest-idle hidden agent tab older than 30 minutes and reclaims it, skipping viewed tabs, human-owned tabs, and the requesting agent's own limit. It depends on a visibility signal taken from PR #23589 (not a prerequisite branch merge; the signal is included here). Verification used a packaged Electron main build on macOS 27.0.1 arm64 and Linux Electron, with isolated profiles, synthetic MCP caller scopes, and a fixture-only active-turn bypass. Test phases used a labelled server-only +31-minute clock offset for baseline and some head runs, plus real 31-minute idle waits at offset 0. Three visibility-replay tests were added and pass.
Try it yourself
In this repo, fix the server bug where idle agent tabs fill the 32-tab browser limit and block new tabs until restart. Make explicit agent opens reclaim the longest-idle hidden agent tab after 30 minutes, while protecting viewed tabs, human-owned tabs, and the requesting agent's own limit. Keep the change focused: reuse only the visibility signal needed, add no broader thread-lifecycle cleanup or new workflow. Add tests that replay the visibility logic, and verify with a packaged build that at 32 tabs a new caller opens tab 33, the oldest hidden tab closes, the count stays 32, and a shown tab keeps its unsaved note.