fix: avoid Slack rich-text duplication in commands - #43533
Conversation
Slack rich_text blocks can mirror the original message text. When bang commands are rewritten from !model to /model, appending block text causes the command arguments to include a duplicate payload, so the model switcher sees spaces in the model name and rejects valid commands like: !model qwen3.7-plus --provider opencode-go Skip block extraction for slash/bang commands while preserving it for normal messages. Also preserve Slack thread_ts on native slash-command payloads when present so session-scoped commands apply to the intended thread. Adds regression coverage for both cases.
Related to #59903: this PR addresses the same command rich-text duplication, but it edits the retired |
|
✅ Verified — Slack rich-text block deduplication for commands Reviewed the diff for
The fix is correct and well-scoped. No issues found. |
|
Thanks for the focused reproduction and regression test. The underlying defect remains on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
…ad identity Slack rich_text blocks mirror the original message text. When bang commands are rewritten from !model to /model, appending block text makes the command arguments include a duplicate payload, so the model switcher sees spaces in the model name and rejects valid commands like: !model qwen3.7-plus --provider opencode-go Skip block extraction for command messages while preserving it for normal messages. Also preserve Slack thread_ts (top-level or nested in message/container payload shapes) on native slash-command payloads so session-scoped commands like /model apply to the intended thread instead of a channel+user key the next threaded message never matches. Surgical reapply of PR #43533 (originally against gateway/platforms/slack.py, now plugins/platforms/slack/adapter.py). Thread-shape widening credit also to #66310.
…ad identity Slack rich_text blocks mirror the original message text. When bang commands are rewritten from !model to /model, appending block text makes the command arguments include a duplicate payload, so the model switcher sees spaces in the model name and rejects valid commands like: !model qwen3.7-plus --provider opencode-go Skip block extraction for command messages while preserving it for normal messages. Also preserve Slack thread_ts (top-level or nested in message/container payload shapes) on native slash-command payloads so session-scoped commands like /model apply to the intended thread instead of a channel+user key the next threaded message never matches. Surgical reapply of PR #43533 (originally against gateway/platforms/slack.py, now plugins/platforms/slack/adapter.py). Thread-shape widening credit also to #66310.
|
Merged via #69479 — your commit was cherry-picked/reapplied onto current main with your authorship preserved in git history: your block-skip for commands + slash thread identity was reapplied onto the plugin adapter with your authorship. Thanks for the contribution! |
…ad identity Slack rich_text blocks mirror the original message text. When bang commands are rewritten from !model to /model, appending block text makes the command arguments include a duplicate payload, so the model switcher sees spaces in the model name and rejects valid commands like: !model qwen3.7-plus --provider opencode-go Skip block extraction for command messages while preserving it for normal messages. Also preserve Slack thread_ts (top-level or nested in message/container payload shapes) on native slash-command payloads so session-scoped commands like /model apply to the intended thread instead of a channel+user key the next threaded message never matches. Surgical reapply of PR NousResearch#43533 (originally against gateway/platforms/slack.py, now plugins/platforms/slack/adapter.py). Thread-shape widening credit also to NousResearch#66310.
What does this PR do?
Fixes a Slack gateway command parsing bug where Slack
rich_textblocks can duplicate the visible command text.For message-based bang commands such as:
Hermes rewrites the command to
/model ...so it can be handled like a normal gateway slash command. However, Slack rich-text blocks may also contain a copy of the same visible text. The Slack adapter was appending that block text to the rewritten command, so the/modelparser received duplicated/formatted content as part of the command arguments.That caused valid model-switch commands to fail with:
This PR skips Slack block extraction for slash/bang command messages while preserving block extraction for normal Slack messages, including quoted text. It also preserves
thread_tsfrom native Slack slash-command payloads when Slack provides it, so session-scoped commands apply to the intended Slack thread.Related Issue
Related: #10688
Similar symptom, different platform/root cause: #22716 / #23300
Related Slack block/bang-command context: #11426, #25355, #30592
Type of Change
Changes Made
gateway/platforms/slack.pythread_tsfrom native Slack slash-command payloads when present.tests/gateway/test_slack.py!model ... --provider ...with Slackrich_textblocks.thread_tsfrom native Slack slash-command payloads.How to Test
!model qwen3.7-plus --provider opencode-gono longer fails withModel names cannot contain spaces.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs