Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 12, 2025

Description

This PR attempts to address Issue #9208 where switching to an API Profile that uses the same provider/model does not apply updated settings (e.g., reasoning level, headers, baseUrl, service tier).

Problem

When switching profiles via the dropdown or Settings view, if the provider and model remain the same, the active API client keeps using the previous settings instead of applying the new profile's configuration.

Solution

  • Added a forceRebuild parameter to the updateTaskApiHandlerIfNeeded method
  • When explicitly switching profiles via activateProviderProfile, always force rebuild the API handler
  • This ensures all settings (baseUrl, headers, service tier, reasoning features, rate limits, etc.) are properly applied even when provider/model remain unchanged

Changes

  • Modified src/core/webview/ClineProvider.ts:
    • Added forceRebuild parameter to updateTaskApiHandlerIfNeeded method
    • Updated activateProviderProfile to pass forceRebuild: true
    • Added clarifying comments about when to force rebuild
  • Added test file src/core/webview/__tests__/ClineProvider.profile-switch.spec.ts with tests for the new behavior

Testing

  • Existing tests pass without modification
  • New test file covers the profile switching scenarios

Related

Feedback and guidance are welcome!


Important

Adds forceRebuild to updateTaskApiHandlerIfNeeded in ClineProvider.ts to ensure API handler rebuilds on profile switch, with tests added for verification.

This description was created by Ellipsis for 1fc89f2. You can customize this summary. It will automatically update as commits are pushed.

- Add forceRebuild parameter to updateTaskApiHandlerIfNeeded method
- Always force rebuild when explicitly switching profiles via activateProviderProfile
- Ensures all settings (baseUrl, headers, service tier, etc.) are applied even when provider/model remain the same
- Fixes #9208
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 12, 2025 22:51
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Nov 12, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review Summary

I've completed a thorough review of this pull request. The implementation correctly addresses issue #9208 by ensuring that all API profile settings are applied when switching profiles, even when the provider and model remain the same.

Key Changes:

  • Added forceRebuild parameter to updateTaskApiHandlerIfNeeded method
  • Always forces API handler rebuild during explicit profile switches via activateProviderProfile
  • Maintains existing behavior for upsertProviderProfile operations
  • Comprehensive test coverage for the new functionality

Result: ✅ No issues found. The code is well-structured, the logic is sound, and the fix properly addresses the regression from PR #9181.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 12, 2025
})
})

test("does not rebuild API handler when settings are updated through upsertProviderProfile", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test 'does not rebuild API handler when settings are updated through upsertProviderProfile' lacks an assertion to verify that buildApiHandler is not called. Consider adding an expect statement (e.g. checking that buildApiHandlerMock has not been called) to ensure non-forced updates do not trigger a rebuild.

@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 12, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] API Profile switch: same provider/model does not apply changed settings

2 participants