Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a stalled preview capture no longer times out snapshots and drops the agent's tab #24523

ClosedMikiyas-Meles-Assefa(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/24523/headopened View on GitHub

Showing 7 changed files with 156 additions and 5 deletions (loading 4).

x
0 of 7 viewed, 7 left
55 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -1073,6 +1073,61 @@
+it.effect.each([
+ { reconnectAfter: "4 seconds", carried: true },
+ { reconnectAfter: "6 seconds", carried: false },
+] as const)(
+ "keeps the current tab when a timed-out host re-registers within the grace period (%o)",
+ ({ reconnectAfter, carried }) =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const openedTabId = PreviewTabId.make("tab-before-timeout");
+ const firstRequests = requestsFrom(yield* broker.connect(makeHost()));
+ yield* Stream.runForEach(firstRequests, (request) =>
+ // The host stalls on the snapshot, as when a capture never gets a frame.
+ request.operation === "snapshot"
+ ? Effect.void
+ : broker.respond({
+ clientId: "client-1",
+ connectionId: request.connectionId,
+ requestId: request.requestId,
+ ok: true,
+ result: { tabId: openedTabId },
+ }),
+ ).pipe(Effect.forkScoped);
+ yield* Effect.yieldNow;
+​
+ yield* broker.invoke({ scope, operation: "open", input: {} });