fix(auxiliary_client): route minimax-oauth through the auxiliary path - #40263
Closed
rgoza1996 wants to merge 1 commit into
Closed
fix(auxiliary_client): route minimax-oauth through the auxiliary path#40263rgoza1996 wants to merge 1 commit into
rgoza1996 wants to merge 1 commit into
Conversation
The auxiliary client in `agent/auxiliary_client.py` resolves provider clients for background tasks like title generation, compression, web extract, mcp, skills_hub, approval, and triage_specifier. The OAuth branch in `resolve_provider_client` only handled `oauth_device_code` and `oauth_external`, so providers with the custom `auth_type="oauth_minimax"` fell through to the catch-all warning: WARNING agent.auxiliary_client: resolve_provider_client: unhandled auth_type oauth_minimax for minimax-oauth …and the title generator then emitted the misleading diagnostic: Title generation failed: Provider 'minimax-oauth' is set in config.yaml but no API key was found. Set the MINIMAX-OAUTH_API_KEY environment variable, or switch to a different provider with `hermes model`. The env-var hint is wrong — `MINIMAX-OAUTH_API_KEY` is for the api_key variant of MiniMax, not the OAuth one. The actual credential is in `~/.hermes/auth.json` and the main agent reads it fine via `resolve_minimax_oauth_runtime_credentials`; the auxiliary path just never asked. The fix mirrors the existing `xai-oauth` branch (which was added with the same reasoning in ab2472e): a dedicated `provider == "minimax-oauth"` branch in `resolve_provider_client` that builds an `AnthropicAuxiliaryClient` against MiniMax's `/anthropic` endpoint. MiniMax's Anthropic-compatible endpoint is in `_ANTHROPIC_COMPAT_PROVIDERS` (line 4740), so the right transport is the Anthropic Messages API wrapped via `build_anthropic_client`, not an OpenAI client. Two small improvements over a minimal port: 1. `as_token_provider=True` — the OAuth access token is short-lived, so the resolver returns a zero-arg callable that mints a fresh token per request. Long aux sessions (compression in particular) no longer risk failing mid-call when the access token expires. 2. The new branch's comment block explains the user-visible symptom (silent re-routing to fallback + misleading "no API key" diagnostic) so the next person reading the resolver can see why the branch exists without re-deriving the bug. Smoke-tested against a live `minimax-oauth` login in the `.hermes/hermes-agent` venv: title generation returns a real title in ~5s, no `unhandled auth_type` warnings, no `no API key` diagnostic. `_build_minimax_oauth_aux_client` returns an `AnthropicAuxiliaryClient` wrapping the real Anthropic client.
Collaborator
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.
The auxiliary client in
agent/auxiliary_client.pyresolves provider clients for background tasks like title generation, compression, web extract, mcp, skills_hub, approval, and triage_specifier. The OAuth branch inresolve_provider_clientonly handledoauth_device_codeandoauth_external, so providers with the customauth_type="oauth_minimax"fell through to the catch-all warning:WARNING agent.auxiliary_client: resolve_provider_client: unhandled
auth_type oauth_minimax for minimax-oauth
…and the title generator then emitted the misleading diagnostic:
Title generation failed: Provider 'minimax-oauth' is set in
config.yaml but no API key was found. Set the MINIMAX-OAUTH_API_KEY
environment variable, or switch to a different provider with
hermes model.The env-var hint is wrong —
MINIMAX-OAUTH_API_KEYis for the api_key variant of MiniMax, not the OAuth one. The actual credential is in~/.hermes/auth.jsonand the main agent reads it fine viaresolve_minimax_oauth_runtime_credentials; the auxiliary path just never asked.The fix mirrors the existing
xai-oauthbranch (which was added with the same reasoning in ab2472e): a dedicatedprovider == "minimax-oauth"branch inresolve_provider_clientthat builds anAnthropicAuxiliaryClientagainst MiniMax's/anthropicendpoint. MiniMax's Anthropic-compatible endpoint is in_ANTHROPIC_COMPAT_PROVIDERS(line 4740), so the right transport is the Anthropic Messages API wrapped viabuild_anthropic_client, not an OpenAI client.Two small improvements over a minimal port:
as_token_provider=True— the OAuth access token is short-lived, so the resolver returns a zero-arg callable that mints a fresh token per request. Long aux sessions (compression in particular) no longer risk failing mid-call when the access token expires.The new branch's comment block explains the user-visible symptom (silent re-routing to fallback + misleading "no API key" diagnostic) so the next person reading the resolver can see why the branch exists without re-deriving the bug.
Smoke-tested against a live
minimax-oauthlogin in the.hermes/hermes-agentvenv: title generation returns a real title in ~5s, nounhandled auth_typewarnings, nono API keydiagnostic._build_minimax_oauth_aux_clientreturns anAnthropicAuxiliaryClientwrapping the real Anthropic client.What does this PR do?
Related Issue
Fixes #
Type of Change
Changes Made
How to Test
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/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs