fix(auxiliary): support minimax-oauth in auxiliary client router (fixes #21521, #36091) - #40122
fix(auxiliary): support minimax-oauth in auxiliary client router (fixes #21521, #36091)#40122ubxty wants to merge 1 commit into
Conversation
…uter
Auxiliary client dispatcher (title generation, compression, vision,
session_search, …) gated the OAuth provider branch on
{auth_type in {'oauth_device_code', 'oauth_external'}}, but
minimax-oauth is declared in hermes_cli/auth.py with
auth_type='oauth_minimax'. The call fell through to the generic
'unhandled auth_type' warning and returned (None, None), causing
title generation to fail with HTTP 401 at the end of every session
(NousResearch#21521) and breaking kanban specify and
other auxiliary tasks that pin a fallback provider (NousResearch#36091).
Add 'oauth_minimax' to the dispatch gate and a new
_build_minimax_oauth_aux_client() that mirrors _try_anthropic() —
MiniMax's inference endpoint is Anthropic-API compatible — but
installs build_minimax_oauth_token_provider() as a per-request
callable api_key, so MiniMax's 15-minute access-token TTL is
auto-refreshed (same pattern as the main runtime in
agent_runtime_helpers.py:1460). Adds four tests covering happy
path, main-model fallback, not-logged-in, and a regression guard
against the previous fix attempt (PR NousResearch#35539) that wrapped an
OpenAI client in AnthropicAuxiliaryClient.
Refs NousResearch#21521, NousResearch#36091
|
Thanks for tracing the missing MiniMax OAuth auxiliary route. The premise still holds on current Problems
Suggested changes
Automated hermes-sweeper review. |
|
Salvaged this contribution onto current |
Salvage the confirmed premise and contributor authorship from NousResearch#40122 on current main. Resolve minimax-oauth before the generic ProviderConfig dispatch, using resolve_minimax_oauth_runtime_credentials(as_token_provider=True) so auxiliary and MoA calls preserve the callable refresh path and persisted region-specific inference URL. Build the third-party Anthropic Messages transport with native Claude Code OAuth transforms disabled: MiniMax bearer authentication comes from the callable token provider, while is_oauth=True is reserved for native Anthropic identity and tool-name rewriting. Add regression coverage for callable-token propagation, regional URL propagation, request-shape guarding, and missing-login handling. Refs NousResearch#21521, NousResearch#36091, NousResearch#40122
Problem
Hermes users with
minimax-oauthas their main provider see this on every CLI session:⚠ Auxiliary title generation failed: HTTP 401: Invalid Authentication
The same root cause breaks
kanban specifyand any other auxiliary task that doesn't pin a fallback provider.Root cause
hermes_cli/auth.py:301declares MiniMax OAuth withauth_type="oauth_minimax".agent/auxiliary_client.pydispatches onpconfig.auth_type, but the OAuth provider branch was gated on{"oauth_device_code", "oauth_external"}—"oauth_minimax"was not in the set. The call therefore fell through to the generic warning at the bottom of the resolver and returned(None, None).Fix
"oauth_minimax"to the OAuth provider dispatch gate (1 line).minimax-oauthcase in the provider switch that delegates to a new builder,_build_minimax_oauth_aux_client()(12 lines)._try_anthropic()— MiniMax's inference endpoint is Anthropic-API compatible — but installsbuild_minimax_oauth_token_provider()as a per-request callableapi_key, so MiniMax's 15-minute access-token TTL is auto-refreshed on every outbound request. Same pattern the main runtime uses (agent/agent_runtime_helpers.py:1460).Tests
Four new tests in
TestMiniMaxOAuthAuxiliaryClient:test_resolve_minimax_oauth_dispatches_to_anthropic_compat— happy path, asserts the builder is called with the rightinference_base_url.test_resolve_minimax_oauth_uses_main_model_when_empty— universal fallback chain (Step 3 main-model) still works when no model is passed and there is no catalog default.test_resolve_minimax_oauth_returns_none_when_not_logged_in— swallowedAuthErrorreturns(None, None)so the chain falls through to its next provider.test_builder_uses_anthropic_sdk_not_openai— regression guard for the previous fix attempt (PR fix: resolve minimax-oauth auxiliary client routing #35539) that wrapped anOpenAIclient inAnthropicAuxiliaryClientand crashed at runtime.Verification
pytest tests/agent/test_auxiliary_client.py— 211 passed.pytest tests/agent/test_minimax_provider.py tests/agent/test_minimax_auxiliary_url.py tests/plugins/model_providers/test_minimax_profile.py— 276 passed total.call_llm(task='title_generation', ...)returns a real title (no HTTP 401, no 'unhandled auth_type' warning).Notes
minimax-oauthwork for ALL auxiliary tasks, not just title generation. The default model is the one registered on the provider profile (MiniMax-M2.7perplugins/model-providers/minimax/__init__.py).AnthropicAuxiliaryClientalready accepts a callableapi_key(the bearer-hook machinery inagent/anthropic_adapter.pycalls it per-request), so no upstream changes to the wrapper are needed.Fixes #21521, #36091