Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): use the visible browser for new agent sessions #13064

MergedBil0000(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/13064/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 138 additions and 1 deletion (loading 3).

x
0 of 5 viewed, 5 left
126 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -685,6 +685,7 @@
environmentId: scope.environmentId,
connectionId: "connection-stale",
focused: true,
+ liveTabs: [{ threadId: scope.threadId, tabId: PreviewTabId.make("stale-tab") }],
});
expect(yield* broker.invoke<string>({ scope, operation: "status", input: {} })).toBe(
"second",
@@ -725,6 +726,130 @@
​
+it.effect("prefers the live tab owner for new sessions without moving existing leases", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const connections = new Map<string, string>();
+ for (const clientId of ["owner", "other"]) {
+ const requests = requestsFrom(
+ yield* broker.connect(makeHost({ clientId })),
+ (connectionId) => connections.set(clientId, connectionId),
+ );
+ yield* Stream.runForEach(requests, (request) =>
+ broker.respond({
+ clientId,
+ connectionId: request.connectionId,
+ requestId: request.requestId,
+ ok: true,
+ result: clientId,