fix-up(#4027): narrow coordinator guard to registry hard-reject set

Maintainer feedback (#4071 review): the original guard rejected
sisyphus and atlas as subagent targets even from team-mode where
resolveMember() intentionally calls resolveSubagentExecution with
allowPrimaryAgentDelegation: true. Per AGENT_ELIGIBILITY_REGISTRY
(src/features/team-mode/types.ts), only prometheus is hard-reject;
sisyphus and atlas are explicitly verdict: 'eligible' for team
membership.

Shrink COORDINATOR_AGENT_NAMES to ['prometheus'] so the guard
aligns with the registry's authoritative classification, document
the scoping rule in a comment, and add regression tests covering:

- sisyphus is NOT blocked by the coordinator guard (registry eligible)
- atlas is NOT blocked by the coordinator guard (registry eligible)
- prometheus IS blocked even when allowPrimaryAgentDelegation: true
  (registry hard-reject is authoritative)

Fixes the 5 zauc-mocks resolver tests that were locking in the
wrong rejection set (including 'allows delegating to a primary
agent when allowPrimaryAgentDelegation is enabled'). The one test
asserting the literal primary-agent error string for Prometheus
display-name was loosened to a regex that accepts either guard's
message, since prometheus is now caught by the coordinator path
which fires before the primary-agent lookup.
This commit is contained in:
ZeyuFu
2026-05-16 05:34:04 -04:00
parent 7af3007e67
commit 860c663c80
3 changed files with 70 additions and 2 deletions
+7 -1
View File
@@ -352,9 +352,15 @@ export function isPlanFamily(category: string | undefined): boolean {
* arbitrary subagent targets via task(). Delegating to these creates duplicate
* orchestration and conflicting team state (issue #4027).
*
* Scoped to AGENT_ELIGIBILITY_REGISTRY hard-reject entries only — sisyphus and atlas
* are explicitly marked `verdict: "eligible"` for team membership in the registry
* (src/features/team-mode/types.ts), so they are NOT included here. Adding them would
* conflict with the team-mode resolver's intentional `allowPrimaryAgentDelegation: true`
* opt-in.
*
* Symmetric guard to the caller-eligibility check added by PR #4065 for team_create.
*/
export const COORDINATOR_AGENT_NAMES = ["prometheus", "atlas", "sisyphus"]
export const COORDINATOR_AGENT_NAMES = ["prometheus"]
/**
* Returns true when the given agent name refers to a coordinator/meta agent that