Bug Description
The API server platform (gateway/platforms/api_server.py) never passes fallback_model to AIAgent(), so the fallback chain is always empty when requests come through the OpenAI-compatible API endpoint. Fallback works correctly on all other platforms (Telegram, Discord, Slack, etc.).
Steps to Reproduce
- Configure
fallback_providers in ~/.hermes/config.yaml
- Connect Open WebUI (or any OpenAI-compatible client) to the API server at
localhost:8642/v1
- Send a message while the primary provider is rate-limited
- Observe: retries exhaust, fallback attempt silently does nothing, request fails
Expected Behavior
API server should fall back to the configured fallback_providers chain, same as Telegram/Discord/Slack.
Actual Behavior
_try_activate_fallback() returns False immediately because _fallback_chain is empty — fallback_model was never passed to the AIAgent constructor.
Affected Component
API server platform (gateway/platforms/api_server.py)
Hermes Version
v0.7.0 (2026.4.3)
Root Cause Analysis
In api_server.py, _create_agent() constructs AIAgent without fallback_model:
# api_server.py ~line 432
agent = AIAgent(
model=model,
**runtime_kwargs,
...
session_db=self._ensure_session_db(),
# fallback_model is missing here
)
Compare with gateway/run.py which correctly passes fallback_model=self._fallback_model at lines 4005, 4179, and 5816.
Proposed Fix
Load the fallback config in _create_agent() and pass it through. Either import GatewayApp._load_fallback_model() or replicate the simple yaml load inline.
Bug Description
The API server platform (
gateway/platforms/api_server.py) never passesfallback_modeltoAIAgent(), so the fallback chain is always empty when requests come through the OpenAI-compatible API endpoint. Fallback works correctly on all other platforms (Telegram, Discord, Slack, etc.).Steps to Reproduce
fallback_providersin~/.hermes/config.yamllocalhost:8642/v1Expected Behavior
API server should fall back to the configured
fallback_providerschain, same as Telegram/Discord/Slack.Actual Behavior
_try_activate_fallback()returnsFalseimmediately because_fallback_chainis empty —fallback_modelwas never passed to theAIAgentconstructor.Affected Component
API server platform (
gateway/platforms/api_server.py)Hermes Version
v0.7.0 (2026.4.3)
Root Cause Analysis
In
api_server.py,_create_agent()constructs AIAgent withoutfallback_model:Compare with
gateway/run.pywhich correctly passesfallback_model=self._fallback_modelat lines 4005, 4179, and 5816.Proposed Fix
Load the fallback config in
_create_agent()and pass it through. Either importGatewayApp._load_fallback_model()or replicate the simple yaml load inline.