Skip to content

MiniMax switch_model credential guard test crashes on missing _fallback_chain #14864

@NewTurn2017

Description

@NewTurn2017

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt builderduplicateThis issue or pull request already existsprovider/minimaxMiniMax (Anthropic transport)type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions