Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

Related GitHub Issue

Closes: #9208

Roo Code Task Context (Optional)

No Roo Code task context for this PR

Description

This PR fixes a bug where switching to an API Profile that keeps the same provider/model did not apply changed settings (e.g., headers, baseUrl, service tier, reasoning tokens/budget). Previously, the API client (task.api) was only rebuilt when provider or model changed.

Implementation details:

  • Added an options parameter with forceRebuild to the helper that updates the task API client. Now explicit profile switch/save forces a rebuild to apply all non-model-affecting settings immediately.
  • Invocations from explicit profile activation and profile save paths pass forceRebuild: true.
  • Task.apiConfiguration is still fully synchronized with the selected profile.

Key changes:

Why this approach:

  • User-initiated profile switches or saves are explicit intent to use the new configuration. Rebuilding the client ensures runtime parameters (headers/baseUrl/tier/reasoning, etc.) take effect even when provider/model are unchanged.

Test Procedure

Automated tests:

  • Run targeted spec:
    • cd src && npx vitest run core/webview/tests/ClineProvider.apiHandlerRebuild.spec.ts
  • Run full suite:
    • cd src && npx vitest run

What’s covered:

  • Rebuild occurs when provider/model unchanged but settings differ during explicit activation/save
  • Rebuild still occurs when provider or model changes
  • Task.apiConfiguration is fully synchronized on every switch

Observed results locally:

  • Targeted: 1 file, all tests passed
  • Full suite: all tests passed (skipped tests unchanged)

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

No UI changes in this PR

Documentation Updates

  • No documentation updates are required.

Additional Notes

No additional notes

Get in Touch

@hannesrudolph

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Nov 12, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. No issues found.

This PR correctly addresses the bug where switching to an API Profile with the same provider/model but different settings (headers, baseUrl, service tier, reasoning features, etc.) would not apply those changed settings. The implementation:

  • Adds a forceRebuild option to ensure API handler rebuilds on explicit user actions
  • Properly synchronizes task.apiConfiguration with the selected profile
  • Maintains backward compatibility (provider/model changes still trigger rebuilds)
  • Includes comprehensive test coverage

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
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 13, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 13, 2025
@mrubens mrubens merged commit 8902fac into main Nov 13, 2025
24 checks passed
@mrubens mrubens deleted the fix/issue-9208-profile-rebuild branch November 13, 2025 00:45
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 13, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 13, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 13, 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 lgtm This PR has been approved by a maintainer PR - Needs Review size:M This PR changes 30-99 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

4 participants