Summary
_spawn_background_review in run_agent.py creates the review AIAgent with only model and provider, omitting base_url and api_key. This means the review agent cannot look up per-model context overrides from custom_providers (which requires base_url to match) and cannot query custom endpoint /models APIs for context length detection.
Affected code
run_agent.py — _spawn_background_review → _run_review():
review_agent = AIAgent(
model=self.model,
max_iterations=8,
quiet_mode=True,
platform=self.platform,
provider=self.provider,
parent_session_id=self.session_id,
# ← base_url and api_key missing
)
Impact
When the main agent is on a fallback provider (e.g. openrouter, cerebras, siliconflow), the background review agent:
- Cannot resolve
custom_providers[].models.<model>.context_length (step 0 in get_model_context_length) because get_custom_provider_context_length returns None when base_url is empty
- Falls through to live API detection, which may return the real model context window — triggering the
MINIMUM_CONTEXT_LENGTH (64K) guard and raising ValueError, killing the review thread silently
Observed symptom
⚠ Auxiliary background review failed: Model minimax/minimax-m2.5:free has a context window of 32,768 tokens, which is below the minimum 64,000 required by Hermes Agent.
The main agent was using minimax/minimax-m2.5:free as a fallback. The review agent correctly detected 32K from OpenRouter's live API — but the configured context_length override was never consulted because base_url was absent.
Proposed fix
review_agent = AIAgent(
model=self.model,
max_iterations=8,
quiet_mode=True,
platform=self.platform,
provider=self.provider,
base_url=getattr(self, "base_url", ""),
api_key=getattr(self, "api_key", ""),
parent_session_id=self.session_id,
)
Environment
- hermes-agent (main branch, 2026-04-26)
- Triggered when primary model rate-limits and fallback provider is activated before a background review fires
Summary
_spawn_background_reviewinrun_agent.pycreates the reviewAIAgentwith onlymodelandprovider, omittingbase_urlandapi_key. This means the review agent cannot look up per-model context overrides fromcustom_providers(which requiresbase_urlto match) and cannot query custom endpoint/modelsAPIs for context length detection.Affected code
run_agent.py—_spawn_background_review→_run_review():Impact
When the main agent is on a fallback provider (e.g.
openrouter,cerebras,siliconflow), the background review agent:custom_providers[].models.<model>.context_length(step 0 inget_model_context_length) becauseget_custom_provider_context_lengthreturnsNonewhenbase_urlis emptyMINIMUM_CONTEXT_LENGTH(64K) guard and raisingValueError, killing the review thread silentlyObserved symptom
The main agent was using
minimax/minimax-m2.5:freeas a fallback. The review agent correctly detected 32K from OpenRouter's live API — but the configuredcontext_lengthoverride was never consulted becausebase_urlwas absent.Proposed fix
Environment