#19164: fix(discord): dedupe native skill commands across agents by skill name
size: XS
Cluster:
Skill Enhancements and Fixes
## Summary
- follow-up to #17365
- de-duplicate skill native command specs across agents/workspaces by canonical `skillName` before Discord registration
- keep unique skills intact; only drop true duplicates that currently surface as suffixed variants (for example `_2`)
## Why
`skillName` duplicates can still enter the final native command set when multiple agents/workspaces expose the same skill. That can lead to suffixed command variants being registered on Discord depending on ordering/reconciliation.
## Changes
- `src/auto-reply/skill-commands.ts`
- added `seenSkillNames` tracking in `listSkillCommandsForAgents`
- skip duplicate entries when the same normalized `skillName` is encountered again
- `src/auto-reply/skill-commands.test.ts`
- updated expectations to assert duplicate skill command variants are not emitted
## Validation
- `pnpm exec vitest run --config vitest.unit.config.ts src/auto-reply/skill-commands.test.ts src/discord/monitor/provider.skill-dedupe.test.ts`
- both test files pass
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR moves skill command deduplication from the Discord provider layer to the core `listSkillCommandsForAgents` function. By tracking seen skill names (normalized to lowercase) during command collection, it prevents duplicate skill commands with `_2` suffixes from being created in the first place, rather than filtering them out later at the Discord registration stage.
<h3>Confidence Score: 5/5</h3>
- Safe to merge with no issues found
- The implementation is clean and correct, moves deduplication to an earlier and more logical place in the pipeline, includes proper test coverage with updated assertions, and follows the existing code patterns
- No files require special attention
<sub>Last reviewed commit: 9c66eaf</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14991: fix(telegram): deduplicate skill commands by skillName to prevent B...
by smartchainark · 2026-02-12
87.1%
#12076: fix(skills): recursive directory filtering to actually exclude venv...
by xiaoyaner0201 · 2026-02-08
78.6%
#17062: fix(telegram): prioritize workspace skills over bundled in native c...
by scout-wolfe · 2026-02-15
78.0%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
77.5%
#23749: fix some issues
by tronpis · 2026-02-22
77.3%
#22198: fix(skills): treat empty allowBundled array as block-all
by haitao-sjsu · 2026-02-20
75.8%
#19707: fix(agents): apply per-agent skills filter to all run paths
by mcaxtr · 2026-02-18
75.1%
#21839: fix(skills): allowBundled: [] now blocks all bundled skills
by hydro13 · 2026-02-20
74.8%
#11240: Fix #10875: Clear Telegram commands before registering to prevent d...
by divol89 · 2026-02-07
74.2%
#15115: fix: pre-load skill docs in cron sessions to prevent hallucinated syn…
by joaolcorreia · 2026-02-13
74.1%