fix(chat): drop canon alias that duplicates a pairs command - #808
Merged
fathah merged 1 commit intoJul 3, 2026
Merged
Conversation
agentCommandsFromCatalog reconciles the gateway's two-part command catalog (flat `pairs` list + `canon` alias map). It filtered aliases by target but never checked whether the alias name itself was already a first-class command from `pairs`. When the backend exposes a name as both — e.g. `/compact` is a standalone TUI command and, since hermes-agent PR #57029, an alias of `/compress` — the reconciled catalog listed `/compact` in both `commands` and `aliases`. createSlashCatalog then registered it as a command and again as an alias, and registerAlias threw `Duplicate slash command alias: /compact`, crashing the app on agent connect. Skip any canon alias whose normalized name is already a pairs-derived command so the reconciled catalog stays self-consistent. The standalone command wins deterministically; createSlashCatalog's throw-on-collision validation (which guards genuine desktop-authoring conflicts) is left intact. Fixes fathah#802 Fixes fathah#804
Contributor
Greptile SummaryThis PR fixes slash command catalog reconciliation for duplicate backend names.
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(chat): drop canon alias that duplica..." | Re-trigger Greptile |
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash on agent connect:
Duplicate slash command alias: /compact.The desktop reconciles the gateway's two-part command catalog — the flat
pairscommand list and thecanonalias map — inagentCommandsFromCatalog(). When building the alias map it validated the alias's target (seen.has(target)) but never checked whether the alias name itself was already a first-class command frompairs.The backend can legitimately expose the same name as both:
/compactships as a standalone TUI command in_TUI_EXTRA→ lands inpairs./compactis also an alias of/compress→ populatescanon["/compact"] = "/compress".So the reconciled catalog listed
/compactin bothcommandsandaliases.createSlashCatalog()then registered it as a command and again as an alias, andregisterAlias()threwDuplicate slash command alias: /compact, crashing the app during the initial "getting started" flow.Fix
Skip any
canonalias whose normalized name is already apairs-derived command, so the reconciled catalog is self-consistent:The standalone command wins deterministically. I deliberately fixed this at the reconciliation source rather than loosening
createSlashCatalog's throw-on-collision check — that throw is intentional validation for genuine desktop-authoring conflicts and is covered by existing tests, so it stays intact.Verification
drops a canon alias whose name is already a standalone command) that reproduces the exact/compactscenario. It fails without this change and passes with it.npm test— full suite green except 3 pre-existing failures inConfigHealthBanner.test.tsx(localStorage.clear is not a function, a jsdom mock issue onmain), unrelated to this change.npm run lint— 0 errors; the touched files are prettier- and eslint-clean.npm run typecheck— passes.Honesty note: I verified this via the unit test that reproduces the crash path. I did not run the packaged Electron app against a live hermes-agent v0.18 backend (no paired backend in my environment), so end-to-end confirmation on-device would be welcome.
Fixes #802
Fixes #804