Bug
tests/agent/test_minimax_provider.py::TestMinimaxSwitchModelCredentialGuard::test_switch_to_minimax_does_not_resolve_anthropic_token fails on the current default branch before it can assert the MiniMax credential behavior.
Affected files/lines
tests/agent/test_minimax_provider.py:330-343 builds a partial AIAgent via __new__ with AIAgent.__init__ patched out.
run_agent.py:2052-2057 assumes self._fallback_chain exists when switch_model() prunes fallback providers after a provider switch.
Evidence / minimal reproduction
From /Users/genie/.hermes/hermes-agent with source venv/bin/activate:
python -m pytest tests/agent/test_minimax_provider.py::TestMinimaxSwitchModelCredentialGuard::test_switch_to_minimax_does_not_resolve_anthropic_token -q -n 0 --tb=short
Actual result:
E AttributeError: 'AIAgent' object has no attribute '_fallback_chain'
run_agent.py:2054
A larger chunk run also reproduced it:
1 failed, 563 passed, 1 skipped
Why this is a bug
The regression test is intended to guard that switching to MiniMax does not call resolve_anthropic_token() and does not leak Anthropic credentials to a third-party Anthropic-compatible endpoint. A newer fallback-pruning path now crashes first when the test uses a minimally constructed AIAgent, so the credential guard is no longer being exercised by CI.
Expected vs actual
- Expected:
switch_model() completes in this test, resolve_anthropic_token() is not called, and build_anthropic_client() receives the MiniMax API key.
- Actual:
switch_model() raises AttributeError while reading self._fallback_chain.
Suggested investigation direction
Either initialize the fallback fields in this test fixture (_fallback_chain, _fallback_model, etc.) to match the real __init__ invariants, or make switch_model() defensively handle missing fallback attributes if direct/minimally initialized callers are intended to be supported.
Bug
tests/agent/test_minimax_provider.py::TestMinimaxSwitchModelCredentialGuard::test_switch_to_minimax_does_not_resolve_anthropic_tokenfails on the current default branch before it can assert the MiniMax credential behavior.Affected files/lines
tests/agent/test_minimax_provider.py:330-343builds a partialAIAgentvia__new__withAIAgent.__init__patched out.run_agent.py:2052-2057assumesself._fallback_chainexists whenswitch_model()prunes fallback providers after a provider switch.Evidence / minimal reproduction
From
/Users/genie/.hermes/hermes-agentwithsource venv/bin/activate:Actual result:
A larger chunk run also reproduced it:
Why this is a bug
The regression test is intended to guard that switching to MiniMax does not call
resolve_anthropic_token()and does not leak Anthropic credentials to a third-party Anthropic-compatible endpoint. A newer fallback-pruning path now crashes first when the test uses a minimally constructedAIAgent, so the credential guard is no longer being exercised by CI.Expected vs actual
switch_model()completes in this test,resolve_anthropic_token()is not called, andbuild_anthropic_client()receives the MiniMax API key.switch_model()raisesAttributeErrorwhile readingself._fallback_chain.Suggested investigation direction
Either initialize the fallback fields in this test fixture (
_fallback_chain,_fallback_model, etc.) to match the real__init__invariants, or makeswitch_model()defensively handle missing fallback attributes if direct/minimally initialized callers are intended to be supported.