Summary
ensureAuth() recognizes MINIMAX_API_KEY and returns early, but the request path later calls resolveCredential(), which never reads the environment variable. As a result, setting MINIMAX_API_KEY can pass the initial auth gate and still fail with No credentials found on the first API request.
Reproduction
MINIMAX_API_KEY=sk-xxxxx mmx quota show --output json
The environment key is detected by src/auth/setup.ts, but it is absent from the resolution order in src/auth/resolver.ts.
Expected behavior
MINIMAX_API_KEY should work end-to-end as an authentication source with a documented precedence relative to --api-key, OAuth credentials, and the config-file API key. Region detection should also account for the environment key where applicable.
Suggested coverage
- resolve a credential from
MINIMAX_API_KEY
- verify precedence against
--api-key, OAuth, and config-file credentials
- cover non-interactive command execution through the real request path
- confirm region detection behavior for environment-provided keys
Related: #185, #189.
Summary
ensureAuth()recognizesMINIMAX_API_KEYand returns early, but the request path later callsresolveCredential(), which never reads the environment variable. As a result, settingMINIMAX_API_KEYcan pass the initial auth gate and still fail withNo credentials foundon the first API request.Reproduction
The environment key is detected by
src/auth/setup.ts, but it is absent from the resolution order insrc/auth/resolver.ts.Expected behavior
MINIMAX_API_KEYshould work end-to-end as an authentication source with a documented precedence relative to--api-key, OAuth credentials, and the config-file API key. Region detection should also account for the environment key where applicable.Suggested coverage
MINIMAX_API_KEY--api-key, OAuth, and config-file credentialsRelated: #185, #189.