fix(agent): wrap auxiliary clients using explicit_base_url - #85597
fix(agent): wrap auxiliary clients using explicit_base_url#85597686f6c61 wants to merge 1 commit into
Conversation
The API-key branch built the OpenAI client on the override URL but passed the credential-pool stock base into _wrap_if_needed, so Anthropic-wire fallbacks never wrapped. Fixes NousResearch#85535
|
This was generated by AI during triage. Summary: Problems:
Solution: Evidenceno deterministic fact backs this claim — model belief, not executed or read evidence Checked against |
|
Checked current if explicit_base_url:
raw_base_url = explicit_base_url.strip().rstrip("/")at Closing as already fixed on main. The added test is also redundant with that assignment — not worth landing on its own. |
|
Closing: wrap already sees the explicit override on main (see previous comment). |
What breaks
A fallback / auxiliary entry that names a built-in API-key provider (e.g.
minimax) but overridesexplicit_base_urlto an Anthropic-only gateway never getsAnthropicAuxiliaryClient. Side tasks (title, compression, vision) keep talking OpenAI/chat/completionsat the stock provider host, not the override.This is the leftover call site from the August
/anthropic↔/v1sweep. #85532 / #85466 cover the rewrite policy; they do not fix which URL wrap inspects.Why
In
resolve_provider_client()’sauth_type == "api_key"branch:base_url = _to_openai_base_url(explicit or creds)._wrap_if_needed(...)was passedraw_base_url.If wrap does not see the override (or sees the pool’s MiniMax/OpenAI stock URL),
_maybe_wrap_anthropicnever matches/anthropic/api_mode=anthropic_messagesfor the URL the user actually targeted.What this changes
When
explicit_base_urlis set, wrap receives that string un-rewritten (so an/anthropicsuffix stays visible). Otherwise it still uses the credential base.The client construction /
_to_openai_base_urlhost allowlist is unchanged. Dual-surface MiniMax still rewrites the OpenAI client to/v1; wrap still needs the raw override to decide Messages vs chat.Verify
Stock creds mocked as MiniMax
/v1; explicit base is an Anthropic-only proxy. AssertsAnthropicAuxiliaryClientandbuild_anthropic_client(..., override_url).Fixes #85535