fix(auxiliary): use post-override base_url for endpoint detection - #36757
Open
wqz666 wants to merge 1 commit into
Open
fix(auxiliary): use post-override base_url for endpoint detection#36757wqz666 wants to merge 1 commit into
wqz666 wants to merge 1 commit into
Conversation
resolve_provider_client() in agent/auxiliary_client.py used the raw provider-registry base_url when deciding whether to wrap the client as Anthropic-compatible. When a user overrode the base_url to an OpenAI- compatible endpoint (e.g. via custom_providers or a non-Anthropic proxy), the detector still saw the registry's hard-coded '/anthropic' suffix and forced the request through the Anthropic SDK, which then hit the real Anthropic endpoint with the user's key and returned 401. Fix: use the post-override base_url for endpoint-speak detection so the wrapping decision follows the URL the request will actually hit. api_mode='anthropic_messages' remains an explicit opt-in. Regression test: tests/agent/test_auxiliary_url_override_anthropic_detect.py covers three scenarios: 1. user-override to non-Anthropic URL keeps OpenAI client (the bug) 2. explicit api_mode=anthropic_messages still routes to Anthropic 3. OpenAI path normalises '/anthropic' suffix to '/v1' Reproducer: MiniMax auxiliary tasks (title generation, memory writer) returned 'HTTP 401: invalid api key (2049)' because the registry's anthropic-suffixed URL was preferred over the user's override.
|
Unsubscribe
Sent from Yahoo Mail for iPhone
On Monday, June 1, 2026, 7:42 AM, wqz666 ***@***.***> wrote:
Summary
resolve_provider_client() in agent/auxiliary_client.py used the raw provider-registry base_url when deciding whether to wrap the client as Anthropic-compatible. When a user overrode the base_url to an OpenAI-compatible endpoint (e.g. via custom_providers or a non-Anthropic proxy), the detector still saw the registry's hard-coded /anthropic suffix and forced the request through the Anthropic SDK, which then hit the real Anthropic endpoint with the user's key and returned 401 invalid api key.
Fix: use the post-override base_url for endpoint-speak detection, so the wrapping decision follows the URL the request will actually hit. api_mode='anthropic_messages' remains an explicit opt-in.
Reproduction
MiniMax auxiliary tasks (title_generation, context_summary, memory_writer, etc.) returned:
⚠ Auxiliary title generation failed: HTTP 401: invalid api key (2049)
Root cause: the provider registry hard-codes minimax -> https://api.minimax.io/anthropic. Even when the user supplied their own base_url pointing to a different provider, the detector saw the registry's /anthropic suffix and forced the request through AnthropicAuxiliaryClient.
Changes
- agent/auxiliary_client.py — use post-override base_url in _wrap_if_needed / _endpoint_speaks_anthropic_messages (1 line: raw_base_url -> base_url).
- tests/agent/test_auxiliary_url_override_anthropic_detect.py — new regression test, 3 cases:
- user-override to non-Anthropic URL keeps OpenAI client (the bug)
- explicit api_mode=anthropic_messages still routes to Anthropic
- OpenAI path normalises /anthropic suffix to /v1
Verification
- uv run pytest tests/agent/test_auxiliary_url_override_anthropic_detect.py -v -> 3/3 pass
- uv run pytest tests/agent/test_auxiliary_named_custom_providers.py -v -> 29/29 pass
- Pre-existing 12 failures in the full tests/agent/ suite were verified to be a test-isolation bug unrelated to this change (azure_foundry pollutes named_custom state; reproducing on stashed working tree confirmed it pre-dates this commit).
Test plan for reviewers
# 1. New regression test
uv run pytest tests/agent/test_auxiliary_url_override_anthropic_detect.py -v
# 2. Related test groups
uv run pytest tests/agent/test_auxiliary_named_custom_providers.py -v
uv run pytest tests/agent/test_auxiliary_client_azure_foundry.py -v
Workaround for affected users (pre-merge)
Add api_mode: chat_completions to the relevant provider block in ~/.hermes/config.yaml. This is a band-aid; the source fix is the proper resolution.
You can view, comment on, or merge this pull request online at:
#36757
Commit Summary
- dbb4349 fix(auxiliary): use post-override base_url for endpoint detection
File Changes
(2 files)
- M agent/auxiliary_client.py (11)
- A tests/agent/test_auxiliary_url_override_anthropic_detect.py (93)
Patch Links:
- https://github.com/NousResearch/hermes-agent/pull/36757.patch
- https://github.com/NousResearch/hermes-agent/pull/36757.diff
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
Unsubscribe
…On Mon, Jun 1, 2026 at 7:43 AM Sameer Dhawan ***@***.***> wrote:
Unsubscribe
Sent from Yahoo Mail for iPhone
<https://mail.onelink.me/107872968?pid=nativeplacement&c=Global_Acquisition_YMktg_315_Internal_EmailSignature&af_sub1=Acquisition&af_sub2=Global_YMktg&af_sub3=&af_sub4=100000604&af_sub5=EmailSignature__Static_&af_ios_store_cpp=9d3a686e-218d-4849-8298-b480188dc8ac&af_android_url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.yahoo.mobile.client.android.mail%26listing%3Demail_signature>
On Monday, June 1, 2026, 7:42 AM, wqz666 ***@***.***> wrote:
Summary
resolve_provider_client() in agent/auxiliary_client.py used the *raw*
provider-registry base_url when deciding whether to wrap the client as
Anthropic-compatible. When a user overrode the base_url to an
OpenAI-compatible endpoint (e.g. via custom_providers or a non-Anthropic
proxy), the detector still saw the registry's hard-coded /anthropic
suffix and forced the request through the Anthropic SDK, which then hit the
real Anthropic endpoint with the user's key and returned 401 invalid api
key.
*Fix:* use the *post-override* base_url for endpoint-speak detection, so
the wrapping decision follows the URL the request will actually hit.
api_mode='anthropic_messages' remains an explicit opt-in.
Reproduction
MiniMax auxiliary tasks (title_generation, context_summary, memory_writer,
etc.) returned:
⚠ Auxiliary title generation failed: HTTP 401: invalid api key (2049)
Root cause: the provider registry hard-codes minimax ->
https://api.minimax.io/anthropic. Even when the user supplied their own
base_url pointing to a different provider, the detector saw the
registry's /anthropic suffix and forced the request through
AnthropicAuxiliaryClient.
Changes
- agent/auxiliary_client.py — use post-override base_url in
_wrap_if_needed / _endpoint_speaks_anthropic_messages (1 line:
raw_base_url -> base_url).
- tests/agent/test_auxiliary_url_override_anthropic_detect.py — new
regression test, 3 cases:
1. user-override to non-Anthropic URL keeps OpenAI client (the bug)
2. explicit api_mode=anthropic_messages still routes to Anthropic
3. OpenAI path normalises /anthropic suffix to /v1
Verification
- uv run pytest
tests/agent/test_auxiliary_url_override_anthropic_detect.py -v -> 3/3
pass
- uv run pytest tests/agent/test_auxiliary_named_custom_providers.py -v
-> 29/29 pass
- Pre-existing 12 failures in the full tests/agent/ suite were
verified to be a test-isolation bug unrelated to this change (azure_foundry
pollutes named_custom state; reproducing on stashed working tree confirmed
it pre-dates this commit).
Test plan for reviewers
# 1. New regression test
uv run pytest tests/agent/test_auxiliary_url_override_anthropic_detect.py -v
# 2. Related test groups
uv run pytest tests/agent/test_auxiliary_named_custom_providers.py -v
uv run pytest tests/agent/test_auxiliary_client_azure_foundry.py -v
Workaround for affected users (pre-merge)
Add api_mode: chat_completions to the relevant provider block in
~/.hermes/config.yaml. This is a band-aid; the source fix is the proper
resolution.
------------------------------
You can view, comment on, or merge this pull request online at:
#36757
Commit Summary
- dbb4349
<dbb4349>
fix(auxiliary): use post-override base_url for endpoint detection
File Changes
(2 files <https://github.com/NousResearch/hermes-agent/pull/36757/files>)
- *M* agent/auxiliary_client.py
<https://github.com/NousResearch/hermes-agent/pull/36757/files#diff-dee5eb94ef056ec8c577d8ade8fa273de8ed39bbe432a5558c70aed1a0dcd148>
(11)
- *A* tests/agent/test_auxiliary_url_override_anthropic_detect.py
<https://github.com/NousResearch/hermes-agent/pull/36757/files#diff-83d69c8eff1c6ac27d315c61472253a055f27dc1771ae7602ead6bf71bdeba9c>
(93)
Patch Links:
- https://github.com/NousResearch/hermes-agent/pull/36757.patch
- https://github.com/NousResearch/hermes-agent/pull/36757.diff
—
Reply to this email directly, view it on GitHub
<#36757?email_source=notifications&email_token=BVAK7EIPBQVWMDGFOMAHYRD45VT3VA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2DOOBUGGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BVAK7ENIG2G6GQO33CJJLNT45VT3VAVCNFSM6AAAAACZVOEQ6GVHI2DSMVQWIX3LMV43ASLTON2WKOZUGU3DENZXGEZDEMI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BVAK7EM6VDS4I73JW5Y7SJD45VT3VA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2DOOBUGGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/BVAK7EOF75HZ2KYTLQZ3BET45VT3VA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTOOBQGY2DOOBUGGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
mxnstrexgl
approved these changes
Jun 1, 2026
mxnstrexgl
left a comment
There was a problem hiding this comment.
🤖 Automated PR Review
Security Scan
- ✓ No hardcoded secrets, injection sinks, unsafe deserialization, or dependency red flags found by this automated scan.
Code Quality
- ✓ No blocking code-quality issues found by this automated scan.
Summary
Status: APPROVE — security findings: 0, quality suggestions: 0.
Automated review; raw diff content intentionally omitted.
Contributor
|
Thanks for isolating a real override mismatch. The proposed replacement needs one adjustment before it is safe to salvage. Problems
Suggested changes
Automated hermes-sweeper review. |
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
resolve_provider_client()inagent/auxiliary_client.pyused the raw provider-registrybase_urlwhen deciding whether to wrap the client as Anthropic-compatible. When a user overrode thebase_urlto an OpenAI-compatible endpoint (e.g. viacustom_providersor a non-Anthropic proxy), the detector still saw the registry's hard-coded/anthropicsuffix and forced the request through the Anthropic SDK, which then hit the real Anthropic endpoint with the user's key and returned401 invalid api key.Fix: use the post-override
base_urlfor endpoint-speak detection, so the wrapping decision follows the URL the request will actually hit.api_mode='anthropic_messages'remains an explicit opt-in.Reproduction
MiniMax auxiliary tasks (
title_generation,context_summary,memory_writer, etc.) returned:Root cause: the provider registry hard-codes
minimax -> https://api.minimax.io/anthropic. Even when the user supplied their ownbase_urlpointing to a different provider, the detector saw the registry's/anthropicsuffix and forced the request throughAnthropicAuxiliaryClient.Changes
agent/auxiliary_client.py— use post-overridebase_urlin_wrap_if_needed/_endpoint_speaks_anthropic_messages(1 line:raw_base_url->base_url).tests/agent/test_auxiliary_url_override_anthropic_detect.py— new regression test, 3 cases:api_mode=anthropic_messagesstill routes to Anthropic/anthropicsuffix to/v1Verification
uv run pytest tests/agent/test_auxiliary_url_override_anthropic_detect.py -v-> 3/3 passuv run pytest tests/agent/test_auxiliary_named_custom_providers.py -v-> 29/29 passtests/agent/suite were verified to be a test-isolation bug unrelated to this change (azure_foundry pollutes named_custom state; reproducing on stashed working tree confirmed it pre-dates this commit).Test plan for reviewers
Workaround for affected users (pre-merge)
Add
api_mode: chat_completionsto the relevant provider block in~/.hermes/config.yaml. This is a band-aid; the source fix is the proper resolution.