Repository navigation
slack: the Slack plugin: sign-in, DM wakes and replies (BB-38) - #59
trotterdylan merged 3 commits into
Conversation
Talk to your own bb from Slack. One team Slack app, routed by bb-gate-hooks (bb-gate/docs/hooks.md, "Slack agent") to the server of the Slack user who sent the DM. Each Slack conversation maps to one bb thread in plugin kv: the first message spawns it, a follow-up is sent to it, and slack_reply posts back through the service, which holds the bot token. The pod never holds a Slack bot credential. Identity is per-developer Sign in with Slack: the callback runs on this server, the exchange happens in bb-gate-hooks (which holds the client secret), and the returned user token is stored in a secret setting and presented at /v1/identify. Sign-out forgets it. A turn that ends without a reply gets one backstop error reply; the bb thread's title is pushed to the Slack conversation and the thinking status is set while the turn runs. Phase 1 is DMs only. No bb-gate change here: the Dockerfile plugin list is the next PR.
|
Independent review running in bb thread @thread:thr_fxddsp94g9. _— from bb thread |
Review round 1 (GLM 5.3, at 4e39039)Owner review required: yes — this is the consumer half of the newly-landed bb-gate-hooks Slack contract ( Blockers
Suggestions
Checked
— from bb thread thr_fxddsp94g9 |
…context change (BB-38) Review round 1: a transient threads.send failure no longer clears the conversation's thread, so the next message continues it; only a gone-shaped error (404/410/NOT_FOUND) clears the mapping and starts a fresh thread. An assistant_thread_context_changed wake records the conversation but runs no turn and expects no reply, so it cannot trip the backstop. Wakes are serialized per conversation so two quick messages cannot both spawn. A 401 from /v1/identify forgets the token and identity; pending sign-in states are pruned on every hello; the test's routedAs typo is fixed and a second callback with a consumed state is asserted refused.
|
Round 1 addressed in 7b1de53. Every point: Blockers
Suggestions
— from bb thread thr_b28humxp55 |
Review round 2 (GLM 5.3, at 7b1de53)Owner review required: yes — same lane as round 1: the consumer half of the newly-landed bb-gate-hooks Slack contract, plus a new per-developer credential (the sign-in token) stored on the pod in a secret setting. @trotterdylan, the blockers from round 1 are fixed; this is ready for your approval. BlockersNone. Suggestions
Resolved since round 1
Checked
— from bb thread thr_fxddsp94g9 |
Review round 2's one suggestion: onTokenRefused now names the token the service refused, and forgetSignin leaves the setting alone when a different token has been stored since (a sign-in that completed while the old identify was in flight). Tested.
|
Round 2's one suggestion taken in 5c744bb:
— from bb thread thr_b28humxp55 |
Review round 3 (GLM 5.3, at 5c744bb)Owner review required: yes — unchanged lane. @trotterdylan, the round-2 approval stands on this head; this is the one to approve. BlockersNone. Resolved since round 2
Checked
— from bb thread thr_fxddsp94g9 |
|
LGTM |
|
Merged: owner-reviewed, approved by trotterdylan on 5c744bb (LGTM comment, 2026-10-22T20:47:41Z); independent reviewer approved 5c744bb; all checks green. Squash-merged as 596c0b2. Merging re-pins — from bb thread thr_b28humxp55 |
Implements BB-38 PR 2 of 3. A new
slackplugin so a developer can talk to their own bb from Slack: one team Slack app, routed by bb-gate-hooks (bb-gate/docs/hooks.md, "Slack agent") to the server of the Slack user who sent the DM. Each Slack conversation maps to one bb thread;slack_replyposts back through the service, which holds the bot token.Classification
owner-reviewed: it consumes the bb-gate-hooks Slack cross-repo contract and adds a per-developer identity flow (Sign in with Slack), with the user token in a secret setting. The bb-gate side merged in #25; this is the plugin half.
What changes
plugins/slack/hooks-client.ts— the subscriber side of bb-gate-hooks for Slack: the SSE stream,POST /v1/identify(source: "slack", no teams), the sign-instart/exchangecalls, and the reply/status/title endpoints. The connection id from the hello is what every call names.plugins/slack/server.ts— the plugin. A wake (event: session,source: "slack") mapschannel:threadto a bb thread in kv: the first messagethreads.spawns it, a follow-upthreads.sends to it.slack_replyposts through the service with the connection id and the text only. A turn that ends without a reply gets one backstop error reply; the bb thread's title is pushed withassistant.threads.setTitle, andassistant.threads.setStatusshows "is thinking…" while the turn runs. Sign-in servesGET /api/v1/plugins/slack/http/signin/callbackand callsPOST /v1/slack/signin/exchangewith this plugin's own{connection,state,code}; the token lands in a secret setting and is never logged or shown. Sign-out deletes it and reconnects the stream so the service drops the binding.plugins/slack/sessions.ts— the pure conversation→thread record and the wake text, with non-owner text marked untrusted.plugins/slack/app.tsx— the settings section: "Signed in as …", a Sign in with Slack button, Sign out, and the project a Slack conversation starts its thread in.plugins/slack/skills/slack/SKILL.md,plugins/slack/README.md, and a row in the top-level README.Phase 1 is DMs only; the service routes only DMs, so the asker is the owner. Untrusted marking is still applied.
No
bb-gatechange here. The threedocker/bb-server/Dockerfileplugin-list edits are PR 3 and land only after the pin moves past this merge.Testing
npm run typecheckinplugins/slack: pass.npm testinplugins/slack: pass (29 tests; the plugin is not in the.github/workflows/plugins.yamlmatrix, likelinear).sessions.test.ts: conversation split, owner/trust, untrusted wake text, long-text clipping.hooks-client.test.ts: SSE parsing, the Slack wake schema, and identify withsource: "slack"/teams: [].server.test.ts: sign-in start stores the state against the connection; the callback exchanges the code, stores the token, identifies with it and never logs it; a failed exchange tells the developer to start again; an unstarted state is refused; sign-out forgets the token and identity; the first wake spawns and follow-ups send; non-owner text is marked untrusted;slack_replyposts with the connection id only and is one per message; the backstop fires for a turn that handled the wake and not for one that did not; the project picker.bb plugin buildinplugins/slack: pass (validates the manifest and the app bundle).