fix: resolve verified issue triage regressions - #841
Conversation
Greptile SummaryThis PR improves remote provider routing, focused-memory formatting, remote draft editing, retry cancellation, billing display, installer cleanup, and platform integration. One blocking routing issue remains: when compatible-provider model catalogs overlap, a slash-prefixed model can be routed to a provider other than the one selected by the user. Confidence Score: 3/5Not merge-safe until slash-model routing gives the active remote provider precedence over global compatible-provider matches. One verified P1 security finding remains: overlapping compatible-provider catalogs can route prompts to an unintended configured provider. The scoring table assigns a score of 3 to one security P1 finding. Files Needing Attention: crates/jcode-base/src/provider/catalog_routes.rs
|
| if model.contains('/') | ||
| && let Some(route) = remote_openai_compatible_route_for_model(model) | ||
| { | ||
| routes.push(route); | ||
| continue; | ||
| } |
There was a problem hiding this 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.
Artifacts
Failure-path reproducer with Baseten first and Hugging Face selected second
- This authored Rust source configures both compatible profiles and invokes the exact fallback path, establishing the ordered-profile scenario.
Fallback output routes selected Hugging Face model to Baseten
- The executed `cargo run` capture exits 0 and shows the fallback chose Baseten, proving the incorrect endpoint selection.
Selected-provider comparison reproducer for Hugging Face
- This authored Rust source uses the same profiles and model but invokes the selected-profile resolver that the fallback should prefer.
Selected-provider resolver output routes model to Hugging Face
- The executed `cargo run` capture exits 0 and shows Hugging Face, establishing the expected selected-provider route.
Existing focused Rust test output
- The focused existing test command exits 0, but reports zero matching tests due to its non-module-qualified filter and therefore does not prove the required two-profile order scenario.
Ran code and verified through T-Rex
Prompt To Fix With AI
This 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.| if model.contains('/') | ||
| && let Some(route) = remote_openai_compatible_route_for_model(model) | ||
| { | ||
| routes.push(route); | ||
| continue; |
There was a problem hiding this comment.
Profile order overrides selection
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. Check remote_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
- This preserved authored test configures Hugging Face and Baseten for the same slash model while selecting Hugging Face, with the takeaway that the expected selected-provider route is explicitly asserted.
Focused duplicate-profile routing test output
- This captured cargo test output shows the selected Hugging Face route resolving to Baseten and the assertion failing, with the takeaway that the provider override remains reproducible.
Working tree restoration check
- This captured git diff and status check confirms no tracked source changes remain after removing the focused test-only modification, with the takeaway that the working tree source is restored.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/provider/catalog_routes.rs
Line: 892-896
Comment:
**Profile order overrides selection**
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. Check `remote_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.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if model.contains('/') | ||
| && let Some(route) = remote_openai_compatible_route_for_model(model) | ||
| { | ||
| routes.push(route); | ||
| continue; | ||
| } |
There was a problem hiding this 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.
Artifacts
Rust reproduction fixture for selected OpenCode Go with duplicate slash model
- The fixture configures two compatible profiles with the same slash model and requests the OpenCode Go route, ending with the takeaway: it directly reproduces the provider-selection defect.
Captured failed provider-routing reproduction output
- The captured cargo run reports selected OpenCode Go but actual OpenCode Zen and exits 101, ending with the takeaway: current fallback routing selects the first global profile instead of the requested provider.
Ran code and verified through T-Rex
Prompt To Fix With AI
This 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.| if model.contains('/') | ||
| && let Some(route) = remote_openai_compatible_route_for_model(model) | ||
| { | ||
| routes.push(route); | ||
| continue; | ||
| } |
There was a problem hiding this 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.
Artifacts
Focused Rust overlapping-provider reproduction source
- The authored isolated Rust test writes matching catalogs for OpenCode Zen and OpenCode Go, invokes the exact helpers and fallback builder, and asserts the divergent routes, proving the current behavior.
Reproduction harness dependency manifest
- The authored manifest records the focused harness dependencies used to compile against the current repository library, making the reproduction setup inspectable.
Current-provider helper output for overlapping catalog
- The executed baseline test passed and printed that the OpenCode Go current-provider helper returns `openai-compatible:opencode-go`, establishing the route expected from the active provider.
Fallback output for overlapping catalog
- The executed fallback test passed and printed global and fallback routes as OpenCode Zen while the current-provider route was OpenCode Go, demonstrating that the fallback preempts the active provider.
Ran code and verified through T-Rex
Prompt To Fix With AI
This 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.
Summary
Verification
install.ps1parses successfully in PowerShellFixes #840. Fixes #838. Fixes #832. Fixes #831. Fixes #826. Fixes #824.
--- — Jcode agent (automated triage), on behalf of @1jehuang