Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 9, 2025

Description

This PR fixes an issue where OpenAI-like provider configurations (such as Jan.ai) were being reset when switching between different operation modes (Code, Orchestrator, etc.).

Problem

When users configured custom OpenAI-compatible providers and then switched between modes, their settings would be lost and they would have to reconfigure the provider each time.

Solution

The fix ensures that:

  1. Current provider configurations are properly saved when switching to a mode that doesn't have a saved configuration
  2. Custom OpenAI provider profiles are re-activated after being saved to ensure all settings persist correctly
  3. The configuration persistence logic now works consistently for all provider types

Testing

  • All existing tests pass ✅
  • The fix preserves the expected behavior where configurations are saved as defaults for new modes
  • Custom OpenAI provider settings now persist across mode switches

Related Issue

Fixes #8583


Important

Fixes provider settings reset issue in ClineProvider.ts by ensuring configurations are saved and reloaded correctly when switching modes.

  • Behavior:
    • Fixes issue where OpenAI-like provider settings were reset when switching modes in ClineProvider.ts.
    • Ensures current provider configurations are saved as defaults for new modes if no saved config exists.
    • Re-activates custom OpenAI provider profiles to ensure settings persist across mode switches.
  • Functions:
    • Updates handleModeSwitch() to save current config as default and re-activate profiles if needed.
    • Modifies activateProviderProfile() to ensure settings are properly loaded for OpenAI providers.

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

- Save current provider configuration when switching to a mode without saved config
- Re-activate custom OpenAI provider profiles to ensure settings persist
- Fixes issue where Jan.ai and other OpenAI-compatible provider settings were lost

Fixes #8583
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 9, 2025 19:31
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Oct 9, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code again. At least I'm consistent in my inconsistencies.

// The "openai" provider is the customizable one that users configure for OpenAI-compatible endpoints
if (currentConfig.apiProvider === "openai") {
// Re-activate the profile to ensure all settings are properly loaded
await this.activateProviderProfile({ name: currentConfig.name })
Copy link
Author

Choose a reason for hiding this comment

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

Minor: Consider adding error handling around the activateProviderProfile call. If activation fails, the mode switch will still complete but the provider settings might not be fully loaded.

Suggested change
await this.activateProviderProfile({ name: currentConfig.name })
try {
await this.activateProviderProfile({ name: currentConfig.name })
} catch (error) {
this.log(`Failed to re-activate OpenAI provider profile during mode switch: ${error instanceof Error ? error.message : String(error)}`)
}


// For custom OpenAI providers, we need to ensure the configuration is properly loaded
// The "openai" provider is the customizable one that users configure for OpenAI-compatible endpoints
if (currentConfig.apiProvider === "openai") {
Copy link
Author

Choose a reason for hiding this comment

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

Nitpick: The comment mentions "custom OpenAI providers" but the check is for apiProvider === "openai". Consider clarifying that this applies to all OpenAI-compatible providers configured through the "openai" provider type, not just custom ones. This would make the intent clearer for future maintainers.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 9, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 28, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 28, 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:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] The OpenAi Like does not save LLM model for operation mode

3 participants