fix(gateway): resolve Telegram's underscored /commands to skill/plugin keys#5205
Closed
el-analista wants to merge 3 commits into
Closed
fix(gateway): resolve Telegram's underscored /commands to skill/plugin keys#5205el-analista wants to merge 3 commits into
el-analista wants to merge 3 commits into
Conversation
added 3 commits
April 5, 2026 09:35
…n keys Telegram's Bot API disallows hyphens in command names, so _build_telegram_menu registers /claude-code as /claude_code. When the user taps it from autocomplete, the gateway dispatch did a direct lookup against skill_cmds (keyed on the hyphenated form) and missed, silently falling through to the LLM as plain text. The model would then typically call delegate_task, spawning a Hermes subagent instead of invoking the intended skill. Normalize underscores to hyphens in skill and plugin command lookup, matching the existing pattern in _check_unavailable_skill.
…e LLM Previously, typing a /command that isn't a built-in, plugin, or skill would silently fall through to the LLM as plain text. The model often interprets it as a loose instruction and invents unrelated tool calls — e.g. a stray /claude_code slipped through and the model fabricated a delegate_task invocation that got stuck in an OAuth loop. Now we check GATEWAY_KNOWN_COMMANDS after the skill / plugin / unavailable-skill lookups and return an actionable message pointing the user at /commands. The user gets feedback, and the agent doesn't waste a round-trip guessing what /foo-bar was supposed to mean.
The warning said 'forwarding as plain text' but the code returns a user-facing error reply instead of forwarding. Describe what actually happens.
Contributor
|
Merged via PR #5288 (consolidated bugfix salvage). Your commit(s) were cherry-picked onto current main with your authorship preserved in git log. Thanks @el-analista for the fix! |
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
_build_telegram_menuregisters/claude-codeas/claude_code. When users tap it from autocomplete, the gateway's direct lookup againstskill_cmds(keyed on the hyphenated form) misses and silently falls through to the LLM as plain text — the model typically reacts by callingdelegate_task, spawning a Hermes subagent instead of invoking the intended skill._check_unavailable_skill(gateway/run.py:350).resolve_skill_command_key()helper inagent/skill_commands.pywith regression tests covering both the hyphen and underscore forms.Repro
claude-codeskill (shipped inskills/autonomous-ai-agents/claude-code/)./claude_code <anything>from Telegram autocomplete.Before: falls through to the LLM, which usually calls
delegate_task.After: resolves to the
claude-codeskill and loads it normally.Test plan
python -m pytest tests/agent/test_skill_commands.py -q— 23 passed (includes 6 new tests inTestResolveSkillCommandKey)/claude-code) still resolves directlyNoneand fall through to_check_unavailable_skill