Skip to content

fix(auxiliary): support minimax-oauth in auxiliary client router (fixes #21521, #36091)#40122

Open
ubxty wants to merge 1 commit into
NousResearch:mainfrom
ubxty:fix/minimax-oauth-auxiliary-client
Open

fix(auxiliary): support minimax-oauth in auxiliary client router (fixes #21521, #36091)#40122
ubxty wants to merge 1 commit into
NousResearch:mainfrom
ubxty:fix/minimax-oauth-auxiliary-client

Conversation

@ubxty

@ubxty ubxty commented Jun 5, 2026

Copy link
Copy Markdown

Problem

Hermes users with minimax-oauth as their main provider see this on every CLI session:

⚠ Auxiliary title generation failed: HTTP 401: Invalid Authentication

The same root cause breaks kanban specify and any other auxiliary task that doesn't pin a fallback provider.

Root cause

hermes_cli/auth.py:301 declares MiniMax OAuth with auth_type="oauth_minimax". agent/auxiliary_client.py dispatches on pconfig.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

  1. Add "oauth_minimax" to the OAuth provider dispatch gate (1 line).
  2. Add a minimax-oauth case in the provider switch that delegates to a new builder, _build_minimax_oauth_aux_client() (12 lines).
  3. The builder 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 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 right inference_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 — swallowed AuthError returns (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 an OpenAI client in AnthropicAuxiliaryClient and 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.
  • End-to-end repro: call_llm(task='title_generation', ...) returns a real title (no HTTP 401, no 'unhandled auth_type' warning).

Notes

  • The fix makes minimax-oauth work for ALL auxiliary tasks, not just title generation. The default model is the one registered on the provider profile (MiniMax-M2.7 per plugins/model-providers/minimax/__init__.py).
  • AnthropicAuxiliaryClient already accepts a callable api_key (the bearer-hook machinery in agent/anthropic_adapter.py calls it per-request), so no upstream changes to the wrapper are needed.

Fixes #21521, #36091

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have provider/minimax MiniMax (Anthropic transport) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] unhandled auth_type oauth_minimax warning on auxiliary providers

2 participants