fix(auxiliary): support minimax oauth providers - #23639
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating a real auxiliary-provider routing gap: current main still sends oauth_minimax through the unhandled-auth-type fallback at agent/auxiliary_client.py:5112-5117.
Problems
- The proposed resolver call uses the static-token default and the surrounding branch coerces it with
str(). MiniMax OAuth requiresas_token_provider=Trueso the client receives a callable that refreshes short-lived tokens per request (hermes_cli/auth.py:7759-7791). - The surrounding auxiliary routing was refactored. Current Anthropic transport correction is
_maybe_wrap_anthropic()atagent/auxiliary_client.py:1487-1568; callable API keys are supported bybuild_anthropic_client()atagent/anthropic_adapter.py:744-750. - The test freezes
MiniMax-M2.7-highspeed, but the current OAuth profile default isMiniMax-M2.7(plugins/model-providers/minimax/__init__.py:82-93).
Suggested changes
- Salvage the branch into the current provider-resolution path with
as_token_provider=True, preserving the callable through the Anthropic wrapper. - Test an explicit model and callable-token/Anthropic-wrapper propagation rather than a mutable provider default.
Automated hermes-sweeper review.
| @@ -2979,7 +2980,10 @@ def _wrap_if_needed(client_obj, final_model_str: str, base_url_str: str = "", | |||
| final_model = _normalize_resolved_model(model or default_model, provider) | |||
| return (_to_async_client(client, final_model, is_vision=is_vision) if async_mode else (client, final_model)) | |||
There was a problem hiding this comment.
Please resolve MiniMax credentials with as_token_provider=True and preserve the resulting callable rather than flowing it into the following str(...) coercion. Current hermes_cli/auth.py:7759-7791 documents that this is required to refresh MiniMax's short-lived OAuth access token per request.
| }, | ||
| ), patch("agent.auxiliary_client.OpenAI", return_value=fake_client) as mock_openai: | ||
| client, model = resolve_provider_client("minimax-oauth") | ||
|
|
There was a problem hiding this comment.
Avoid asserting a provider-default model literal here: current minimax-oauth declares MiniMax-M2.7 at plugins/model-providers/minimax/__init__.py:82-93. Pass an explicit model and assert the OAuth callable reaches the current Anthropic transport path instead.
What does this PR do?
Supports MiniMax auxiliary providers that authenticate with
oauth_minimaxby resolving runtime OAuth credentials instead of treating them as unsupported non-API-key providers.Related Issue
Fixes #21521
Type of Change
Changes Made
agent/auxiliary_client.pysoresolve_provider_client()acceptsoauth_minimaxresolve_minimax_oauth_runtime_credentials()instead of the generic API-key helpertests/agent/test_auxiliary_client.pycovering the MiniMax OAuth pathHow to Test
uv run --frozen --extra dev pytest -q -o addopts='' tests/agent/test_auxiliary_client.py -k minimax_oauthuv run --frozen ruff check agent/auxiliary_client.py tests/agent/test_auxiliary_client.pyresolve_provider_client("minimax-oauth")builds the OpenAI-compatible client with the OAuth-derived token and base URLChecklist
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/AScreenshots / Logs
1 passed, 154 deselectedruff checkpassed