[codex] Make settings environment-scoped by default - #3216
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Primary settings used for model selection
- Replaced
settingswithcomposerSettingsinonProviderModelSelectso the model resolution uses the same environment-aware settings that the model picker displays, eliminating the mismatch that could cause selections to silently fail.
- Replaced
Or push these changes by commenting:
@cursor push 41b3ef6c25
Preview (41b3ef6c25)
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -4449,7 +4449,7 @@
}
const resolvedModel = resolveAppModelSelectionForInstance(
instanceId,
- settings,
+ composerSettings,
providerStatuses,
model,
);
@@ -4491,7 +4491,7 @@
setComposerDraftModelSelection,
setStickyComposerModelSelection,
providerStatuses,
- settings,
+ composerSettings,
],
);
const onEnvModeChange = useCallback(You can send follow-ups to the cloud agent here.
ApprovabilityVerdict: Needs human review This PR changes settings resolution from global to environment-scoped, affecting runtime behavior for thread creation defaults and how settings are resolved across environments. The architectural shift in how You can customize Macroscope's approvability policy. Learn more. |

What changed
initialConfig*so bootstrap state cannot be mistaken for current stateWhy
The model picker received provider snapshots from the selected remote environment but filtered them using settings from the primary environment. The same architecture also exposed an initial connection config and a live subscribed config under similarly generic names, making correctly scoped but stale reads possible on both web and mobile.
The new API makes the safe path the default: live data, keyed by environment. Client-only settings remain global and are merged only after the environment's server settings have been selected.
Impact
defaultThreadEnvModeandnewWorktreesStartFromOriginfrom their target environmentValidation
vp test— 490 files passed, 2 skipped; 3,683 tests passedvp check— passed with existing repository warnings onlyvp run typecheck— passed all 15 packagesvp run lint:mobile— passed native checks; SwiftLint skipped because it is not installedNote
Medium Risk
Broad refactor of how settings are read and persisted across web, mobile, and client-runtime; intentional behavior changes in multi-environment scenarios (model list, new-thread defaults, add-project paths).
Overview
Fixes the model picker and related flows reading primary server settings while provider snapshots came from a remote environment.
Settings API: Replaces
useSettings/useUpdateSettingswith explicit hooks—useEnvironmentSettings(environmentId)and updaters for environment-scoped server patches,useClientSettingsfor local-only prefs (sidebar sort, favorites, diff UI), andusePrimarySettingsfor the settings UI.mergeEnvironmentSettingsoverlays client prefs on server settings for a given environment.Runtime state: Session config is documented as bootstrap-only (
initialConfigValueAtom); live config flows throughserverEnvironment.configValueAtom/settingsValueAtom. Presentation and server-config maps wire throughserverConfigValueAtom.Chat / threads:
ChatViewusesuseEnvironmentSettings(environmentId)and, when an active thread exists, does not fall back to the primary environment'sserverConfigwhile the selected environment is loading. New-thread creation (useHandleNewThread, sidebar, command palette) takesdefaultThreadEnvModeand worktree defaults fromserverConfigs.get(environmentId), not global merged settings.Call-site routing: UI that only needs client prefs migrates to
useClientSettings; settings panels stay onusePrimarySettings.selectProjectGroupingSettingsnow reads from client settings only.Reviewed by Cursor Bugbot for commit 9f21d61. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Scope settings to individual environments instead of a single global client setting
useEnvironmentSettings,useClientSettings,usePrimarySettings, and matching updater hooks in useSettings.ts to replace the singleuseSettingshook with environment-aware variants.defaultThreadEnvModeandnewWorktreesStartFromOriginfrom each target environment's server settings viauseServerConfigs, removing the global client-side fallback.usePrimarySettings/useUpdatePrimarySettingsexplicitly.createServerEnvironmentAtomsgainssettingsValueAtomandprovidersValueAtomderived fromconfigValueAtom; session config is renamed toinitialConfigValueAtomto clarify it is bootstrap-only.ChatViewno longer falls back to the primary environment's server config while a selected environment is still loading — it returnsnullinstead.Macroscope summarized 9f21d61.