fix: preserve provider identity when auxiliary task has base_url - #49545
Closed
zh-xl-kang wants to merge 1 commit into
Closed
fix: preserve provider identity when auxiliary task has base_url#49545zh-xl-kang wants to merge 1 commit into
zh-xl-kang wants to merge 1 commit into
Conversation
zh-xl-kang
force-pushed
the
fix/vision-provider-base-url
branch
3 times, most recently
from
June 25, 2026 12:45
251bdee to
1e46652
Compare
This was referenced Jun 27, 2026
Closed
zh-xl-kang
force-pushed
the
fix/vision-provider-base-url
branch
from
July 1, 2026 07:47
1e46652 to
eac0b9f
Compare
When an auxiliary task (e.g. vision) has a base_url configured, _resolve_task_provider_model was collapsing known providers to 'custom' because the base_url triggered the 'unknown endpoint' heuristic. This broke credential resolution — provider 'custom' looks for OPENAI_API_KEY instead of the provider-specific key (e.g. alibaba → DASHSCOPE_API_KEY). Fix: when the caller explicitly passes a known provider name, preserve it regardless of base_url. The base_url only indicates a proxy/mirror, not an unknown vendor. - agent/auxiliary_client.py: keep provider string when it matches a known provider, even with custom base_url - tests/agent/test_vision_provider_base_url.py: 135 + 86 lines of regression tests covering direct-argument, config-driven, and end-to-end credential resolution paths
zh-xl-kang
force-pushed
the
fix/vision-provider-base-url
branch
from
July 2, 2026 07:00
eac0b9f to
759b2a9
Compare
Contributor
|
Closing as implemented on main: |
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.
What does this PR do?
_resolve_task_provider_model()forces provider to"custom"wheneverbase_urlis set as a direct argument, even when the caller specified a known provider (e.g.alibaba,openrouter). This causes vision and other auxiliary calls to resolve credentials from the wrong env var (OPENAI_API_KEYinstead ofDASHSCOPE_API_KEY, etc.) and fail with401 Unauthorized.The fix preserves the caller's provider when it is a non-empty, non-
autovalue, so each provider resolves credentials from its own env vars.Related Issue
Fixes #
Type of Change
Changes Made
agent/auxiliary_client.py—_resolve_task_provider_model(): preserve a known (non-empty, non-auto) provider whenbase_urlis set instead of collapsing it to"custom":auto/ empty /None/ missing provider still collapse to"custom"(unchanged behavior).tests/agent/test_vision_provider_base_url.py— 8 regression tests (see below).How to Test
Reproduction via
config.yaml:customprovider → readOPENAI_API_KEY→401.alibabaprovider → readDASHSCOPE_API_KEY→ works.Automated: 8 regression tests cover:
base_url(alibaba,openrouter), via both direct arguments and config-driven (task="vision") resolution.auto/ empty /None/ missing provider still collapses to"custom"(unchanged behavior);base_urlalone (no provider arg) still returns"custom".resolve_api_key_provider_credentials, provingalibabareadsDASHSCOPE_API_KEY(notOPENAI_API_KEY).All existing vision routing tests (12) continue to pass — 20 passed total.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A