-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: resolve verified issue triage regressions #841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a3e0784
cb4a2e8
ef179ed
f1361a7
b04cb4d
17d6dce
88a4ff2
a6d44ce
8982760
2d5b54e
47e8819
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -889,6 +889,13 @@ pub fn remote_model_routes_fallback( | |
| continue; | ||
| } | ||
|
|
||
| if model.contains('/') | ||
| && let Some(route) = remote_openai_compatible_route_for_model(model) | ||
| { | ||
| routes.push(route); | ||
| continue; | ||
| } | ||
|
Comment on lines
+892
to
+897
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When two configured OpenAI-compatible profiles advertise the same slash-prefixed model, this fallback performs the global compatible-profile lookup before checking the selected provider. With Baseten listed before the selected Hugging Face profile, a request for ArtifactsFailure-path reproducer with Baseten first and Hugging Face selected second
Fallback output routes selected Hugging Face model to Baseten
Selected-provider comparison reproducer for Hugging Face
Selected-provider resolver output routes model to Hugging Face
Existing focused Rust test output
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/jcode-base/src/provider/catalog_routes.rs
Line: 892-897
Comment:
**Profile order overrides selection**
When two configured OpenAI-compatible profiles advertise the same slash-prefixed model, this fallback performs the global compatible-profile lookup before checking the selected provider. With Baseten listed before the selected Hugging Face profile, a request for `zai-org/GLM-4.7` routes to Baseten instead of Hugging Face. Prefer `remote_current_openai_compatible_route_for_model(remote_provider_name, model)` before the global lookup, retaining the global lookup only when the current provider cannot validate the model.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comment on lines
+892
to
+897
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When two configured OpenAI-compatible providers advertise the same slash-prefixed model, this global lookup returns the first catalog match before the selected remote provider is considered. For example, selecting OpenCode Go while both OpenCode Go and OpenCode Zen advertise ArtifactsRust reproduction fixture for selected OpenCode Go with duplicate slash model
Captured failed provider-routing reproduction output
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/jcode-base/src/provider/catalog_routes.rs
Line: 892-897
Comment:
**Selected compatible provider is ignored for overlapping slash models**
When two configured OpenAI-compatible providers advertise the same slash-prefixed model, this global lookup returns the first catalog match before the selected remote provider is considered. For example, selecting OpenCode Go while both OpenCode Go and OpenCode Zen advertise `shared/vendor-model` routes the request to OpenCode Zen. This can send prompts to a provider the user did not select. Resolve `remote_current_openai_compatible_route_for_model(remote_provider_name, model)` first for slash models, then use the global compatible-profile lookup only if the selected provider cannot serve that model.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comment on lines
+892
to
+897
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For slash-prefixed models, this branch resolves ArtifactsFocused Rust overlapping-provider reproduction source
Reproduction harness dependency manifest
Current-provider helper output for overlapping catalog
Fallback output for overlapping catalog
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/jcode-base/src/provider/catalog_routes.rs
Line: 892-897
Comment:
**Selected compatible provider is ignored for overlapping slash models**
For slash-prefixed models, this branch resolves `remote_openai_compatible_route_for_model(model)` globally and returns its first catalog match before considering `remote_provider_name`. When two configured compatible providers advertise the same model, the fallback can send the request and its prompt to a provider the user did not select. Resolve `remote_current_openai_compatible_route_for_model(remote_provider_name, model)` first, and use the global compatible-profile lookup only when the selected provider cannot serve the model.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
|
|
||
| if model.contains('/') { | ||
| let cached = openrouter_cached; | ||
| let auto_detail = cached | ||
|
|
@@ -1103,7 +1110,7 @@ pub fn remote_current_openai_compatible_route_for_model( | |
| remote_provider_name: Option<&str>, | ||
| model: &str, | ||
| ) -> Option<ModelRoute> { | ||
| if model.trim().is_empty() || model.contains('/') || provider_for_model(model).is_some() { | ||
| if model.trim().is_empty() || (!model.contains('/') && provider_for_model(model).is_some()) { | ||
| return None; | ||
| } | ||
|
|
||
|
|
@@ -1115,6 +1122,13 @@ pub fn remote_current_openai_compatible_route_for_model( | |
| return None; | ||
| } | ||
| let resolved = crate::provider_catalog::resolve_openai_compatible_profile(profile); | ||
| if model.contains('/') | ||
| && !remote_openai_compatible_profile_models(&resolved, profile) | ||
| .iter() | ||
| .any(|candidate| candidate.0 == model) | ||
| { | ||
| return None; | ||
| } | ||
|
|
||
| Some(ModelRoute { | ||
| model: model.to_string(), | ||
|
|
@@ -1522,6 +1536,35 @@ mod tests { | |
| assert!(!route.detail.contains("fallback")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn slash_model_fallback_prefers_matching_compatible_profile() { | ||
| let guard = EnvGuard::new(); | ||
| let model = "vendouple/gpt-5.6-sol"; | ||
| guard.save_opencode_cache("https://opencode.ai/zen/v1", &[model]); | ||
|
|
||
| let routes = remote_model_routes_fallback(Some("OpenCode Zen"), &[model.to_string()]); | ||
|
|
||
| assert_eq!(routes.len(), 1, "unexpected fallback routes: {routes:?}"); | ||
| assert_eq!(routes[0].provider, "OpenCode Zen"); | ||
| assert_eq!(routes[0].api_method, "openai-compatible:opencode"); | ||
| assert!(routes[0].available); | ||
| } | ||
|
|
||
| #[test] | ||
| fn current_compatible_profile_accepts_only_cataloged_slash_models() { | ||
| let guard = EnvGuard::new(); | ||
| let model = "vendouple/gpt-5.6-sol"; | ||
| guard.save_opencode_cache("https://opencode.ai/zen/v1", &[model]); | ||
|
|
||
| let route = remote_current_openai_compatible_route_for_model(Some("OpenCode Zen"), model) | ||
| .expect("cataloged slash model should use the current compatible profile"); | ||
| assert_eq!(route.api_method, "openai-compatible:opencode"); | ||
| assert!( | ||
| remote_current_openai_compatible_route_for_model(Some("OpenCode Zen"), "unknown/model") | ||
| .is_none() | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn remote_compatible_route_marks_static_model_list_fallback() { | ||
| let _guard = EnvGuard::new(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For slash-prefixed models, this branch performs the global compatible-profile lookup before checking the provider selected for the current remote session. When Baseten and Hugging Face both advertise
zai-org/GLM-4.7, with Hugging Face selected, the lookup returns Baseten because it appears first in the catalog. Checkremote_current_openai_compatible_route_for_model(remote_provider_name, model)first, and use the global lookup only when the selected provider cannot validate the model.Artifacts
Focused duplicate-profile routing test source
Focused duplicate-profile routing test output
Working tree restoration check
Prompt To Fix With AI