fix(agent): inherit reasoning_config in background review fork (#18871)#36995
Open
izzzzzi wants to merge 1 commit into
Open
fix(agent): inherit reasoning_config in background review fork (#18871)#36995izzzzzi wants to merge 1 commit into
izzzzzi wants to merge 1 commit into
Conversation
…esearch#18871) _run_review_in_thread now clones the parent's reasoning_config, service_tier, and request_overrides into the forked AIAgent. Without this, a parent session configured for `xhigh` effort (or `none` on thinking models) can still spawn a review that costs tokens the user explicitly opted out of — because a fresh AIAgent with reasoning_config=None falls back to a transport-local medium default on Codex Responses and Ollama routes. This matches the existing posture for enabled_toolsets / disabled_ toolsets: every runtime field the parent carries should be cloned, not just the ones the review path explicitly enumerates. 7 new tests lock the contract: each of the three fields passes through verbatim, None propagates (not absent — that would re-introduce the bug), and pre-existing fields still clone correctly.
Collaborator
|
Duplicate of #27510, which applies the same fix in the same post-refactor location ( |
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.
Summary
Fix for issue #18871 (open).
_run_review_in_thread(agent/background_review.py) now clones the parent'sreasoning_config,service_tier, andrequest_overridesinto the forkedAIAgent.Without this, a parent session configured for
xhigheffort (ornoneon thinking models) could still spawn a review that costs tokens the user explicitly opted out of — because a freshAIAgentwithreasoning_config=Nonefalls back to a transport-localmediumdefault on Codex Responses and Ollama routes.Changes
agent/background_review.py: Added 3 kwargs to the review fork'sAIAgentconstructor:reasoning_config,service_tier,request_overrides. Each usesgetattr(agent, ...)for backward compatibility with parents that don't carry these fields.tests/run_agent/test_background_review_reasoning_inheritance.py: 7 new tests locking the contract:Testing
Related