Skip to content
Source
Sign inSign up
pingdotgg/t3code

Preview automation host connection is torn down by an evaluate timeout and never reconnects #13513

Closedrexkirshner(GitHub profile, opens in a new tab) opened this issue 2 comments

Environment: T3 Code (Alpha) 0.0.42, macOS 26.5.1, Apple M5 Max. Local environment 3e58c8ff-0558-4f50-8b5d-7d436d0906fd.

Summary

One preview_evaluate call that hits the server's 15-second timeout also kills the long-lived previewAutomation.connect stream between the desktop app and the server. The stream never comes back. From then on, every agent preview tool fails with "No preview automation host is available", including preview_status and preview_open, and including new tabs. The visible preview panel keeps working for the user, so the agent's tools are broken while everything looks normal.

Steps to reproduce

  1. Have an agent open a page in the preview that keeps the renderer busy. Ours was a WebGL scene running at about 1.3 fps.
  2. Have the agent call preview_evaluate with a script that runs longer than 15 seconds. Ours measured the frame rate repeatedly with requestAnimationFrame over about 1.5 s each, and several runs added up to more than 15 s.
  3. The call fails with Preview automation evaluate timed out after 15000ms.
  4. Call any preview tool afterwards.

Expected: The one evaluate fails and later calls work. At worst the automation connection re-establishes itself.

Actual: Every later call fails with No preview automation host is available for <op> in environment 3e58c8ff-…. Closing all tabs doesn't fix it, and neither does letting the agent open a new one. The user sees a working preview panel the whole time.

Evidence

From ~/.t3/userdata/logs, 2026-09-24, times in PDT:

  • 15:30:28.56: PreviewAutomationBroker.awaitResponse starts (span 9dc02ace45fbc741, trace d6e0d0596242af8e21a804c877bc5131).
  • 15:30:43.56: that span fails after 15001 ms with PreviewAutomationTimeoutError: Preview automation evaluate timed out after 15000ms (server bin.mjs:164689).
  • Same millisecond: ws.rpc.previewAutomation.connect (span c8709b146316e7c2) exits Interrupted ("All fibers interrupted without error"). That stream had been open for about 19.3 hours.
  • Same millisecond: PreviewAutomationBroker.disconnect and closeConnection run twice (traces a1600ede9acd6b06e8d6d323c979e76b and d6e0d0596242af8e21a804c877bc5131).
  • 15:30:45.08 (desktop): the underlying evaluate.Runtime.evaluate on WebContents 2 fails (main.cjs:79854). About 0.1 s later the desktop re-registers the webview and creates a new control session. So the desktop side recovers, but it never re-opens previewAutomation.connect to the server.
  • After 15:30:43: there is no previewAutomation.connect span in any server trace. previewAutomation.focusHost RPCs keep succeeding, so the panel's UI channel is still alive.
  • Since then: 27+ more timeout or "no host" failures, each one a retry by the agent.

Suggested fixes

  1. Fail only the command that timed out. Don't interrupt the host connection because one evaluate timed out.
  2. If the host connection does drop, have the desktop reconnect automatically, for example when a webview re-registers.
  3. When there's no automation host, show it in the preview panel so the user knows the agent has lost access.
  4. Consider letting callers set their own evaluate timeout, or cancelling the page-side script when the timeout fires.

Workaround: reload or restart the T3 Code window (not yet confirmed).

  1. Closing as a duplicate of #12146.

    Same failure mode: a preview tool request that hits the broker deadline (here preview_evaluate after 15s) interrupts previewAutomation.connect, and the desktop never re-opens the host stream, so later calls stay on No preview automation host is available while the visible panel still works.

    That host-lifetime bug was fixed in #12535 (fix(preview): recover host registration after request timeouts, merged 2026-09-19). Alpha 0.0.42 predates that fix, so this report matches the pre-fix behavior on #12146 rather than a new root cause.

    If you still see eviction after upgrading to a nightly that includes #12535, see the residual tracks: #12898 (preview_wait_for), #12273 (optional metadata timeout), #12319 (preview_resize / zoom).

  2. juliusmarminge added labelsduplicate

  3. juliusmarminge closed this

  4. Ah apologies. Thank you for the quick response.

Sign in to join this conversation.