feat: add per-workspace API profile selection#11612
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
feat: add per-workspace API profile selection#11612roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
Implements per-workspace API profile selection as requested in #8010. Addresses critical issues from review by @daniel-lxs: 1. Fix: Workspace selection no longer overwrites global config across windows. When scope="workspace", only the local cache is updated via setLocalValue(), avoiding leaking currentApiConfigName to other windows via shared globalState. 2. Fix: Toggling scope back to Global now clears workspace overrides via clearWorkspaceOverrides(), preventing stale workspace state from keeping the scope stuck on "workspace". Backend changes: - Add ConfigScope type and WorkspaceOverrides schema to ProviderSettingsManager - Add workspace override methods (getWorkspaceOverrides, storeWorkspaceOverrides, clearWorkspaceOverrides, getConfigScope, getActiveProfileName) - Modify activateProfile and setModeConfig to accept scope parameter - Modify getModeConfigId to check workspace overrides first - Add setLocalValue to ContextProxy for cache-only state updates - Add scope field to WebviewMessage and currentConfigScope to ExtensionState Frontend changes: - Add scope toggle UI to ApiConfigSelector with [W] indicator - Wire scope through ChatTextArea to pass with config changes - Add i18n translation keys for scope UI elements Testing: - Add comprehensive workspace-scoped tests to ProviderSettingsManager.spec.ts - Update ClineProvider test mocks with getConfigScope method - All tests passing (175 across 5 test files) Fixes #8010
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: #8010
Description
This PR attempts to address Issue #8010 by adding per-workspace API profile selection. The branch was created by @ruben-benaco and has been rebased onto the latest
main.Key implementation details:
workspaceStateto store workspace-specific API profile overrides via a newWorkspaceOverridesschema inProviderSettingsManager.ApiConfigSelectorcomponent gains a scope toggle button (Global / Workspace) that lets users choose whether a profile selection applies globally or only to the current workspace.[W]badge appears next to the profile name when workspace scope is active.Test Procedure
ProviderSettingsManager.spec.tspass (covering workspace override CRUD, scope toggling, fallback behavior, and profile activation with scope).ClineProvider.spec.tspass (87 passed, 6 skipped).Pre-Submission Checklist
Documentation Updates
[W]indicator should be documented in user-facing docs.Additional Notes
This PR is based on the existing
feat/workspace-api-profilesbranch (per @ruben-benaco's request in #8010). It has been rebased onto the latestmainto resolve any drift. Feedback and guidance are welcome.Files changed (11):
packages/types/src/vscode-extension-host.ts- AddedcurrentConfigScopeto ExtensionState andscopeto WebviewMessagesrc/core/config/ContextProxy.ts- AddedsetLocalValue()method for in-memory-only cache updatessrc/core/config/ProviderSettingsManager.ts- Added workspace override storage, scope-aware profile activation, and active profile resolutionsrc/core/config/__tests__/ProviderSettingsManager.spec.ts- Comprehensive tests for workspace override functionalitysrc/core/webview/ClineProvider.ts- Wired scope through to profile activation and statesrc/core/webview/__tests__/ClineProvider.spec.ts- Updated tests for scope supportsrc/core/webview/webviewMessageHandler.ts- Pass scope from webview messages to profile activationwebview-ui/src/components/chat/ApiConfigSelector.tsx- Added scope toggle UI with Global/Workspace buttonwebview-ui/src/components/chat/ChatTextArea.tsx- Wired scope state and handlers to ApiConfigSelectorwebview-ui/src/i18n/locales/en/prompts.json- Added scope/global/workspace translation stringssrc/core/webview/__tests__/ClineProvider.apiHandlerRebuild.spec.ts- Minor test updateStart a new Roo Code Cloud session on this branch