Client overlay wait shares the server's 15s deadline, so PreviewAutomationOverlayTimeoutError never reaches callers #8257
What happened#
Preview automation tools failed in bulk during a UI audit. preview_snapshot, preview_evaluate, and preview_resize all returned errors, while preview_open, preview_navigate, and preview_status kept working. The agent gave up on screenshots entirely and fell back to reading the DOM.
The user-visible errors carried no usable reason: either Preview snapshot failed. or Preview automation evaluate timed out after 15000ms.
Diagnosis#
The underlying trigger — a tab opened with "open": false cannot be captured — is already tracked in #3713. This issue is about a separate, self-contained defect that makes that trigger, and any other overlay-readiness failure, permanently undiagnosable from the client.
waitForDesktopOverlay (apps/web/src/components/preview/PreviewAutomationHosts.tsx:87) is called from requireReadyTab with request.timeoutMs:
const waitForDesktopOverlay = async (..., timeoutMs: number): Promise<void> => {
const deadline = Date.now() + timeoutMs;
while (Date.now() <= deadline) {
const state = assertPreviewRuntimeCurrent(threadRef, tabId, runtimeTabId, { operation, requestId });
if (state.desktopByTabId[tabId] && previewBridge) {
const status = await previewBridge.automation.status(runtimeTabId);
if (status.available) return;
}
await new Promise((resolve) => window.setTimeout(resolve, 50));
}
throw new PreviewAutomationOverlayTimeoutError({ requestId, environmentId, threadId, timeoutMs });
};
request.timeoutMs is the value the broker put on the wire, and it is the same value the broker uses for its own deadline (apps/server/src/mcp/PreviewAutomationBroker.ts:429):
const timeoutMs = input.timeoutMs ?? 15_000;
...
const result = yield* Deferred.await(deferred).pipe(Effect.timeoutOption(timeoutMs));
return yield* Option.match(result, {
onNone: () => Effect.fail(new PreviewAutomationTimeoutError(requestContext)),
...
Both sides therefore expire at the same instant. When the overlay never becomes available, the sequence is:
T+0— broker sends the request, starts a 15,000 ms timer.T+0— client enterswaitForDesktopOverlaywith a 15,000 ms deadline.T+15000— broker'stimeoutOptionfires, the pending deferred is dropped, caller getsPreviewAutomationTimeoutError.T+15000— client's loop exits and throwsPreviewAutomationOverlayTimeoutError, then callsrespond(...). Nothing is listening.
PreviewAutomationOverlayTimeoutError is unreachable by construction. It cannot arrive before the deadline it shares, so no caller can ever observe it. The class, its serializer, and its message text are dead code on this path.
The practical cost is that "the preview overlay never became available" — precise and actionable — is always reported as a generic 15-second timeout, indistinguishable from a hung renderer or a slow page. In the session below the agent retried the same doomed call four times in a row because nothing in the error told it the tab was hidden.
Two supporting observations, both contributing to the same opacity:
previewSnapshotFailure(apps/server/src/mcp/McpHttpServer.ts:99-126) computeserrorTag, logs it viaEffect.logWarning, puts it instructuredContent, and then setscontentto the fixed string"Preview snapshot failed.". Clients that surfacecontentshow no reason at all.- These calls exit as
Successspans inserver.trace.ndjson, since the handler returns anisErrorresult rather than failing the effect. Searching traces for failed spans will not find them.
A client deadline set to a clear fraction of the request budget — or a readiness failure reported as soon as it is known, rather than after a full spin — would make the real cause visible without changing the trigger behaviour at all.
Steps to reproduce#
Start T3 Code Desktop and serve any local page on
localhost:3000.Open a tab hidden, so the overlay is never presented:
{ "url": "http://localhost:3000/", "open": false, "reuseExistingTab": false }Call
preview_evaluatewith any trivial expression, for example({ ready: document.readyState }).Observe: the call fails after almost exactly 15,000 ms with
Preview automation evaluate timed out after 15000ms.In the desktop trace for that timestamp, observe a single
desktop.ipc.preview.automationStatusentry and nodesktop.ipc.preview.automationEvaluate— the operation was never dispatched.Observe that
PreviewAutomationOverlayTimeoutErrorappears nowhere in the response, despite being the actual failure.
Setting "open": true avoids the trigger and the call succeeds.
Version#
0.0.34 (CLI/server); desktop app 0.0.35-nightly.20260826.1193
Environment#
macOS darwin arm64 25.6.0, Node v24.18.1, Claude provider, npx t3 launch
Evidence#
# Server spans: exactly 15s, and recorded as Success
05:31:42.033 preview_evaluate 15001.9ms Success
05:32:51.854 preview_evaluate 15001.4ms Success
05:33:08.776 preview_evaluate 15001.2ms Success
05:33:26.158 preview_evaluate 15001.2ms Success
05:33:42.750 preview_evaluate 15002.1ms Success
# Corresponding desktop IPC: status probe only, operation never dispatched
05:32:51.869 desktop.ipc.preview.automationStatus 0.1ms Success
05:33:08.791 desktop.ipc.preview.automationStatus 0.1ms Success
05:33:26.177 desktop.ipc.preview.automationStatus 0.1ms Success
05:33:42.770 desktop.ipc.preview.automationStatus 0.1ms Success
# What the caller received
{"content":"Preview automation evaluate timed out after 15000ms.","is_error":true}
# Snapshot path, real reason logged but not sent
McpServer.@effect/mcp/2025-06-18/tools/call | preview_snapshot | 15004.0ms | Success
event: ["preview snapshot failed",
{"operation":"snapshot","errorTag":"PreviewAutomationTimeoutError","failureCount":1}]
{"content":"Preview snapshot failed.","is_error":true}
Related issues#
#3713 tracks the open: false capture trigger and the resulting tab poisoning. This issue is filed separately because the deadline collision in waitForDesktopOverlay is an independent defect with an independent fix: it would hide the cause of any overlay-readiness failure, not only the hidden-tab one, and correcting it does not require solving the capture problem. Evidence for the trigger itself has been added to #3713 rather than duplicated here.
Fix applied or workaround#
No writes were made to the machine. The user was advised to pass "open": true on preview_open, which was confirmed against their own session logs: every open: false tab failed to snapshot, both open: true calls succeeded.
Filed by#
claude (opus-5) via t3 triage
Fixed by merged #4685 — host wait budget now reserves response time before the broker deadline so overlay-unavailable errors can reach callers instead of racing the broker timeout.
juliusmarminge closed this
Sign in to join this conversation.
This diagnosis matches what the client sees, and I have a case that shows the cost of the dead error path from the other direction.
Your point is that
PreviewAutomationOverlayTimeoutErrorcan never reach a caller, so an overlay that never becomes available is always reported as a generic 15 second timeout. The corollary is that a caller cannot tell that case apart from any other cause of the same timeout, and there appears to be at least one other cause.On
0.0.33on Linux,preview_resizetimed out on a tab the server itself described as available and visible:Resize has never once succeeded on this machine, across ten recorded calls since 2026-08-14 and five more today, in all three modes. Details on #3712.
I cannot prove from the client which side that particular failure came from, and that is exactly your point. The message is identical either way, so "the overlay never became available" and "the resize path hung with the overlay available" are indistinguishable to me.
That is worth adding to the argument for your fix. Unshare the deadlines and the overlay case names itself, which leaves whatever remains to be investigated as a real second bug rather than folded into the first.
Related: I filed #8037 asking for cheaper and richer preview diagnostics for the same underlying reason. An agent retrying a doomed call four times, as in your session, is the normal outcome when the error carries no reason.