gateway: handle /start as welcome + command list + home-channel status#11640
Open
sosasays wants to merge 1 commit into
Open
gateway: handle /start as welcome + command list + home-channel status#11640sosasays wants to merge 1 commit into
sosasays wants to merge 1 commit into
Conversation
Every Telegram bot must respond to /start as the mandatory first- contact message. Previously hermes-agent returned the generic "unknown command" notice because /start was absent from COMMAND_REGISTRY and the gateway dispatch table. Changes: - hermes_cli/commands.py: register start as a gateway-only slash command. - gateway/run.py: dispatch /start to a new _handle_start_command handler. Handler behavior: 1. Returns a structured markdown welcome listing /sethome, /status, /help with short descriptions. 2. Reads the current home channel from ~/.hermes/config.yaml (same file /sethome writes to); falls back to environment. 3. If no home channel is set: appends a prompt to run /sethome. 4. If a home channel IS set and the user is in a different chat: acknowledges the bot is active and reports the existing home. 5. If the user is in the home channel: confirms that. Idempotent and safe to invoke any time. Bug discovered during a production Hermes-Quant deploy. The handler was verified in staging (direct-call smoke test covered all three code paths; live Telegram round-trip confirmed correct responses in all five scenarios).
This was referenced May 5, 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.
What
Register
/startas a slash command and add a handler. Without this,/startfalls through to the generic"unknown command"notice, which breaks standard Telegram bot first-contact UX (every bot must respond to/start).Why
Every Telegram bot receives
/startas the mandatory first message from a new user. hermes-agent already recognizes/sethome,/status,/help, etc. but not/start— so first-contact responses feel broken and users are unclear whether the bot is alive. Discovered during a production Hermes-Quant deploy.Changes
hermes_cli/commands.py: add oneCommandDef("start", …, "Session", gateway_only=True)entry toCOMMAND_REGISTRYso/startis recognized everywhere the registry feeds (GATEWAY_KNOWN_COMMANDS, help text, TelegramBotCommandsmenu, Slack subcommand mapping, etc.).gateway/run.py:if canonical == "start": return await self._handle_start_command(event)next to the/sethomedispatch._handle_start_command(self, event: MessageEvent) -> strthat:/sethome,/status,/help.~/.hermes/config.yaml(same key/sethomewrites to:{PLATFORM}_HOME_CHANNEL); falls back to the process environment./sethome.Idempotent; safe to invoke any time.
Tests
Direct-call smoke covered all three code paths of the handler.
Live Telegram round-trip on a production gateway verified all five scenarios:
/startfrom the home channel → correct "this chat is home" response./startfrom a different chat → correct "home is already set elsewhere" response./startwith no home set → correct "run /sethome to receive digests" prompt./helpstill works (unchanged upstream handler)./statusstill works (unchanged upstream handler)./sethomein a different chat correctly reassigns + reverts cleanly.Import smoke:
from hermes_cli.commands import COMMAND_REGISTRY, GATEWAY_KNOWN_COMMANDS; 'start' in GATEWAY_KNOWN_COMMANDS→Trueimport gateway.runcompiles clean (Python 3.11)Downstream status
Our production deploy will run on canonical upstream and accept the "unknown command" reply for
/startuntil this merges. Documented as a known issue pointing at this PR.Made with Cursor