Skip to content

fix: sub-session thinking state derived from child agent, not parent session#2149

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/i-have-a-yaml-with-two-agents-one-uses-o-2e1b1b77
Mar 18, 2026
Merged

fix: sub-session thinking state derived from child agent, not parent session#2149
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/i-have-a-yaml-with-two-agents-one-uses-o-2e1b1b77

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 17, 2026

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.

Changes

  • Remove the Thinking field from SubSessionConfig and derive 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.
  • Remove back-propagation of parent.Thinking = child.Thinking in runSubSessionForwarding.
  • Simplify handleTaskTransfer by removing a redundant agent lookup and variable alias.

…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
@dgageot dgageot requested a review from a team as a code owner March 17, 2026 15:38
docker-agent[bot]

This comment was marked as outdated.

@dgageot dgageot merged commit d309f27 into docker:main Mar 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants