@devries-cameron20 / t3code-1 / commits / e6119fdf68
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): browser settings changed in project scope no longer overwrite the global default (#35143)

Julius Marminge committed Nov 12, 2026 at 02:59 UTC e6119fdf68199532442ce94b611b880c2fa87c02
6 files changed +58 -17
apps/web/src/components/settings/IntegrationsSettings.tsx
+11 -9
@@ -322,7 +322,7 @@ const rotateViewport = (
322
323 function BrowserViewportSetting({ disabled }: { readonly disabled: boolean }) {
324 const viewport = useClientSettings((settings) => settings.browserDefaultViewport);
325 - const updateSettings = useUpdatePrimarySettings();
325 + const updateSettings = useUpdateScopedSettings();
326
327 const sized = viewport._tag === "fill" ? null : viewport;
328 const presentedSize = {
@@ -472,7 +472,7 @@ function BrowserViewportSetting({ disabled }: { readonly disabled: boolean }) {
472
473 function BrowserZoomSetting({ disabled }: { readonly disabled: boolean }) {
474 const zoomFactor = useClientSettings((settings) => settings.browserDefaultZoomFactor);
475 - const updateSettings = useUpdatePrimarySettings();
475 + const updateSettings = useUpdateScopedSettings();
476
477 return (
478 <SettingsRow
@@ -515,7 +515,7 @@ function BrowserZoomSetting({ disabled }: { readonly disabled: boolean }) {
515
516 function BrowserAppearanceSetting({ disabled }: { readonly disabled: boolean }) {
517 const appearance = useClientSettings((settings) => settings.browserDefaultAppearance);
518 - const updateSettings = useUpdatePrimarySettings();
518 + const updateSettings = useUpdateScopedSettings();
519
520 return (
521 <SettingsRow
@@ -562,7 +562,7 @@ function BrowserAppearanceSetting({ disabled }: { readonly disabled: boolean })
562 function BrowserRecordingInputSettings({ disabled }: { readonly disabled: boolean }) {
563 const showKeys = useClientSettings((settings) => settings.browserRecordingShowKeyPresses);
564 const showMouse = useClientSettings((settings) => settings.browserRecordingShowMousePresses);
565 - const updateSettings = useUpdatePrimarySettings();
565 + const updateSettings = useUpdateScopedSettings();
566 return (
567 <>
568 <SettingsRow
@@ -599,7 +599,7 @@ function BrowserRecordingInputSettings({ disabled }: { readonly disabled: boolea
599
600 function BrowserRecordingFrameRateSetting({ disabled }: { readonly disabled: boolean }) {
601 const frameRate = useClientSettings((settings) => settings.browserRecordingFrameRate);
602 - const updateSettings = useUpdatePrimarySettings();
602 + const updateSettings = useUpdateScopedSettings();
603
604 return (
605 <SettingsRow
@@ -653,7 +653,7 @@ const LINK_TARGET_LABELS: Readonly<Record<BrowserLinkTarget, string>> = {
653
654 function BrowserLinkTargetSetting({ disabled }: { readonly disabled: boolean }) {
655 const linkTarget = useClientSettings((settings) => settings.browserLinkTarget);
656 - const updateSettings = useUpdatePrimarySettings();
656 + const updateSettings = useUpdateScopedSettings();
657
658 return (
659 <SettingsRow
@@ -706,7 +706,7 @@ const SEARCH_ENGINE_LABELS: Readonly<Record<BrowserSearchEngine, string>> = {
706 function BrowserSearchEngineSetting() {
707 const engine = useClientSettings((settings) => settings.browserSearchEngine);
708 const customUrl = useClientSettings((settings) => settings.browserCustomSearchUrl);
709 - const updateSettings = useUpdatePrimarySettings();
709 + const updateSettings = useUpdateScopedSettings();
710
711 return (
712 <>
@@ -1075,7 +1075,7 @@ function AgentBrowserAccessSetting() {
1075
1076 function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled: boolean }) {
1077 const autoShow = useClientSettings((settings) => settings.browserAutoShowFloatingPreview);
1078 - const updateSettings = useUpdatePrimarySettings();
1078 + const updateSettings = useUpdateScopedSettings();
1079
1080 return (
1081 <SettingsRow
@@ -1111,7 +1111,9 @@ function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) {
1111 const userProfiles = useClientSettings((settings) => settings.browserProfiles);
1112 const defaultProfileId = useClientSettings((settings) => settings.browserDefaultProfileId);
1113 const settingsHydrated = useClientSettingsHydrated();
1114 + // Profile edits pair with profile data on disk, so they save for this device in every scope.
1115 const updateSettings = useUpdatePrimarySettings();
1116 + const updateDefaultProfile = useUpdateScopedSettings();
1117 const { environments, isReady: environmentsReady } = useEnvironments();
1118 const primaryEnvironment = usePrimaryEnvironment();
1119 // Cookie import runs on this desktop, whose policy the primary environment reports.
@@ -1422,7 +1424,7 @@ function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) {
1424 disabled={!settingsHydrated || isDefault}
1425 onClick={() => {
1426 if (settingsHydrated) {
1425 - updateSettings({ browserDefaultProfileId: profile.id });
1427 + updateDefaultProfile({ browserDefaultProfileId: profile.id });
1428 }
1429 }}
1430 >
apps/web/src/components/settings/SettingsScopeContext.tsx
+5 -1
@@ -85,6 +85,7 @@ function useResolvedSettingsScope(rawSearch: SettingsScopeSearch, singleEnvironm
85 const SettingsScopeContext = createContext<
86 | (ReturnType<typeof useResolvedSettingsScope> & {
87 singleEnvironment: boolean;
88 + deviceOnly: boolean;
89 search: SettingsScopeSearch;
90 selectScope: (next: SettingsScopeSearch) => void;
91 })
@@ -96,14 +97,17 @@ export function SettingsScopeProvider({
97 onChange,
98 children,
99 singleEnvironment = false,
100 + deviceOnly = false,
101 }: {
102 singleEnvironment?: boolean;
103 + /** The page hides the scope picker, so its client settings save for this device. */
104 + deviceOnly?: boolean;
105 search: SettingsScopeSearch;
106 onChange: (next: SettingsScopeSearch) => void;
107 children: ReactNode;
108 }) {
109 const resolved = useResolvedSettingsScope(search, singleEnvironment);
106 - const value = { ...resolved, singleEnvironment, selectScope: onChange };
110 + const value = { ...resolved, singleEnvironment, deviceOnly, selectScope: onChange };
111 return <SettingsScopeContext value={value}>{children}</SettingsScopeContext>;
112 }
113
apps/web/src/components/settings/scopedSettings.test.ts
+25
@@ -467,6 +467,31 @@ describe("scoped settings writes", () => {
467 });
468 });
469
470 + // regression: #35093 client settings saved in project scope overwrote the global default
471 + it("refuses client-only keys at project scope", () => {
472 + for (const scope of [project, checkout]) {
473 + expect(
474 + planScopedSettingsPatch(scope, environments, {
475 + browserDefaultViewport: { _tag: "freeform", width: 1440, height: 900 },
476 + }),
477 + ).toMatchObject({
478 + clientPatch: {},
479 + hasClientWrite: false,
480 + serverWrites: [],
481 + unavailableReason:
482 + "This setting is environment-wide and cannot be overridden by a project.",
483 + });
484 + expect(
485 + planScopedSettingsPatch(
486 + scope,
487 + environments,
488 + { fontSizeInterface: 15 },
489 + { deviceOnly: true },
490 + ),
491 + ).toMatchObject({ clientPatch: { fontSizeInterface: 15 }, unavailableReason: null });
492 + }
493 + });
494 +
495 it("clears overrides per member and removes an emptied entry", () => {
496 const withOverrides = environment("Server", {
497 settings: {
apps/web/src/components/settings/scopedSettings.ts
+14 -5
@@ -221,19 +221,28 @@ export function planScopedSettingsPatch(
221 scope: ResolvedSettingsScope,
222 environments: readonly ScopedSettingsEnvironment[],
223 patch: ScopedSettingsPatch,
224 + options?: { readonly deviceOnly?: boolean },
225 ) {
225 - const clientPatch = Object.fromEntries(
226 - Object.entries(patch).filter(([key]) => CLIENT_KEYS.has(key) && !SERVER_KEYS.has(key)),
227 - ) as ClientSettingsPatch;
226 + const isProjectScope = scope.kind === "project" || scope.kind === "checkout";
227 + const refusesClientKeys = isProjectScope && options?.deviceOnly !== true;
228 + const clientKeys = Object.keys(patch).filter(
229 + (key) => CLIENT_KEYS.has(key) && !SERVER_KEYS.has(key),
230 + );
231 const serverPatch = Object.fromEntries(
232 Object.entries(patch).filter(([key]) => SERVER_KEYS.has(key)),
233 ) as ServerSettingsPatch;
234 const serverKeys = Object.keys(serverPatch);
235 const { connectedEnvironments } = selectScopedSettingsEnvironments(scope, environments, null);
233 - const isProjectScope = scope.kind === "project" || scope.kind === "checkout";
236 + // Client settings are stored per device, so a project has nowhere to keep an override.
237 const unscopableKeys = isProjectScope
235 - ? serverKeys.filter((key) => !isProjectScopedSettingKey(key))
238 + ? [
239 + ...(refusesClientKeys ? clientKeys : []),
240 + ...serverKeys.filter((key) => !isProjectScopedSettingKey(key)),
241 + ]
242 : [];
243 + const clientPatch = Object.fromEntries(
244 + refusesClientKeys ? [] : Object.entries(patch).filter(([key]) => clientKeys.includes(key)),
245 + ) as ClientSettingsPatch;
246 const serverWrites: ScopedServerWrite[] =
247 serverKeys.length === 0
248 ? []
apps/web/src/components/settings/useScopedSettings.ts
+2 -2
@@ -98,11 +98,11 @@ function useRunScopedPlan() {
98 }
99
100 export function useUpdateScopedSettings() {
101 - const { scope, environments } = useSettingsScope();
101 + const { scope, environments, deviceOnly } = useSettingsScope();
102 const run = useRunScopedPlan();
103 /** `onFailed` runs when any target rejects or drops the patch, so a draft can fall back. */
104 return (patch: ScopedSettingsPatch, options?: { readonly onFailed?: () => void }) =>
105 - run(planScopedSettingsPatch(scope, environments, patch), options?.onFailed);
105 + run(planScopedSettingsPatch(scope, environments, patch, { deviceOnly }), options?.onFailed);
106 }
107
108 export function useClearScopedSettings() {
apps/web/src/routes/_chat.settings.tsx
+1
@@ -151,6 +151,7 @@ function SettingsRouteLayout() {
151 <SettingsScopeProvider
152 search={rawSearch}
153 singleEnvironment={pathname === "/settings/providers" || pathname === "/settings/secrets"}
154 + deviceOnly={SETTINGS_DEVICE_ONLY_PATHS.has(pathname)}
155 onChange={(next) => {
156 // Send every axis so retain middleware recognizes "all" as an explicit target.
157 void navigate({