Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep preview hosts that report a waitFor miss at the deadline #12899

ClosedmInrOz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12899/headopened View on GitHub

Showing 4 changed files with 143 additions and 2 deletions (loading 1).

x
0 of 4 viewed, 4 left
13 additions and 2 deletionsapps/server/src/mcp/toolkits/preview/handlers.tsModified
View file
@@ -50,11 +50,19 @@
};
​
+/**
+ * Desktop `waitFor` polls for the caller's full `timeoutMs` and only then
+ * reports the miss, so its reply lands after the broker deadline when both
+ * clocks match. The grace lets that reply arrive before the host is evicted.
+ */
+const PREVIEW_WAIT_FOR_REPLY_GRACE_MS = 1_500;
+​
const invoke = Effect.fn("PreviewToolkit.invoke")(function* <A>(
operation: PreviewAutomationOperation,
input: unknown,
timeoutMs?: number,
tabId?: PreviewTabId,
+ replyGraceMs?: number,
): Effect.fn.Return<
{ result: A; toolIcon?: ToolActivityIcon },
import("@t3tools/contracts").PreviewAutomationError,
@@ -72,6 +80,7 @@
input,
...(timeoutMs === undefined ? {} : { timeoutMs }),
...(tabId === undefined ? {} : { tabId }),
+ ...(replyGraceMs === undefined ? {} : { replyGraceMs }),
});
if (["status", "open", "navigate", "snapshot"].includes(operation)) return { result };
const statusTabId =