Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): agents see visible:true while the desktop shows their tab #23589

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/23589/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 44 additions and 4 deletions.

x
0 of 2 viewed, 2 left
41 additions and 0 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -1961,6 +1961,47 @@
).pipe(Effect.provide(layer)),
+it.live("the tab the desktop shows is visible and picked for agents without a tab", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* Broker.PreviewAutomationBroker;
+ const manager = yield* Manager.PreviewManager;
+ yield* ServerBrowser.ServerBrowser;
+ yield* Effect.yieldNow;
+ const openDesktopTab = Effect.fn("openDesktopTab")(function* (url: string) {
+ desktopRendersNext = true;
+ const opened = yield* manager.open({
+ threadId: scope.thread.threadId,
+ url,
+ runtime: "server",
+ });
+ const tabId = PreviewTabId.make(opened.tabId);
+ yield* broker.invoke({ scope, tabId, operation: "status", input: {} });
+ return tabId;
+ });
+ const recentTab = yield* openDesktopTab("http://localhost:5173/recent");
+ const shownTab = yield* openDesktopTab("http://localhost:5173/shown");
+ // Opened first and used last, so recency or insertion order alone picks it.
+ yield* broker.invoke({ scope, tabId: recentTab, operation: "status", input: {} });
+​
+ shownDesktopTabs.add(shownTab);
+ const status = yield* broker.invoke<PreviewAutomationStatus>({
+ scope: asSession("agent-b"),