fix(provider): avoid clearing compatible profile on model set; profile-specific cache for reasoning models#320
Open
sternelee wants to merge 1 commit into
Open
fix(provider): avoid clearing compatible profile on model set; profile-specific cache for reasoning models#320sternelee wants to merge 1 commit into
sternelee wants to merge 1 commit into
Conversation
sternelee
commented
Jun 4, 2026
- 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
There was a problem hiding this comment.
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.