Repository navigation
feat(agents): put an agent in a Slack channel - #7905
Open
benjaminshafii wants to merge 1 commit into
Open
benjaminshafii wants to merge 1 commit into
benjaminshafii wants to merge 1 commit into
Conversation
Someone who manages an agent can put it in a Slack channel by the channel's id. From then on a mention of the bot in that channel belongs to the agent instead of the speaker's own assistant. The speaker is let through only when they can already use the agent under its sharing: the owner, a person it is shared with, or a member of a team or organization it is shared with. Anyone else, including a Slack user who is not linked to a member and a member of another organization, gets one private line and nothing runs. This is the routing and permission slice only. No agent turn runs from a channel yet, because a turn today always runs under a human member's credential. A speaker who is let through is told privately that agents do not answer in channels yet, and the agent's activity log records the mention with the channel id and the member, never the message. Adding or removing a channel needs the agent's owner or a manager, the Manage connections permission and a recent sign-in. A channel has one agent, and it is tied to the organization's own Slack workspace. Archiving the agent or disconnecting Slack removes its channels. No Slack scope is added and nothing is read from the Slack directory. The CLI gains `openwork agents slack list`, `add` and `remove`. Behind the agentSlackChannels flag, off by default. With it off the routes answer 404 and a stored channel is ignored. Tested with 16 new API tests against real MySQL with Slack and the model stubbed (flag off, who may bind, cross-organization and workspace conflicts, each sharing case, no access, unlinked speaker, other organization, access removed between two messages, paused agent, retried delivery, bot messages, unbound channel, unbinding, cleanup), 5 new CLI tests, the existing Slack assistant and standing chat tests, and pnpm check.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
What is this about?
An agent can be put in a Slack channel, so a mention of the OpenWork bot there goes to that agent instead of the speaker's own assistant. Off by default behind
agentSlackChannels.The agent does not answer yet. This PR ships the channel binding and the check of who may talk to it. An allowed speaker gets "Agents can't answer in Slack channels yet, so nothing was run for this message."
What problem does it solve?
A team could not give a shared agent a home in a channel. A mention always ran the speaker's personal assistant.
What was the situation before?
flowchart LR M[Bot mention in channel] --> B{Channel has an agent?} B -- no --> P[Speaker's own assistant, as before] B -- yes --> A{Speaker can use the agent?} A -- no --> R[Private refusal, no model or tool call] A -- yes --> S[Private 'not yet' line, logged on the agent]How is this implemented?
0234_personal_agent_slack_channel: one agent per workspace channel.GET|POST|DELETE /v1/personal-agents/:id/slack-channelsinroutes/personal-agents/slack-channels.ts: owner or manager of the agent, plusconnections.manageand a recent sign-in to change.slack-assistant/worker.tsaskspersonal-agents/slack-channels.tsto claim a mention. The speaker is resolved through the existing Slack-user-to-member link and checked with the agent's existing sharing: owner, people it is shared with, its teams, or the organization. Anyone else, or an unlinked Slack user, costs nothing.openwork agents slack list|add|remove.packages/features/src/flags/agent-slack-channels.ts,docs/features/agent-slack-channels/README.md.What else changed?
Release note
none
Evidence
agent-slack-channels.api.test.ts(16 tests against MySQL with Slack and the model stubbed) and the CLI tests; existing Slack assistant tests pass unchanged.