Commit ed32b28
committed
fix(session): skip synthetic delegation nudge in subagent sessions
When a user message contains an @agent part, createUserMessage injects a
synthetic text part that tells the model to call the task tool with that
subagent. In a child/subagent session the orchestrator has already written
an explicit task prompt, so injecting the nudge again causes recursive
nesting bias: the subagent re-reads the @agent mention in its own context
and tries to spawn another layer of delegation.
Guard the injection behind a parentID check so only root sessions receive
the synthetic delegation instruction.
Fixes #172021 parent dce7ece commit ed32b28
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1267 | 1267 | | |
1268 | 1268 | | |
1269 | 1269 | | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1270 | 1283 | | |
1271 | 1284 | | |
1272 | 1285 | | |
1273 | 1286 | | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
| 1287 | + | |
1279 | 1288 | | |
1280 | 1289 | | |
1281 | 1290 | | |
| |||
0 commit comments