Skip to content

fix: pass base_url and api_key to background review AIAgent#15884

Open
Kailigithub wants to merge 1 commit into
NousResearch:mainfrom
Kailigithub:fix/issue-15882-background-review-base-url
Open

fix: pass base_url and api_key to background review AIAgent#15884
Kailigithub wants to merge 1 commit into
NousResearch:mainfrom
Kailigithub:fix/issue-15882-background-review-base-url

Conversation

@Kailigithub

Copy link
Copy Markdown
Contributor

Problem

_spawn_background_review() creates a background review AIAgent without passing base_url or api_key. When the main agent uses a custom or fallback provider (e.g. OpenRouter, Cerebras, SiliconFlow), the review agent cannot:

  1. Look up per-model context overrides from custom_providers (which requires base_url to match)
  2. Query custom endpoint /models APIs for context length detection

This causes the review agent to fall through to live API detection, which may return the model's real context window and trigger the MINIMUM_CONTEXT_LENGTH (64K) guard — silently killing the review thread.

Fix

Pass base_url and api_key through to the review AIAgent constructor so it inherits the same provider configuration as the main agent.

Testing

  • python3 -m py_compile run_agent.py — passes
  • python3 -m pytest tests/run_agent/test_background_review_summary.py -v — 8/8 passed
  • Verified the fix is present via inspect.getsource(AIAgent._spawn_background_review)

Closes #15882

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #15645 — same fix for #15543 (forward base_url/api_key to background review AIAgent).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_spawn_background_review doesn't pass base_url / api_key — context length detection fails for custom/fallback endpoints

3 participants