fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (#52608) - #52891
Merged
kshitijk4poor merged 1 commit intoJun 26, 2026
Merged
Conversation
Closed
4 tasks
…ble host (NousResearch#52608) When operator config has provider=anthropic with model.base_url pointing at a non-Anthropic host (e.g. https://openrouter.ai/api/v1 with provider=anthropic), the auxiliary Anthropic path was unconditionally applying that override. Main-session traffic routed correctly because the main path attaches the right credential for the actual destination, but every side-channel call (memory extractors, reflection, vision, title generation, janus extractor/promise) sent ANTHROPIC_API_KEY to the foreign host and 401'd. Gate the override on hostname == api.anthropic.com. Operators routing main through a non-Anthropic provider must use that provider's own auxiliary client; the Anthropic aux path now stays pointed at api.anthropic.com. Regression tests cover openrouter, openai, anthropic-with-path, empty, and anthropic-default-base_url cases.
kshitijk4poor
force-pushed
the
salvage/52623-aux-host
branch
from
June 26, 2026 05:51
0155b77 to
4e66bf1
Compare
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…3-aux-host fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (NousResearch#52608)
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…3-aux-host fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (NousResearch#52608)
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…3-aux-host fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (NousResearch#52608)
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…3-aux-host fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (NousResearch#52608)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…3-aux-host fix(auxiliary): gate Anthropic base_url override on Anthropic-compatible host (NousResearch#52608)
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
Salvage of #52623 by @Tranquil-Flow (rebased onto current main, 101 commits ahead — cherry-pick applied cleanly, no conflicts).
agent/auxiliary_client.py::_try_anthropic()unconditionally appliescfg["model"]["base_url"]as the auxiliary Anthropic base_url whenevercfg["model"]["provider"] == "anthropic"— even when that URL points at a different provider's endpoint (e.g. OpenRouter, OpenAI). This causes every auxiliary side-channel call (memory extractors, reflection, vision, title generation) to 401 from the foreign host.Fix
Add
_is_anthropic_compatible_host()hostname validation gate before applying the config override. Onlyapi.anthropic.com(and its path variants) are treated as safe Anthropic-compatible endpoints. Non-Anthropic hosts fall back to_ANTHROPIC_DEFAULT_BASE_URL.Testing
pytest tests/agent/test_auxiliary_client_base_url_host_validation_52608.py-> 5 passedpytest tests/agent/test_auxiliary_client.py-> 244 passed (no regressions)ruff check agent/auxiliary_client.py tests/agent/test_auxiliary_client_base_url_host_validation_52608.py-> passedDepends on
PR #52888 (AUTHOR_MAP chore — adds Tranquil-Flow email mappings)
Closes #52608
Closes #52623
Co-authored-by: Tranquil-Flow 66773372+Tranquil-Flow@users.noreply.github.com