Skip to content

fix(mattermost): accept leading-space slash commands - #59127

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-31b455a5
Jul 5, 2026
Merged

fix(mattermost): accept leading-space slash commands#59127
teknium1 merged 2 commits into
mainfrom
hermes/hermes-31b455a5

Conversation

@teknium1

@teknium1 teknium1 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Slash commands now work for Mattermost mobile users: leading-space command messages ( /new) are normalized before command classification. Root cause: Mattermost mobile blocks sending messages that start with / and suggests prefixing a space, but the adapter's bare startswith("/") check treated " /new" as plain text (#25184).

Salvage of #32210 by @l0h1nth — cherry-picked onto current main with authorship preserved. Duplicate cluster: #21070 (@MinJaeLee1, same fix submitted first but against the old pre-move gateway/platforms/mattermost.py path) and #29842 (broader whitespace-stripping approach that alters normal-text semantics).

Changes

  • plugins/platforms/mattermost/adapter.py: lstrip leading whitespace only when the stripped text starts with /, right before command classification (+2 lines)
  • tests/gateway/test_mattermost.py: 2 tests — leading-space command classified as COMMAND, leading-space normal text preserved verbatim
  • scripts/release.py: AUTHOR_MAP entry for l0h1nth

Validation

Before After
" /new" (DM) TEXT, command ignored COMMAND, get_command() == "new"
" hello" (DM) TEXT, " hello" TEXT, " hello" (unchanged)
tests/gateway/test_mattermost.py 60/60 pass

E2E: real MattermostAdapter._handle_ws_event() with actual WS posted payloads against isolated HERMES_HOME — 5/5 cases pass including " /status arg" multi-space and bare /stop.

Fixes #25184. Closes #32210, #21070, #29842.

Infographic

mattermost-leading-space-slash

@teknium1
teknium1 merged commit 2f2e608 into main Jul 5, 2026
31 checks passed
@teknium1
teknium1 deleted the hermes/hermes-31b455a5 branch July 5, 2026 21:42
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists labels Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mattermost mobile users are unable to send commands.

2 participants