Note
Grok responding on behalf of Julius.
Thanks for the precise call sequence. I checked this against current main (d720210). In short, preview_open never waits for a client to actually show the tab, and visible only counts streamed viewers. Details below.
What's confirmed on main
- Since #15328 (Oct 6),
preview_openis served by the environment's own browser, which registers as the preferred automation host (ServerBrowser.ts L2150-L2158). Withopen/showset, it publishes a reveal request and then returns status right away (L1536-L1551).requestRevealonly updates the session snapshot and emits an event, and nothing comes back (Manager.ts L468-L497). The app opens the panel later, when it sees that event, and only for the active thread (ChatView.tsx L5513-L5543). - In both
preview_openandpreview_status,visibleis justtab.viewers.size > 0(L1117). It means "some client has a frame stream open for this tab." The streamed surface only connects while it's shown (ServerBrowserSurface.tsx L367), so a status read immediately after the reveal request will usually sayfalse. A laterpreview_statussaystrueonce the panel has connected. That matches what you saw. - In the desktop app talking to its own local server, server tabs render natively in a
<webview>and are not streamed (previewRuntime.ts L26-L42, PreviewView.tsx L167-L170). There, no viewer is ever added, sovisiblestaysfalseeven while the tab is on screen, unless another client is also streaming it. The server's own pointer code already assumes "a desktop-rendered tab is always on screen" (L1366-L1368), but status doesn't take that into account. The desktop channel only reportsattached/detached/cdp, with no shown/hidden signal (desktopBrowser.ts L21-L28). - The docs gap is real.
preview_statuslists "visibility" without defining it (tools.ts L65-L67), and the schema field has no description (previewAutomation.ts L77). Also, theopenparameter says it "Defaults to true," but the handler deliberately leaves it unset so the user's auto-show preference decides (handlers.ts L36-L53).
Relation to #3718
#3718 was closed after #9484 merged. That fix lived in the old client-side automation host (PreviewAutomationHosts.tsx). That host also waited up to 500 ms for the surface to report visible before returning, and returned false without any error if it timed out. #15328 deleted that file, so neither the fix nor the settle wait applies to the server-hosted path.
Which path you hit (unconfirmed)
The response you pasted has no control, dialog, fileChooser or tabs fields, which main's server status always includes (L1115-L1155). Its freeform 1280×800 viewport also matches the old client host's default for agent tabs. So your build may predate #15328, in which case the likely cause is that 500 ms settle timing out. Could you share the T3 Code version, and say whether this was the desktop app or a browser? Either way, current main still shows the mismatch for the reasons above.
Possible fixes (not yet tried)
- After a reveal request, have
preview_openwait a short, bounded time for the tab to actually be shown (as the old host did) before reporting status. - Give desktop-rendered tabs a real visibility signal, for example a shown/hidden event on the desktop browser channel, so
visibleisn't tied to streaming. - Report "reveal requested" separately from confirmed
visible, and documentvisibleas "a T3 client is currently displaying this tab."
Workaround
Don't treat visible: false right after preview_open as proof the user can't see the tab. Re-check with preview_status after a moment. In the desktop app with a local environment, visible isn't reliable at all right now. To check whether the tab is usable for automation, look at available, url and title, not visible.
Related
- #15328: introduced the server-hosted path.
- #9484 / #3718: the earlier fix.
- Open PR #16956 touches this same code and keeps the
viewers.size > 0meaning. Open PRs #16835 and #16963 also modifyServerBrowser.ts. None of them changes howvisibleis computed. - #6355, #7212 and #16901 are in the same area, with different symptoms.