fix(team-mode): reject coordinator agents as subagent targets (#4027)
Agents could select coordinator/meta agents (Prometheus, Atlas, Sisyphus/Ultraworker) as subagent targets via task() / delegation, producing duplicate orchestration loops and conflicting team state. This is the inverse of #3987 / #4065 — symmetric guard on the delegation TARGET side, using the same AGENT_ELIGIBILITY_REGISTRY classification. Add a runtime guard at the delegation entry point that rejects task() calls whose subagent_type resolves to an agent marked as hard-reject / coordinator-only in the eligibility registry, with an actionable error naming the agent. Regression test asserts a prometheus-targeted delegation is rejected before any subagent session spawns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4430,8 +4430,8 @@ describe("sisyphus-task", () => {
|
||||
{ sessionID: "p", messageID: "m", agent: "sisyphus", abort: new AbortController().signal }
|
||||
)
|
||||
|
||||
//#then
|
||||
expect(result).toContain('Cannot delegate to primary agent "prometheus" via task. Select that agent directly instead.')
|
||||
//#then — coordinator guard fires before primary-agent check; message names the agent and explains the conflict
|
||||
expect(result).toContain('Cannot delegate to coordinator agent "prometheus" via task()')
|
||||
}, { timeout: 20000 })
|
||||
|
||||
test("non-plan subagent should NOT have task permission", async () => {
|
||||
|
||||
Reference in New Issue
Block a user