Repository navigation
fix(runtime): preserve provider apiStyle for foreign catalog models - #1314
Merged
Merged
Conversation
When an OpenAI-compatible provider configures a canonical model name such as gemini-3.8-flash, relay catalog resolution matches the official Google model entry and attaches api: "google-generative-ai" to its modelConfig. Previously, providerRequestTransport allowed any model-level api to override the provider apiStyle unconditionally, forcing the runtime to route requests through the Google Generative AI adapter against the OpenAI proxy endpoint, causing immediate HTTP 404 errors. Scope model-level wire API overrides to wire-compatible protocols, ensuring that foreign catalog protocols (e.g. Google Generative AI or Anthropic Messages) do not overwrite an OpenAI-compatible provider's configured chat_completions transport. fixes vastsa#1310
Owner
|
thank you! |
Owner
|
Thanks for the focused fix. PR #1314 was merged into main with your commit preserved. The follow-up updates E2E-005E to cover the Gemini catalog API case alongside the existing compatible model-level override scenario. |
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.
Observable Behavior Changes
gemini-3.8-flashorclaude-sonnet-4-6),providerRequestTransportnow checks wire compatibility before letting the catalogapioverrideprovider.apiStyle.google-generative-aioranthropic-messagesno longer overwrite an OpenAI provider'schat_completionswire style, eliminating the HTTP 404 errors caused by dispatching Google Generative AI requests to OpenAI-compatible endpoints.Main Files Modified
packages/agent-runtime/src/provider-binding.ts: Check compatibility between model-levelapiand providerapiStylebefore applying the override.packages/agent-runtime/src/provider-binding.test.ts: Added regression tests verifying that OpenAI completions are preserved for Gemini and Claude models configured on relay endpoints.docs/spec/03-runtime/11-provider-model-system.md(anddocs/zh-CN/equivalent): Documented foreign-family catalog wire override restrictions.Verification
pnpm --filter @pi-desktop/agent-runtime test src/provider-binding.test.ts: Passed (39 tests).pnpm --filter @pi-desktop/shared test: Passed (94 suites, 1158 tests).pnpm --filter @pi-desktop/desktop typecheck: Passed.pnpm lint: Passed.cargo fmt --check: Passed.cargo clippy -p host-core --all-targets: Passed.pnpm check:agent-policy&pnpm check:pr-base: Passed.Fixes #1310