Skip to content

Commit 5bbdffa

Browse files
committed
fix: skip delegation nudge in subagent sessions
When a user message contains an @agent part, createUserMessage injects a synthetic instruction telling the model to call the task tool. This nudge is intended for root sessions, but it also fires inside subagent sessions, causing recursive nesting bias: subagents that receive @agent mentions in their context interpret them as new delegation requests rather than informational references. Fix: fetch the current session in createUserMessage and skip the synthetic text injection when session.parentID is set (i.e. the session is a child of another session). The agentPart itself is still returned so the mention is preserved in the message history. Fixes #17202
1 parent c6262f9 commit 5bbdffa

1 file changed

Lines changed: 815 additions & 602 deletions

File tree

0 commit comments

Comments
 (0)