Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a timed-out preview request no longer evicts the shared server browser #34970

Closedjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/34970/headopened View on GitHub

Showing 2 changed files with 67 additions and 1 deletion.

x
0 of 2 viewed, 2 left
62 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -20,6 +20,7 @@
import * as Fiber from "effect/Fiber";
import * as Result from "effect/Result";
import * as Stream from "effect/Stream";
+import * as TestClock from "effect/testing/TestClock";
​
import { PreviewBrowserRootError } from "../preview/PreviewBrowserHost.ts";
import * as PreviewAutomationBroker from "./PreviewAutomationBroker.ts";
@@ -358,6 +359,67 @@
}),
​
+it.effect("keeps the server browser host for other threads when one request times out", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const clientId = SERVER_BROWSER_AUTOMATION_CLIENT_ID;
+ const otherScope = {
+ ...scope,
+ requestNamespace: "provider-session-2",
+ thread: {
+ threadId: ThreadId.make("thread-2"),
+ providerSessionId: "provider-session-2",
+ providerInstanceId: ProviderInstanceId.make("codex"),
+ },
+ };
+ const openDelivered = yield* Deferred.make<RoutedRequest>();
+ const requests = requestsFrom(
+ yield* broker.connect(makeHost({ clientId }), { preferred: true }),