fix(delegate-task): block self-delegation to prevent infinite recursion
Adds generic self-recursion guard in subagent-resolver using getAgentConfigKey() to normalize display names and config keys. Catches athena-junior spawning itself — the only subagent with task() access not already covered by existing guards.
This commit is contained in:
@@ -60,6 +60,14 @@ Create the work plan directly - that's your job as the planning agent.`,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parentAgent && getAgentConfigKey(agentName) === getAgentConfigKey(parentAgent)) {
|
||||||
|
return {
|
||||||
|
agentToUse: "",
|
||||||
|
categoryModel: undefined,
|
||||||
|
error: `Cannot spawn "${agentName}" from within itself. Self-delegation creates infinite recursion. Use category-based delegation to spawn a Sisyphus-Junior worker instead (e.g., category="quick" or category="deep").`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let agentToUse = agentName
|
let agentToUse = agentName
|
||||||
let categoryModel: DelegatedModelConfig | undefined
|
let categoryModel: DelegatedModelConfig | undefined
|
||||||
let fallbackChain: FallbackEntry[] | undefined = undefined
|
let fallbackChain: FallbackEntry[] | undefined = undefined
|
||||||
|
|||||||
@@ -530,6 +530,7 @@ describe("executeSyncContinuation - toast cleanup error paths", () => {
|
|||||||
task: false,
|
task: false,
|
||||||
call_omo_agent: false,
|
call_omo_agent: false,
|
||||||
question: false,
|
question: false,
|
||||||
|
switch_agent: false,
|
||||||
write: false,
|
write: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
})
|
})
|
||||||
@@ -600,6 +601,7 @@ describe("executeSyncContinuation - toast cleanup error paths", () => {
|
|||||||
task: false,
|
task: false,
|
||||||
call_omo_agent: false,
|
call_omo_agent: false,
|
||||||
question: false,
|
question: false,
|
||||||
|
switch_agent: false,
|
||||||
write: false,
|
write: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user