fix(run_agent): pass reasoning_config to background review fork (#18871)#20674
Open
haosenwang1018 wants to merge 1 commit into
Open
fix(run_agent): pass reasoning_config to background review fork (#18871)#20674haosenwang1018 wants to merge 1 commit into
haosenwang1018 wants to merge 1 commit into
Conversation
Closes NousResearch#18871 ``_spawn_background_review()`` already inherits the parent agent's live runtime (model, provider, base_url, api_key, api_mode, credential_pool) when constructing the forked review ``AIAgent`` — but ``reasoning_config`` was missing. On Codex Responses transports the fork therefore fell back to the default ``{"effort": "medium", "summary": "auto"}``, so a user configured for ``xhigh`` reasoning silently got medium-effort upstream requests on every background memory/skill review pass. This is the same runtime-inheritance pattern that NousResearch#16006/NousResearch#15884/NousResearch#13076 already established for other config fields. Add ``reasoning_config=self.reasoning_config`` to the existing kwarg list on the ``AIAgent(...)`` call inside ``_spawn_background_review``. Tests: - ``test_background_review_agent_inherits_reasoning_config`` pins the configured-effort case ({"effort": "xhigh", ...} reaches the fork constructor verbatim). - ``test_background_review_agent_inherits_none_reasoning_config`` pins the no-config case (None is forwarded explicitly, not silently defaulted by the transport). - ``test_background_review_toolset_restriction.py``'s stub adds ``reasoning_config = None`` and ``_credential_pool = None`` so the spawn no longer trips on the new attribute access. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
Duplicate of #18973 — both fix the same root cause (missing |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #18871
Root cause
_spawn_background_review()constructs a forkedAIAgentwith explicit inheritance of the parent's live runtime —model,provider,api_mode,base_url,api_key,credential_pool. The same call site was missingreasoning_config.On Codex Responses transports the review fork therefore fell back to the transport default
{"effort": "medium", "summary": "auto"}, even when the parent session was configured forxhighreasoning. The user's configured effort was silently downgraded on every background memory/skill review pass — same class of bug as #16006 / #15884 / #13076 (other runtime fields that also had to be plumbed explicitly into the fork).Fix
Add
reasoning_config=self.reasoning_configto the existing kwarg list on theAIAgent(...)call inside_spawn_background_review. Single-line code change next to the existing inheritance kwargs, with an inline comment pointing at #18871 and the prior-art issues for context.Tests
tests/run_agent/test_background_review_reasoning_config.py(new):test_background_review_agent_inherits_reasoning_config— pins the configured-effort case. A parent with{"effort": "xhigh", "summary": "detailed"}must propagate that exact dict to the review fork.test_background_review_agent_inherits_none_reasoning_config— pins the unconfigured case. None must be forwarded explicitly, not silently swapped for a transport default.tests/run_agent/test_background_review_toolset_restriction.py(existing) — stub gainsreasoning_config = None+_credential_pool = Noneso the spawn site can read the new attribute without anAttributeError. No behavior change to the existing test's assertions.