feat: workspace-scoped mode-to-profile overrides#12228
feat: workspace-scoped mode-to-profile overrides#12228roomote-v0[bot] wants to merge 2 commits intomainfrom
Conversation
Adds the ability to pin a provider profile to a specific mode on a per-workspace basis. When switching modes, the system checks workspace- level overrides first and falls back to global mode-to-profile mappings if no workspace override exists. Changes: - Add workspaceModeApiConfigs to ExtensionState type - Add setWorkspaceModeApiConfig/clearWorkspaceModeApiConfig message types - Update ClineProvider.handleModeSwitch to check workspace overrides - Update ClineProvider.getState to include workspace configs - Add webview message handler for workspace profile operations - Add workspace profile pin button to ApiConfigSelector UI - Add translation keys for new UI elements - Add tests for workspace mode API config message handling Closes #12227
|
I noticed a contradiction in my last post: if the dropdown menu displays all modes, it creates a conflict regarding which profile should be used by default for a given mode. Ideally, the final implementation should be as follows: globally, modes do not change their behavior, but if a user has set their own profile for a mode in a specific project, then that profile should be used for that project. We could also add a “Project-specific profile usage” flag to the experimental features. In the profile settings, the dropdown does not display all modes, but only those not assigned to other providers |
Fixed the reported issues. Added a "Project-specific profile usage" experimental feature flag that gates all workspace profile override functionality. The workspace pin button now also shows a warning icon when the current mode is already pinned to a different profile. All local checks passed. |
…ow conflict state - Add WORKSPACE_PROFILE_OVERRIDES experiment to types, schema, and config - Gate workspace override logic in ClineProvider behind experiment flag - Gate workspace override logic in webviewMessageHandler behind experiment flag - Gate workspace pin button in ApiConfigSelector behind experiment flag - Show warning icon when current mode is already pinned to a different profile - Add "reassignWorkspaceProfile" translation key for conflict state - Add "Project-specific profile usage" experimental feature setting - Add test for experiment-disabled scenario
Related GitHub Issue
Closes: #12227
Description
This PR attempts to address Issue #12227 by adding workspace-scoped mode-to-profile override mappings. Feedback and guidance are welcome.
Problem: Provider profiles and mode-to-profile mappings are stored globally, so switching between projects (workspaces) does not change which profile is active for a given mode. Users working on corporate projects with a corporate AI provider and personal projects with a different provider must manually switch profiles each time they change context.
Solution: A workspace-level override layer for mode-to-profile mappings, stored in
context.workspaceState. When switching modes:workspaceModeApiConfigsfirstmodeApiConfigsif no workspace override existsKey design decisions (based on @AseWhy feedback):
Files changed:
packages/types/src/vscode-extension-host.ts-- AddedworkspaceModeApiConfigstoExtensionStateand new message typessrc/core/webview/ClineProvider.ts-- UpdatedhandleModeSwitch()andgetState()to check workspace overridessrc/core/webview/webviewMessageHandler.ts-- Added handlers for set/clear workspace mode API configwebview-ui/src/components/chat/ApiConfigSelector.tsx-- Added workspace profile pin toggle buttonwebview-ui/src/components/chat/ChatTextArea.tsx-- Passes new props to ApiConfigSelectorwebview-ui/src/context/ExtensionStateContext.tsx-- Added default forworkspaceModeApiConfigswebview-ui/src/i18n/locales/en/chat.json-- Added translation keys for new UITest Procedure
webviewMessageHandler.workspaceModeApiConfig.spec.tswith 5 tests covering set, clear, preserve, and no-mode scenariosClineProvider.sticky-mode.spec.ts(33 tests),ClineProvider.sticky-profile.spec.ts, andClineProvider.lockApiConfig.spec.ts-- all passPre-Submission Checklist
Interactively review PR in Roo Code Cloud