-
-
Notifications
You must be signed in to change notification settings - Fork 53.1k
Description
Slack: /new and /reset commands broken when sent with mention
Bug Summary
In OpenClaw 2026.2.3-1, sending @raspy /new or @raspy /reset in a Slack channel does not trigger a session reset. The message is passed to the agent as regular text instead of being intercepted as a reset trigger. The /status command works fine in the same context.
Environment
- OpenClaw: 2026.2.3-1
- Channel: Slack (socket mode)
- Channel type: group channel (
#raspy_with_me) - Previously working on: 2026.2.2-3
Root Cause
The Slack channel dock in src/channels/docks.ts (bundled as sandbox-*.js) is missing the mentions property with stripPatterns for Slack's <@USERID> format.
Compare the docks:
| Channel | Has mentions.stripPatterns? |
Pattern |
|---|---|---|
| Discord | Yes | <@!?\d+> |
| Yes | E164 phone number patterns | |
| Slack | No | None |
How it breaks
- User sends
@raspy /resetin Slack - Slack delivers the message body as
<@U1234567> /reset - The reset trigger path in
initSessionState(reply.ts) callsstripMentions()on the body stripMentions()checks provider-specificstripPatternsfrom the channel dock -- but Slack has none- The generic fallback regex
/@[0-9+]{5,}/doesn't match Slack's<@U...>format strippedForResetLowerremains<@u1234567> /reset, which does NOT match the trigger/resetresetTriggeredstaysfalse, and the message goes to the agent as regular text
Why /status still works
/status has a separate code path via directive extraction (extractStatusDirective), which uses a regex (?:^|\s)\/(?:status)(?=$|\s|:) to find /status anywhere in the body text, regardless of prefix. The /new and /reset triggers don't have this fallback -- they rely solely on exact string matching after mention stripping.
Relevant Source Files
src/channels/docks.ts-- Slack dock definition (missingmentionsconfig)src/auto-reply/reply/session-state.ts--initSessionState(), reset trigger matching (~line 63340 in bundledreply-*.js)src/auto-reply/reply/strip-mentions.ts--stripMentions()functionsrc/auto-reply/reply/directives.ts--extractStatusDirective()(the working path)
Suggested Fix
Option A (preferred): Add Slack mention strip patterns to the Slack dock, consistent with Discord:
// In the Slack dock definition (src/channels/docks.ts)
slack: {
// ...existing config...
mentions: {
stripPatterns: () => ["<@[A-Z0-9]+>"], // Slack user mention format
},
}Option B (defense in depth): Also make the reset trigger matching more resilient, similar to how directive extraction works -- match the trigger anywhere after a word boundary or whitespace, not just as an exact string:
// In initSessionState (src/auto-reply/reply/session-state.ts)
// Current: exact match only
if (trimmedBodyLower === triggerLower || strippedForResetLower === triggerLower)
// Proposed: also match when preceded by mention/whitespace
if (
trimmedBodyLower === triggerLower ||
strippedForResetLower === triggerLower ||
trimmedBodyLower.endsWith(" " + triggerLower) ||
strippedForResetLower.endsWith(" " + triggerLower)
)Workaround Applied
We patched the bundled dist files directly on the Raspberry Pi:
dist/reply-DpTyb3Hh.js-- Added.endsWith(" " + triggerLower)checks to reset trigger matchingdist/loader-BAZoAqqR.js-- Same patch (duplicate code path)
These patches will be overwritten on the next openclaw update.