Skip to content

fix(agent): forward reasoning_config to background review AIAgent fork#18973

Open
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/18871-background-review-reasoning-config
Open

fix(agent): forward reasoning_config to background review AIAgent fork#18973
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/18871-background-review-reasoning-config

Conversation

@nftpoetrist

@nftpoetrist nftpoetrist commented May 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

`_spawn_background_review()` in `run_agent.py` (line ~3611) inherits the parent session's `provider`, `model`, `base_url`, `api_key`, and `api_mode` when forking a review agent. `reasoning_config` was not forwarded.

On Codex Responses routes the missing field causes the forked review agent to fall back to the transport default (`medium` effort), so a session configured for `agent.reasoning_effort: xhigh` still generates medium-effort background review requests — wasting budget and ignoring the user's explicit preference.

One-line fix in `_spawn_background_review()` — passes `reasoning_config=self.reasoning_config`. When `reasoning_config` is `None` the behaviour is identical to before: harmless no-op for sessions without a reasoning override. Symmetric with the `api_mode`, `base_url`, and `api_key` fields that #16006 and #15884 already propagate on the same fork path.

Related Issue

Fixes #18871

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests
  • ♻️ Refactor
  • 🎯 New skill

Changes Made

  • `run_agent.py`: add `reasoning_config=self.reasoning_config` to `AIAgent(...)` in `_spawn_background_review()` (+1 line)
  • `tests/run_agent/test_background_review.py`: add `reasoning_config = None` to `_bare_agent()` helper; add `test_background_review_inherits_reasoning_config` parametrized over `None`, `{"effort": "xhigh"}`, and `{"enabled": False}` (+49 lines)

How to Test

```bash
python3.11 -m pytest tests/run_agent/test_background_review.py -v --override-ini="addopts="
```

Checklist

Code

  • Contributing Guide read
  • Conventional Commits
  • No duplicate PR
  • Single logical change only
  • pytest passing
  • Tests added
  • Platform: macOS

Documentation & Housekeeping

  • Docs updated — N/A
  • cli-config.yaml.example — N/A
  • CONTRIBUTING.md/AGENTS.md — N/A
  • Cross-platform impact — N/A
  • Tool descriptions — N/A

_spawn_background_review() (run_agent.py line ~3611) inherits the parent
session's provider, model, base_url, api_key, and api_mode — but not
reasoning_config. On Codex Responses routes the forked review agent
falls back to the transport default (medium effort), so a session
configured for agent.reasoning_effort: xhigh still generates medium-
effort background review requests.

Fix: pass reasoning_config=self.reasoning_config to the AIAgent
constructor in _spawn_background_review(). When reasoning_config is
None the behaviour is identical to before — harmless no-op for sessions
without a reasoning override. Symmetric with the api_mode/base_url/api_key
fields that NousResearch#16006 and NousResearch#15884 already propagate on the same fork path.

Fixes NousResearch#18871
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.

Background review agents ignore reasoning_config and fall back to medium

2 participants