slack bridge: attribute inbound human messages with the sender's name#141
Merged
Conversation
Human messages relayed from Slack into an agent's tmux session arrived with no author, so the agent could not tell who was steering it (agent-to-agent posts self-label with a "From <Agent>:" line, but a person typing in the channel does not, and bot posts are dropped before this path). The Slack sender id was available on the event but never surfaced. - routeSlackMessage now carries event.user on the deliver decision. - SlackClient.resolveUserName looks up a display name (users:read is already in the app manifest); the bridge caches it per user id. - The bridge prefixes the relayed prompt with "From <name> (Slack):" before pasting it, falling back to the unprefixed text if the lookup fails. Only human messages reach this path, so an agent's own "From <Agent>:" line is never double-labeled. Added unit coverage for the carried sender id and the prefix helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a person types in an agent's Slack channel, the bridge relays the text into the agent's tmux session with no author attached, so the agent cannot tell who is steering it. Agent-to-agent posts happen to self-label with a
From <Agent>:line (a convention in each agent's prompt), and bot posts are dropped upstream, so only human messages hit this gap, and they are exactly the ones with no attribution. The Slack sender id was already on the event; it was just never surfaced.This came up when an agent could not tell whether it was talking to one teammate or another, and defaulted to a stale identity from its environment.
Fix
routeSlackMessagecarriesevent.useron thedeliverdecision (kept pure; the id just passes through).SlackClient.resolveUserNameresolves the id to a display name viausers.info.users:readis already in the app manifest, so no scope change is needed.From <name> (Slack):before pasting. If the lookup fails, it falls back to the unprefixed text, so delivery is never blocked.Only human messages reach this path (bot posts are ignored before it), so an agent's own
From <Agent>:line is never double-labeled.Tests
routeSlackMessagecarries the sender id, andprefixAuthorlabels a message / no-ops when no name resolves.tsc --noEmitclean.e2e-tmuxreal-tmux tests fail in this sandbox (2/4), but they fail identically on a pristine checkout ofmainwith no changes, they drive thekanban sendbroadcast path this PR does not touch, and their own comment notes they need interactive tmux rendering. Unrelated to this change.🤖 Generated with Claude Code