Skip to content

fix(provider): avoid clearing compatible profile on model set; profile-specific cache for reasoning models#320

Open
sternelee wants to merge 1 commit into
1jehuang:masterfrom
sternelee:fix/fetch
Open

fix(provider): avoid clearing compatible profile on model set; profile-specific cache for reasoning models#320
sternelee wants to merge 1 commit into
1jehuang:masterfrom
sternelee:fix/fetch

Conversation

@sternelee
Copy link
Copy Markdown

  • Prevent set_active_provider(OpenRouter) from shadowing active compatible profiles
  • Use profile_id namespace for disk cache lookup to skip blocking API calls
  • Respect explicit thinking_enabled=true even without provider features
  • Add kimi-for-coding to Kimi model detection

…e-specific cache for reasoning models

- Prevent set_active_provider(OpenRouter) from shadowing active compatible profiles
- Use profile_id namespace for disk cache lookup to skip blocking API calls
- Respect explicit thinking_enabled=true even without provider features
- Add kimi-for-coding to Kimi model detection
Copilot AI review requested due to automatic review settings June 4, 2026 06:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Improve OpenRouter compatibility handling by refining reasoning enablement, model cache lookups for compatible profiles, and Kimi-model detection.

Changes:

  • Extend Kimi model detection to include kimi-for-coding.
  • Adjust reasoning enablement so explicit “thinking enabled” can allow reasoning even when provider features are otherwise disabled.
  • Prefer profile-namespaced disk cache entries for compatible profiles to avoid repeated blocking model fetches; prevent active provider switching that clears compatible profile state.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
crates/jcode-provider-openrouter/src/lib.rs Expands Kimi model detection to cover an additional identifier.
crates/jcode-base/src/provider/openrouter_provider_impl.rs Changes the boolean gating for whether reasoning is allowed/included.
crates/jcode-base/src/provider/openrouter.rs Looks up disk cache entries in a profile-specific namespace before falling back to global cache.
crates/jcode-base/src/provider/mod.rs Avoids switching active provider because it clears the compatible profile state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +25
let allow_reasoning = (self.supports_provider_features || thinking_enabled == Some(true))
&& thinking_enabled != Some(false);
Comment on lines +1478 to +1485
if let Some(profile_id) = self.profile_id.as_deref() {
if let Some(entry) =
jcode_provider_openrouter::load_disk_cache_entry_for_namespace(profile_id)
&& self.model_disk_cache_source_matches(&entry)
{
return Some(entry);
}
}
Comment on lines +701 to 704
// NOTE: Do NOT call set_active_provider(ActiveProvider::OpenRouter) here
// because it clears the active compatible profile we just set above.
// The compatible profile mechanism handles routing independently.
Ok(())
Comment on lines 716 to +717
let lower = model.to_lowercase();
lower.contains("moonshotai/") || lower.contains("kimi-k2") || lower.contains("kimi-k2.5")
lower.contains("moonshotai/") || lower.contains("kimi-k2") || lower.contains("kimi-k2.5") || lower.contains("kimi-for-coding")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants