Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/server/src/preview/ServerBrowser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,26 @@ it.effect("a tab the desktop does not draw is marked headless, so the desktop st
).pipe(Effect.provide(layer)),
);

it.effect("a server started without the desktop browser channel marks its tabs headless", () =>
Effect.scoped(
Effect.gen(function* () {
const { tabId } = yield* ready;
const manager = yield* Manager.PreviewManager;
const { sessions } = yield* manager.list({ threadId: scope.thread.threadId });

expect(sessions.find((session) => session.tabId === tabId)?.headless).toBe(true);
}),
).pipe(
// A WSL-only desktop starts its backend without the browser fds.
Effect.provide(
ServerBrowser.layer.pipe(
Layer.provide(DesktopChannel.layer),
Layer.provideMerge(dependencies),
),
),
),
);

it.effect("an agent's tab the reloaded desktop dropped goes back to the desktop", () =>
Effect.scoped(
Effect.gen(function* () {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/preview/ServerBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,8 @@ const make = Effect.gen(function* () {
if (desktop) opened.push(desktop.close);
// Attaching over CDP emulates a light scheme; a tab on System follows the desktop's.
if (desktop) await desktop.page.emulateMedia({ colorScheme: null });
// Otherwise a desktop that attaches late shows its own page, and the agent drives another.
if (!desktop && desktopChannel.available) {
// Otherwise a desktop that attaches late, or has no channel to draw it, shows its own page.
if (!desktop) {
await runPromise(
manager
.markHeadless({ threadId: ThreadId.make(snapshot.threadId), tabId: snapshot.tabId })
Expand Down
Loading