From 490dcf3504ef70ee33c36069f0254ba8d1a7e8ff Mon Sep 17 00:00:00 2001 From: Vikas Singhal Date: Mon, 13 Jul 2026 14:42:58 +0530 Subject: [PATCH] fix(slack): don't reply /agent help to plain channel messages (v0.141.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A plain message in a channel the bot sits in was getting the "πŸ‘‹ Address an agent…" router help list. The Slack app subscribes to `message.channels` (needed so plain in-thread follow-ups reach thread continuity), which also delivers a `message` event for every channel post; a non-continuation one fell through to fireSlack β†’ the /agent router. The socket now only starts a fresh run on an explicit @mention (app_mention) or a DM (im/mpim). A plain channel message matters only as a thread continuation, else it's dropped silently β€” matching Discord, whose parser already ignores non-mention guild messages. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 10 ++++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/edge/slack-socket.ts | 8 ++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 611968e..220bb88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ new version heading in the same commit. ## [Unreleased] +## [0.141.2] β€” 2026-07-13 +### Fixed +- **Slack: a plain message in a channel the bot sits in no longer gets the `/agent` help list.** The app + subscribes to `message.channels` so plain in-thread follow-ups reach thread-continuity β€” but that also + delivers a `message` event for *every* channel post, and a non-continuation one fell through to + `fireSlack` β†’ the `/agent` router, which replied "πŸ‘‹ Address an agent…" to ordinary channel chatter. The + socket now only starts a fresh run on an explicit **@mention** (`app_mention`) or a **DM** (`im`/`mpim`); + a plain channel message matters only as a thread continuation, otherwise it's dropped silently. Brings + Slack to parity with Discord, whose parser already ignores non-mention guild messages. + ## [0.141.1] β€” 2026-07-13 ### Fixed - **Unattended (automation/cron/task) sessions no longer leak a live pane after they finish.** An agent that diff --git a/package-lock.json b/package-lock.json index c20c91c..cbd9d3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "agent-os", - "version": "0.141.1", + "version": "0.141.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "agent-os", - "version": "0.141.1", + "version": "0.141.2", "license": "MIT", "bin": { "agent-os": "bin/agent-os" diff --git a/package.json b/package.json index 9b123f4..64894dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agent-os", - "version": "0.141.1", + "version": "0.141.2", "description": "A generic, governed operating system for running autonomous agents safely across brands. Ships with a local web console.", "license": "MIT", "type": "commonjs", diff --git a/src/edge/slack-socket.ts b/src/edge/slack-socket.ts index 418162a..d5d7b74 100644 --- a/src/edge/slack-socket.ts +++ b/src/edge/slack-socket.ts @@ -182,6 +182,14 @@ export class SlackSocket { return; } + // Not a thread continuation. A plain channel `message` (no @mention) only reached us because the app + // subscribes to `message.channels` FOR that continuity β€” it's just chatter in a channel the bot + // happens to sit in, never a fresh trigger. Only an explicit @mention (`app_mention`) or a DM + // (`im`/`mpim`) starts a new run; otherwise drop it silently so we don't spam the `/agent` router's + // help list into the channel. (Mirrors Discord, whose parser already drops non-mention guild messages.) + const isDm = ev.channelType === 'im' || ev.channelType === 'mpim'; + if (ev.eventType !== 'app_mention' && !isDm) return; + const result = this.autos.fireSlack( { eventType: ev.eventType,