Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): keep browser sessions available after action timeouts #17871

ClosedTDanks2000(GitHub profile, opens in a new tab)wants to merge 17 commits intomain fromrefs/pull/17871/headopened View on GitHub

Showing 4 changed files with 86 additions and 1 deletion (loading 2).

x
0 of 4 viewed, 4 left
81 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -1540,3 +1540,84 @@
+​
+it.effect.each([
+ { clientId: SERVER_BROWSER_AUTOMATION_CLIENT_ID, retained: true },
+ { clientId: "remote-preferred", retained: false },
+])(
+ "an unanswered action preserves other threads only on the in-process host ($clientId)",
+ ({ clientId, retained }) =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const otherScope = {
+ ...scope,
+ thread: {
+ ...scope.thread,
+ threadId: ThreadId.make("thread-2"),
+ providerSessionId: "provider-session-2",
+ },
+ };
+ const connected = yield* Deferred.make<void>();
+ const slowReceived = yield* Deferred.make<void>();
+ const otherReceived = yield* Deferred.make<RoutedRequest>();
+ const requests = requestsFrom(
+ yield* broker.connect(makeHost({ clientId }), { preferred: true }),
+ () => Deferred.doneUnsafe(connected, Effect.void),
+ );
+ yield* Stream.runForEach(requests, (request) => {