Skip to content

Commit 0b89465

Browse files
fix(web): agent browser access shares the Browser settings section
Settings > Integrations showed two sections titled Browser. Move the agent browser access row back into the Browser section, above the desktop-only preview defaults, like the Devices section does for agent device access. Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent ed0f7b9 commit 0b89465

4 files changed

Lines changed: 52 additions & 56 deletions

File tree

‎apps/web/src/components/settings/IntegrationsSettings.test.tsx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ vi.mock("./settingsLayout", async (importOriginal) => ({
5151
...(await importOriginal<typeof import("./settingsLayout")>()),
5252
SettingsPageContainer: ({ children }: { children: ReactNode }) => children,
5353
}));
54-
// The scoped agent-access rows need the settings layout's scope provider;
55-
// this test covers the device-local browser sections only.
56-
vi.mock("./ProjectDefaultsSettings", () => ({ ProjectDefaultsSettings: () => null }));
5754
vi.mock("./SettingsScopeContext", () => ({
5855
useSettingsScope: () => ({
5956
scope: { kind: "all", environmentIds: [] },

‎apps/web/src/components/settings/IntegrationsSettings.tsx‎

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
DEFAULT_BROWSER_VIEWPORT,
2828
DEFAULT_PREVIEW_APPEARANCE,
2929
DEFAULT_PREVIEW_ZOOM_FACTOR,
30+
DEFAULT_SERVER_SETTINGS,
3031
FILL_PREVIEW_VIEWPORT,
3132
PREVIEW_VIEWPORT_MAX_AREA,
3233
PREVIEW_VIEWPORT_MAX_DIMENSION,
@@ -117,7 +118,6 @@ import {
117118
SettingsSection,
118119
} from "./settingsLayout";
119120
import { searchableSetting } from "./settingsSearch";
120-
import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
121121
import { useSettingsScope } from "./SettingsScopeContext";
122122
import { BrowserImportWizard, type WizardTarget } from "./BrowserImportWizard";
123123
import type { ImportOutcome } from "./browserImportWizard.logic";
@@ -890,6 +890,50 @@ function DeviceIntegrationControls({
890890
);
891891
}
892892

893+
/**
894+
* Server-authoritative, so it follows the header's environment and project
895+
* selection and stays editable on clients without the desktop-only preview.
896+
*/
897+
function AgentBrowserAccessSetting() {
898+
const { scope } = useSettingsScope();
899+
const settings = useScopedSettings();
900+
const updateSettings = useUpdateScopedSettings();
901+
const isProjectScope = scope.kind === "project" || scope.kind === "checkout";
902+
903+
return (
904+
<SettingsRow
905+
serverScoped
906+
settingKeys={["enableAgentBrowserAccess"]}
907+
{...searchableSetting("agent-browser-access")}
908+
description={
909+
isProjectScope
910+
? "Allow agents in this project to use the shared browser. Applies when the agent session next starts."
911+
: "Allow agents to use the shared browser. Projects can override it."
912+
}
913+
resetAction={
914+
settings.enableAgentBrowserAccess !== DEFAULT_SERVER_SETTINGS.enableAgentBrowserAccess ? (
915+
<SettingResetButton
916+
label="default browser access"
917+
onClick={() =>
918+
updateSettings({
919+
enableAgentBrowserAccess: DEFAULT_SERVER_SETTINGS.enableAgentBrowserAccess,
920+
})
921+
}
922+
/>
923+
) : null
924+
}
925+
control={
926+
<ScopedSwitch
927+
settingKeys={["enableAgentBrowserAccess"]}
928+
aria-label="Agent browser access"
929+
checked={settings.enableAgentBrowserAccess}
930+
onCheckedChange={(enabled) => updateSettings({ enableAgentBrowserAccess: enabled })}
931+
/>
932+
}
933+
/>
934+
);
935+
}
936+
893937
function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled: boolean }) {
894938
const autoShow = useClientSettings((settings) => settings.browserAutoShowFloatingPreview);
895939
const updateSettings = useUpdatePrimarySettings();
@@ -1534,10 +1578,10 @@ export function IntegrationsSettingsPanel() {
15341578

15351579
return (
15361580
<SettingsPageContainer>
1537-
{/* Server-authoritative agent access is scoped by the header selection;
1538-
the preview defaults below are device-local and ignore it. */}
1539-
<ProjectDefaultsSettings category="integrations" />
15401581
<SettingsSection id="browser" title="Browser">
1582+
{/* Scoped by the header selection; the preview defaults below are
1583+
device-local and ignore it. */}
1584+
<AgentBrowserAccessSetting />
15411585
{previewDefaultsDisabled ? (
15421586
<SettingsUnavailableGroup message="Only available in the desktop app.">
15431587
{previewDefaults}

‎apps/web/src/components/settings/ProjectDefaultsSettings.tsx‎

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
7878
const PermissionIcon = runtimeModeConfig[settings.defaultRuntimeMode].icon;
7979
const mixedWorkspace = useScopedSettingsMixed(["defaultThreadEnvMode"]);
8080
const mixedSubmodules = useScopedSettingsMixed(["worktreeSubmodules"]);
81-
const mixedBrowser = useScopedSettingsMixed(["enableAgentBrowserAccess"]);
8281
const mixedAutoPull = useScopedSettingsMixed(["defaultAutoPull"]);
8382
const mixedAgentCredits = useScopedSettingsMixed(["removeAgentCreditsOnMerge"]);
8483
const mixedMergeMethod = useScopedSettingsMixed(["pullRequestMergeMethod"]);
@@ -255,17 +254,9 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
255254
id={
256255
category === "general" || category === "project"
257256
? "project-defaults"
258-
: category === "integrations"
259-
? "browser-access"
260-
: "source-control-defaults"
261-
}
262-
title={
263-
category === "general" || category === "project"
264-
? "New threads"
265-
: category === "integrations"
266-
? "Browser"
267-
: "Repositories"
257+
: "source-control-defaults"
268258
}
259+
title={category === "general" || category === "project" ? "New threads" : "Repositories"}
269260
>
270261
{category === "project" ? (
271262
<>
@@ -384,7 +375,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
384375
}
385376
/>
386377
</>
387-
) : category === "source-control" ? (
378+
) : (
388379
<>
389380
<SettingsRow
390381
serverScoped
@@ -490,42 +481,6 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
490481
}
491482
/>
492483
</>
493-
) : (
494-
<>
495-
<SettingsRow
496-
serverScoped
497-
settingKeys={["enableAgentBrowserAccess"]}
498-
mixed={mixedBrowser}
499-
id={searchableSetting("agent-browser-access").id}
500-
title="Agent browser access"
501-
description={
502-
isProjectScope
503-
? "Allow agents in this project to use the shared browser. Applies when the agent session next starts."
504-
: "Allow agents to use the shared browser. Projects can override it."
505-
}
506-
resetAction={
507-
settings.enableAgentBrowserAccess !==
508-
DEFAULT_SERVER_SETTINGS.enableAgentBrowserAccess ? (
509-
<SettingResetButton
510-
label="default browser access"
511-
onClick={() =>
512-
updateSettings({
513-
enableAgentBrowserAccess: DEFAULT_SERVER_SETTINGS.enableAgentBrowserAccess,
514-
})
515-
}
516-
/>
517-
) : null
518-
}
519-
control={
520-
<Switch
521-
aria-label="Agent browser access"
522-
mixed={mixedBrowser}
523-
checked={mixedBrowser ? false : settings.enableAgentBrowserAccess}
524-
onCheckedChange={(enabled) => updateSettings({ enableAgentBrowserAccess: enabled })}
525-
/>
526-
}
527-
/>
528-
</>
529484
)}
530485
</SettingsSection>
531486
);

‎apps/web/src/components/settings/ProjectSettingsPanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function memberKey(member: { environmentId: string; id: string }): string {
5858
}
5959

6060
/** `project` is the Projects page shortcut: the new-thread defaults people change most. */
61-
export type ProjectSettingsCategory = "general" | "integrations" | "source-control" | "project";
61+
export type ProjectSettingsCategory = "general" | "source-control" | "project";
6262

6363
export function ProjectSettingsPanel({
6464
projectKey,

0 commit comments

Comments
 (0)