fix: sub-session thinking state derived from child agent, not parent session#2149
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 18, 2026
Conversation
…session When transferring a task to a sub-agent, the child session's thinking flag was inherited from the parent session via SubSessionConfig.Thinking. This caused agents without thinking_budget (e.g. haiku) to have thinking enabled when called from an agent with thinking_budget (e.g. opus). The thinking state also leaked back to the parent via back-propagation in runSubSessionForwarding. Fix this by removing the Thinking field from SubSessionConfig entirely and deriving it inside newSubSession from childAgent.ThinkingConfigured(). This makes the correct behavior the default and eliminates the error-prone pattern where every caller had to pass the right source. For skill sub-agents (which run as the same agent and should respect the user's /think toggle), the thinking state is set as an explicit override after newSubSession returns. Also simplify handleTaskTransfer by removing a redundant agent lookup, a redundant variable alias, and unnecessary error-swallowing guards. Assisted-By: docker-agent
gtardif
approved these changes
Mar 18, 2026
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.
When transferring a task to a sub-agent, the child session's thinking flag was inherited from the parent session via
SubSessionConfig.Thinking. This caused agents withoutthinking_budget(e.g. haiku) to have thinking enabled when called from an agent withthinking_budget(e.g. opus). The thinking state also leaked back to the parent via back-propagation inrunSubSessionForwarding.Changes
Thinkingfield fromSubSessionConfigand derive it insidenewSubSessionfromchildAgent.ThinkingConfigured(). This makes the correct behavior the default and eliminates the error-prone pattern where every caller had to pass the right source./thinktoggle), the thinking state is set as an explicit override afternewSubSessionreturns.parent.Thinking = child.ThinkinginrunSubSessionForwarding.handleTaskTransferby removing a redundant agent lookup and variable alias.