fix(aux): honor explicit base_url for named providers; preserve /anthropic - #17152
Closed
wmagev wants to merge 1 commit into
Closed
fix(aux): honor explicit base_url for named providers; preserve /anthropic#17152wmagev wants to merge 1 commit into
wmagev wants to merge 1 commit into
Conversation
…ropic Three config-inheritance bugs in agent/auxiliary_client.py that surface when the auxiliary client (compression, title-gen, vision, etc.) tries to reuse the user's main provider config: 1. _resolve_auto only forwarded base_url for "custom" / "custom:*" providers (NousResearch#16719). For provider=zai + base_url=<override>, the override was silently dropped → aux traffic went to z.ai's default endpoint. Forward as explicit_base_url / explicit_api_key for any named provider. 2. PROVIDER_REGISTRY branch ignored explicit_base_url / explicit_api_key even when forwarded. Now prefers them over creds["base_url"] / pconfig.inference_base_url. 3. custom branch unconditionally rewrote /anthropic → /v1 (NousResearch#17086). For api_mode=anthropic_messages (or URL recognized by _endpoint_speaks_anthropic_messages), the rewrite makes AnthropicAuxiliaryClient hit /v1/chat/completions instead of /anthropic/v1/messages → 404 on every aux task. Same guard already existed in _try_custom_endpoint() and the named-custom branch; extend it to the explicit-custom and PROVIDER_REGISTRY branches. Closes: NousResearch#16719, NousResearch#17086
Collaborator
This was referenced Apr 29, 2026
Contributor
|
Closing — the |
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.
Summary
Three related config-inheritance bugs in
agent/auxiliary_client.pythatsurface when the auxiliary client (compression, title generation, vision,
session search, etc.) tries to reuse the user's main provider config:
_resolve_autoonly forwardedbase_urlforcustom/custom:*providers (Auxiliary tasks (compression, title generation) ignore custom base_url for named providers #16719). With
provider: zai+base_url: <override>, theoverride was silently dropped and auxiliary traffic went to z.ai's
default endpoint. Now forwarded as
explicit_base_url/explicit_api_keyfor any named provider.PROVIDER_REGISTRY branch ignored
explicit_base_url/explicit_api_key.Even after fix (1), the named-provider branch unconditionally pulled
base_urlfromcreds["base_url"]orpconfig.inference_base_url. Nowprefers the forwarded explicit values.
custombranch unconditionally rewrote/anthropic→/v1(Bug: auxiliary tasks fail with HTTP 404 when using anthropic_messages custom endpoint — URL rewrite strips /anthropic/ path #17086)._to_openai_base_url()is the right normalization for OpenAI-wiregateways, but for
api_mode: anthropic_messages(or any URL the_endpoint_speaks_anthropic_messages()heuristic recognizes) therewrite breaks the AnthropicAuxiliaryClient — requests land on
/v1/chat/completionsinstead of/anthropic/v1/messages→ 404 onevery aux task. The same guard already existed in
_try_custom_endpoint()and the named-custom-provider branch; this PRextends it to the
explicit_base_urlcustom branch and thePROVIDER_REGISTRY branch.
Out of scope (mentioned in the original issues but separately resolved):
github-copilotslug normalization ([Bug]: auxiliary runtime does not normalize github-copilot provider slugs #15017) was already addressed incommit 2e2de12.
title_generator.py/context_compressor.pyalready passmain_runtimeto
call_llm(); the original issue's claim about missingmain_runtimeis stale.
Test plan
tests/agent/test_auxiliary_named_custom_providers.py— 31 passed(3 new test classes, 5 new tests)
tests/agent/test_auxiliary_client.py— 194 sync tests pass; 5pre-existing async failures unrelated (require
pytest-asyncio)tests/agent/test_auxiliary_client_anthropic_custom.py— passes(existing
_try_custom_endpointanthropic_messages coverage)tests/agent/test_auxiliary_main_first.py,test_auxiliary_transport_autodetect.py,test_minimax_auxiliary_url.py,test_auxiliary_config_bridge.py— all passtests/agent/test_context_compressor.py— 65 passed (no compressionregressions)
provider: zai+base_url: https://custom-zai.example.com/v1and verify compression hits thecustom URL (logs show
Auxiliary auto-detect: using main provider zaiand the request goes to the override).
api_mode: anthropic_messages+base_url: http://localhost:6655/anthropic/and verify auxiliary tasks no longer 404.
Closes: #16719, #17086