Skip to content

Commit 9fe3787

Browse files
fix(web): an agent's docked browser no longer blocks proactive panels
Opening the agent's browser as a panel tab counted as a user action, so the completed-turn diff and newly linked pull requests stopped opening on their own. It now opens as an automatic update, as agent devices already do.
1 parent 9822c83 commit 9fe3787

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/web/src/components/preview/useAgentOpenedPreviews.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function useAgentOpenedPreviews(input: {
130130
.getState()
131131
.open(threadRef, browserMiniPlayerSource(session.tabId));
132132
} else if (!sheetLayout) {
133-
useRightPanelStore.getState().openBrowser(threadRef, session.tabId);
133+
useRightPanelStore.getState().openBrowser(threadRef, session.tabId, true);
134134
}
135135
}
136136
}, [

‎apps/web/src/rightPanelStore.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ describe("rightPanelStore", () => {
301301
});
302302
});
303303

304+
it("still opens proactive panels after an agent's browser opens automatically", () => {
305+
const store = useRightPanelStore.getState();
306+
const revision = store.getUserActionRevision(refA);
307+
store.openBrowser(refA, "agent-browser", true);
308+
309+
expect(store.openProactive(refA, completedDiff, revision)).toBe(true);
310+
expect(store.openProactive(refA, linkedPullRequest, revision)).toBe(true);
311+
});
312+
304313
it.each([
305314
{
306315
surface: linkedPullRequest,

‎apps/web/src/rightPanelStore.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ interface RightPanelStoreState {
133133
) => void;
134134
openDevice: (ref: ScopedThreadRef, target: DeviceTabTarget, automatic?: boolean) => void;
135135
renameDevice: (ref: ScopedThreadRef, surfaceId: string, title: string) => void;
136-
openBrowser: (ref: ScopedThreadRef, tabId: string | null) => void;
136+
openBrowser: (ref: ScopedThreadRef, tabId: string | null, automatic?: boolean) => void;
137137
openFile: (ref: ScopedThreadRef, relativePath: string, line?: number) => void;
138138
/**
139139
* Moves the folder browser in `surfaceId` to `relativePath` in place, so walking
@@ -696,9 +696,9 @@ export const useRightPanelStore = create<RightPanelStoreState>()(
696696
),
697697
})),
698698
),
699-
openBrowser: (ref, tabId) =>
699+
openBrowser: (ref, tabId, automatic = false) =>
700700
set((state) =>
701-
userAction(state, scopedThreadKey(ref), (current) => {
701+
(automatic ? automaticUpdate : userAction)(state, scopedThreadKey(ref), (current) => {
702702
const surface = browserSurface(tabId);
703703
const withoutPlaceholder = tabId
704704
? current.surfaces.filter((entry) => entry.id !== "browser:new")

0 commit comments

Comments
 (0)