feat(slack-relay): router reacts :eyes: to each message it routes
What
The Slack router now acknowledges every message it routes to an agent with an :eyes: reaction, as soon as it takes the message and before the agent starts.
- Where:
Router.fromSlack(step 0). This runs before the per-thread queue and before the orchestrator. Every message that reaches it is one the router routes, because the Socket Mode handler has already dropped ignored ones (plain channel chatter, replies in threads it doesn't hold, bot messages and edits, DMs whenslack.allowDmsis off, disallowed or shared channels). Those get no reaction. - Fire-and-forget: routing never waits on
reactions.addand never fails because of it.already_reactedis ignored. Any other failure logs only Slack's error code (ack reaction failed for C…:<ts> (<code>)), never the message text. missing_scope: logged once (ack reaction off: the bot token lacks reactions:write (add reactions:write and reinstall the app)). After that the router stops trying and routes as before.- Value:
slack.ackReaction: eyes(envSLACK_ACK_REACTION). Set it to empty to turn the reaction off. - Scope:
reactions:writeis added tomanifest/slack-app-manifest.json, sorender-manifest.pypicks it up. It is also listed in the docs.SlackWebnow throwsSlackApiErrorwith a.code. The error message is unchanged.
Existing installs
Add reactions:write under OAuth & Permissions, Bot Token Scopes, then Reinstall to Workspace. Until then the router logs the line above once and routes as normal. This is documented in docs/self-hosted-slack-relay.md.
Versions
slack-relay 0.3.11, agent-relay 0.7.50. The merge order is #441 (slack-relay 0.3.10, agent-relay 0.7.48), then #442 (agent-relay 0.7.49), then this PR, which will rebase onto main once they land. The registry (self-hosted/requirements.yaml) gains slack-relay-0.3.11 and agent-relay-0.7.50 as current, and the opt.slack-relay.channels option now covers slack.ackReaction. The doc is regenerated.
Tests
test/ack.test.ts:
- A routed mention, a reply in its thread and an allowed DM each get :eyes:.
- Ignored messages get no reaction: plain chatter, a reply in an untracked thread, a bot message, an edit.
ackReaction: ""turns it off, and a custom name is used.missing_scopeis logged once, not retried, and routing continues.already_reactedstays silent, and other errors log the code only.- A reaction that never settles, throws synchronously or hits a network error does not block or fail routing.
SlackWeb.addReactionpostsreactions.addand surfaces Slack's error code.
Local runs: npm run typecheck and npm test pass. scripts/ci/charts.sh static, scripts/ci/version-bump.sh, registry.mjs check and ci/agent-relay/render.sh pass. No image was built.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
The Slack router now requests an :eyes: reaction on each message it routes to an agent, as soon as it takes the message; routing never waits on it, so the reaction usually shows before the agent starts but can land later or fail without affecting the answer.
- Ignored messages (chatter, replies in untracked threads, bot messages, edits) get no reaction.
already_reactedis silent; other failures log only Slack's error code, never the message text.- A token missing
reactions:writeis logged once and the router stops trying until restarted. - Configurable via
slack.ackReaction(envSLACK_ACK_REACTION), defaulteyes; empty turns it off. SlackWebnow throwsSlackApiErrorwith a.code.
Migration
- Existing installs must add
reactions:writeunder Bot Token Scopes, reinstall the app, and move to a slack-relay image from chart 0.3.11 or later, then restart the router (kubectl -n agent-relay rollout restart deployment -l app.kubernetes.io/name=slack-relay,app.kubernetes.io/component=router). - Bumps
slack-relayto 0.3.11 andagent-relayto 0.7.50.