Skip to content

fix(delegate-task): apply getAgentConfigKey normalization to isPlanAgent#3330

Open
codeg-dev wants to merge 1 commit intocode-yeongyu:devfrom
codeg-dev:fix/isplan-display-name-getAgentConfigKey
Open

fix(delegate-task): apply getAgentConfigKey normalization to isPlanAgent#3330
codeg-dev wants to merge 1 commit intocode-yeongyu:devfrom
codeg-dev:fix/isplan-display-name-getAgentConfigKey

Conversation

@codeg-dev
Copy link
Copy Markdown
Contributor

@codeg-dev codeg-dev commented Apr 11, 2026

Summary

isPlanFamily was already fixed (in a previous commit) to normalize display names via getAgentConfigKey(), but isPlanAgent still used raw agentName.toLowerCase() without normalization.

This PR applies the same fix to isPlanAgent for consistency and correctness.

Changes

src/tools/delegate-task/constants.ts

  • isPlanAgent: normalize agentName through getAgentConfigKey() before comparison (same as isPlanFamily)

src/tools/delegate-task/tools.test.ts

  • Fix misleading test title: "returns true for 'planner' (matches via includes('plan'))" → describes the old bug, but assertion was already false. Corrected to "returns false for 'planner' (no longer matches via substring)"
  • Add regression test for isPlanAgent with Metis/Momus/Atlas display names (all should return false)
  • Add regression test for isPlanFamily with Metis/Momus/Atlas display names (all should return false)

Root Cause (from #3312)

Four agents have "(Plan ...)" or "- Plan ..." in their display names:

Config key Display name
atlas "Atlas - Plan Executor"
metis "Metis - Plan Consultant"
momus "Momus - Plan Critic"
prometheus "Prometheus - Plan Builder"

Without getAgentConfigKey() normalization, display names containing "plan" as a substring could produce false-positives, and display names for legitimate plan-family agents (prometheus) would fail to match.

Testing

bun test src/tools/delegate-task/tools.test.ts --filter 'isPlan'
# 129 pass, 0 fail

Fixes #3312


Summary by cubic

Normalize agent names in isPlanAgent using getAgentConfigKey to avoid display-name mismatches and keep behavior consistent with isPlanFamily. Fixes #3312.

  • Bug Fixes
    • Apply getAgentConfigKey normalization in isPlanAgent before comparing to PLAN_AGENT_NAMES.
    • Correct test title for "planner" (returns false; no substring match).
    • Add regression tests to ensure Metis/Momus/Atlas display names are not treated as plan or plan-family.

Written for commit 23d1257. Summary will update on new commits.

isPlanFamily was already fixed to normalize display names via getAgentConfigKey,
but isPlanAgent still used raw agentName.toLowerCase() without normalization.

Apply the same fix to isPlanAgent for consistency.

Also fixes test title: 'returns true for planner' was describing the OLD
includes-based behavior (the bug), but the assertion already expected false.
Add regression tests covering Metis/Momus/Atlas display names for both functions.

Fixes code-yeongyu#3312
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Standardizes agent name normalization using getAgentConfigKey to ensure consistency and correct matching of display names, supported by new regression tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: isPlanFamily() substring matching false-positives Atlas/Metis/Momus display names

1 participant