Repository navigation
feat(chat): "Inbox + Slack" for "Notify me when an agent needs me", and keep other notices' e-mail with it - #2269
Merged
Conversation
… (API) Part of ansvisor#2139 (N1). Server only; the card comes next. - A brand's Slack is one more sign-in in the Account's pool (integration_accounts, provider `slack`, labelled with the workspace's name from auth.test), used through brand_integrations as a brand's own Google login is. Its channel and the four send switches (Pulse, drops, daily suggestion, agents that need someone) live in the row's settings. - Composio: Slack's install through the Slackbot toolkit's auth config (COMPOSIO_SLACK_AUTH_CONFIG_ID: Ansvisor's own Slack app, or Composio's managed one as a fallback). Slack is called through Composio's proxy (proxyRequest now POSTs a JSON body), so the bot token stays with Composio and Slack's own codes and Retry-After come back. - lib/slack/api.js: slackGet / slackPost, every failure a SlackError with a code only. lib/slack/connection.js: the brand's Slack, where it stands (not connected, refused, access lost, connected), channels page by page, the test message (blocks/connected.js). - routes/slack.js under /api/slack/brands/:brandId: read for anyone who can access the brand; connect, activate, use another brand's workspace, channels, PUT channel and switches, test message, disconnect for admins and managers. Writes but Disconnect need the plan's slack_notifications. A workspace whose connector can't see the brand isn't offered or posted to. Slack refusing the connection marks the sign-in; a channel that is gone is cleared. The demo brand connects nothing. - A brand's settings on a sign-in start over when it uses another one. - Plans: slack_notifications (Starter, Growth, Enterprise, self-hosted) and slack_approvals (Growth, Enterprise, self-hosted), in both plan files. - Demo and read-only guards, slackLimiter, /api/integrations/config's `slack`, env docs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The web opens the plan dialog on error plan_limit; the routes said it only in code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
… in Chat's Connections Part of ansvisor#2139 (N2), on the Slack API (N1). - Settings › Integrations › Team and alerts › Slack, for the active brand: Connect Slack (Slack's install in a popup, polled until active), Use the same workspace as…, the workspace and who connected it, a searchable channel picker (listed when it opens, or at once while none is picked), four switches for what goes to Slack, Send a test message, Disconnect. Reconnect, Paused (the connector can't see the brand) and Pick a channel say what's wrong. Members see where messages go; the demo brand shows sample data and opens the plan dialog; so do a read-only workspace and a plan without Slack. - Chat › Connections: Slack is a live tool of the Team group ("sends messages"), read from the brand's sign-in in the pool, opening #slack. - Strings in en.json; Help: settings/slack (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Part of ansvisor#2139 (N3), on the Slack connection (N1). - lib/slack/deliver.js: one message to a brand's channel, through every check: Slack set up, not the demo brand, a connected workspace, a channel, the kind turned on, a plan with Slack notifications (every paid plan, trial included; self-host always), and a connector who can still see the brand. Kept in slack_posts before it is sent (unique per brand and dedupe key), so it goes once. Posts to one channel are spaced by 1.1 s; a 429 is tried once more after Retry-After (up to 30 s), a 5xx, timeout or lost call after 2 s. Slack refusing the workspace marks it for a reconnect; a channel that is gone, or the app was removed from, is cleared. Logs carry codes only, and it never throws. - The Pulse's Slack leg, after its e-mail and webhook legs: the e-mail's numbers, highlights and warnings in Block Kit (blocks/pulse.js), worded only when it goes, with links to Visibility and the Pulse settings. It follows the brand's Pulse frequency. sent_pulses.slack_sent records it, apart from the other legs. - Migration 00515: slack_posts (server only, no policy) and sent_pulses.slack_sent; schema.sql rebuilt; the demo skips it. - The test message now says only what is posted: the Daily Pulse. - The Pulse's platform names and signed numbers move to pulse/format.js, shared by the e-mail and Slack. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The card now stacks on the Daily Pulse in Slack (N3), the one thing its switches post for now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Part of ansvisor#2139 (N2). The card shows what is posted today: the channel, the test message and the Daily Pulse (N3). The settings keep the four send kinds; the drop alerts, the daily suggestion and agents that need someone each add their switch (SLACK_SHOWN_KINDS), strings and Help with their server send. - en.json: the card and Chat's Connections say the Daily Pulse only. - Help: settings/slack describes connecting, the channel, the test message and when the Pulse is posted (its frequency in Notifications); reports/daily-pulse says the Pulse can also go to Slack, and Off stops that too. approved-articles.json regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
ansvisor#2259 was squash-merged, so its file came back as an add/add conflict: this branch's connected.js is kept (its test message names the Daily Pulse only). schema.sql is rebuilt with 00510 and 00515. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Brings in upstream/main through feature/slack-pulse: ansvisor#2259 (squash-merged) and the MCP OAuth PRs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…rop beyond normal swing (W2-18) Part of ansvisor#2139 (N4), on the Slack card (ansvisor#2264). - lib/slack/drops.js: after a brand's full daily run, the last 7 complete days against the 7 before (explain_change's default), from chat_why_cells, on the prompts tracked in both weeks only (the stable cells, on the engines tracked in both; ChatGPT Shopping left out). Visibility and the citation rate fall beyond normal swing when the drop is more than 2 x its standard error, Why did it move's rule (web lib/chat/why/explain.ts), ported and kept in step. At most one alert per metric per brand per 7 days (slack_posts, sent ones). Read only for a brand that posts drop alerts to a channel; posted through deliver.js; never throws. - blocks/drop.js: what fell, from what to what, normal swing, the days and engines, Ask Chat why (where the new Chat is on) and Open Visibility. - The card shows the "Drops beyond normal swing" switch; the test message names the kinds the brand will get (POSTED_KINDS); the card, its member line and Chat's Connections speak of the Pulse and alerts. - Help: settings/slack gets "Drop alerts". - Also: the Pulse's notification text escapes the brand's name for Slack. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…W2-24) Part of ansvisor#2139 (N5), on the drop alerts (N4). - lib/slack/suggestion.js: when the daily suggestions job writes a brand's first suggestions of the day, the channel gets one: the action most of its people were suggested, ties by its rank, then its wait. Once a day: none while one was posted in the last 20 hours, one per UTC day by its dedupe key. Posted through deliver.js; never throws. - Its words are the Action Center's: the web words the action (POST /api/internal/slack/suggestion, CRON_SECRET, reads only); when it can't, nothing is posted and the next hour tries again. - blocks/suggestion.js: the title and description, priority, days waiting, category, and Open in Action Center. - The card shows the "Daily suggestion" switch; the test message names it. - Help: settings/slack gets "Daily suggestion". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…nd keep other notices' e-mail with it Part of ansvisor#2139 (N6), on the daily suggestion (N5). - When an agent's run waits for its person and they chose Inbox + Slack, the run's brand's Slack channel gets a message that mentions them (their Slack account found by e-mail, users.lookupByEmail; else named), with Open the run, once per run and person (lib/slack/needs-you.js, through deliver.js). A brand that doesn't post them, or a post that fails, sends the e-mail instead. tell() takes that Slack leg (chat-notices/go-live.js). - Fix: Inbox + Slack sent no e-mail for the notices Slack doesn't carry (an agent went live, go-live turned off, the own key failing or at its limit). Every pick but Inbox only gets them now (wantsEmail). - Chat settings: Inbox + Slack opens once a brand the person can see posts "needs you" to a channel, on a plan with Slack (general-settings.ts); its note says what it does. - The card shows the "Agents that need someone" switch: all four kinds are posted now. The test message names it. - Help: chat/chat-settings (approved; approved-articles.json regenerated) and settings/slack. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
dismissed
gkhngyk’s stale review
November 10, 2026 10:38
The merge-base changed after approval.
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.
Summary
Stacked on #2268 (daily suggestion,
feature/slack-suggestion), which is stacked on #2267, #2264 and #2263. Merge those first; until then this diff also shows theirs. This is plan N6: "Inbox + Slack" opens, with the e-mail fix that has to ship with it."Needs you" in Slack (
lib/slack/needs-you.js): when an agent's run waits for its person and they chose Inbox + Slack, the run's brand's channel gets a message instead of the e-mail.users.lookupByEmail; the app asks forusers:read.email). When none is found, the message names them instead.needs_you:{run}:{person}), throughdeliver.js.deliver.js).E-mail fallback: the person gets the e-mail instead when the brand doesn't post these (no Slack, no channel, the switch off, or a plan without Slack), or when the post fails.
tell()inchat-notices/go-live.jsnow takes this Slack leg; only "needs you" uses it.Fix: e-mails Inbox + Slack used to drop.
inbox_slackgot no e-mail for four notices: "an agent went live", "go-live turned off", "own key failing" and "own key at its limit".wantsEmail, inown-key.js,own-key-limit.jsandgo-live.js).Chat settings:
general-settings.ts).Card: the Agents that need someone switch. All four kinds are posted now, so the card shows every switch, and the test message names them.
Help:
help/chat/chat-settings.md(approved) gets the new "Notify me when an agent needs me" text;approved-articles.jsonis regenerated.help/settings/slack.mdgets "Agents that need someone".No migration: 00408 already allows
inbox_slack.Overlap:
web/messages/en.jsonis shared with the main account's "Open here" work. This PR changes only the notify row's note there, and doesn't touchchat-settings.tsx.Related issue
Part of #2139.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/slack/needs-you.test.js src/lib/chat-notices src/routes/slack.test.js. The tests cover:cd web && yarn vitest run src/lib/chat/general-settings.test.ts src/components/chat/chat-settings.test.tsx src/components/settings/slack-card.test.tsx src/lib/help.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.mdAlso run on this branch (d4c712c), which contains N4 and N5 and merges cleanly into current
main:format:checkandlintpass.npm test: 450 files, 6,219 passed, 4 skipped.format:checkandtypecheckpass;linthas 0 errors; its 9 warnings are all in files this stack doesn't touch;yarn test: 1,065 files, 11,667 passed, 1 skipped;yarn buildwith CI's placeholder env passes, including N5's new internal route.Generated by Claude Code