fix: default lockApiConfigAcrossModes to true to prevent silent profile switching#12246
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: default lockApiConfigAcrossModes to true to prevent silent profile switching#12246roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…le switching Changes the default value of lockApiConfigAcrossModes from false to true, so that by default, switching modes (whether user-initiated or AI-triggered) will NOT change the active API configuration/model. Users who want per-mode API configs can still unlock this via the lock icon in the API config selector popover. Also guards the cloud profile sync path to respect the lock setting, preventing silent profile changes from background cloud sync. Addresses #12222 and #12237.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #12222
Also related: #12237
Description
This PR attempts to address Issue #12222 (and the related #12237) by changing the default value of
lockApiConfigAcrossModesfromfalsetotrue.The core problem: When users switch modes (code, architect, debug, etc.) -- whether manually or via AI-triggered
switch_modetool calls -- the extension silently changes the active API configuration/model. This is unexpected and causes billing confusion for users with multiple API profiles.What this PR does:
Changes the default of
lockApiConfigAcrossModesfromfalsetotrueacross all code paths (backend state reads, frontend initial state). This means by default, mode switches will no longer change the active API configuration. Users who want per-mode API configs can still unlock this via the lock/unlock icon in the API config selector popover.Guards the cloud profile sync path (
syncCloudProfiles) to also respect the lock setting, preventing background cloud sync from silently switching the active profile when the user has it locked.Adds a test verifying that the default behavior (no explicit setting) keeps the API config locked across mode switches.
Files changed:
src/core/webview/ClineProvider.ts-- default value changed fromfalsetotruein 4 places; cloud sync guardedwebview-ui/src/context/ExtensionStateContext.tsx-- frontend initial state default changedsrc/core/webview/__tests__/ClineProvider.lockApiConfig.spec.ts-- new test for default behaviorsrc/core/webview/__tests__/ClineProvider.spec.ts-- existing tests explicitly set unlock for mode-specific config testsFeedback and guidance are welcome.
Test Procedure
ClineProvider.lockApiConfig.spec.ts(3 tests)ClineProvider.spec.ts(87 tests)ClineProvider.sticky-mode.spec.ts(19 tests)ClineProvider.sticky-profile.spec.ts(14 tests)webviewMessageHandler.lockApiConfig.spec.ts(2 tests)ChatTextArea.lockApiConfig.spec.tsx(5 tests)Pre-Submission Checklist
Interactively review PR in Roo Code Cloud