Skip to content

feat(bus): post activity-channel to Slack instead of never-configured Telegram - #180

Open
asachs01 wants to merge 2 commits into
mainfrom
activity-channel-slack
Open

feat(bus): post activity-channel to Slack instead of never-configured Telegram#180
asachs01 wants to merge 2 commits into
mainfrom
activity-channel-slack

Conversation

@asachs01

@asachs01 asachs01 commented Sep 8, 2026

Copy link
Copy Markdown

Summary

  • postActivity (src/bus/system.ts) now posts to Slack via SlackAPI instead of a Telegram bot that has never been configured anywhere in the fleet (verified absent 2026-08-15, 2026-09-03, 2026-09-08 — the [HUMAN] BotFather task has 6+ duplicate filings since 2026-07-16 with no progress: task_1786122601201_28151267)
  • Text-only: postApprovalToActivityChannel (src/bus/approval.ts) drops the Telegram inline Approve/Deny keyboard — Slack's equivalent needs Block Kit + inbound interactive-payload handling that isn't built yet (socket-mode.ts currently only parses events_api envelopes) — and adds a "resolve via the dashboard" line instead
  • Config shrinks to one new value: ACTIVITY_SLACK_CHANNEL_ID. Token is not a new secret — reuses SLACK_BOT_TOKEN from secrets.env, the same key the daemon's Socket Mode connection already uses
  • Wired live for wyre against #agent-ops (verified empty before adopting — conversations.create for a fresh #org-activity channel came back missing_scope: channels:manage on the available token)
  • Boss-approved: msg 1788869841715-boss-xmbgu, task task_1788869860840_01459423

Test plan

  • npx tsc --noEmit clean
  • npm run build succeeds
  • Updated unit tests (tests/unit/bus/system.test.ts, tests/unit/bus/approval.test.ts) — 73/73 passing
  • Live end-to-end: cortextos bus create-approval through the built CLI created a real approval, message verified present in #agent-ops via conversations.history, then deleted (chat.delete) and the test approval rejected — no residue left in Slack or the approvals store

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… Telegram

postActivity now targets Slack (SlackAPI.postMessage) instead of a Telegram
bot that has never been configured anywhere in the fleet (verified absent
2026-08-15, 2026-09-03, 2026-09-08 — a stuck [HUMAN] BotFather task with 6+
duplicate filings since 2026-07-16). Text-only: interactive Approve/Deny
buttons need Slack Block Kit + inbound interactive-payload handling that
isn't built yet, so postApprovalToActivityChannel drops the Telegram inline
keyboard and points operators at the dashboard instead.

Config: one new value (ACTIVITY_SLACK_CHANNEL_ID in activity-channel.env).
Token reuses SLACK_BOT_TOKEN from secrets.env, the same key the daemon's
Socket Mode connection already uses. Live-verified against wyre's #agent-ops
(adopted after conversations.create for a fresh channel came back
missing_scope: channels:manage) via a real create-approval round trip,
test message posted and deleted, test approval rejected.

Boss-approved (msg 1788869841715-boss-xmbgu), task_1788869860840_01459423.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 49b858db-81f7-46a5-a92f-1e465985e852


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@asachs01

asachs01 commented Sep 8, 2026

Copy link
Copy Markdown
Author

Reviewed. Correctness on the two call sites is solid — verified against the actual dependencies rather than trusting the diff in isolation:

  1. postActivity's catch-returns-false relies on SlackAPI.postMessage throwing on ok:false — confirmed against src/slack/api.ts's call(), which does throw slack ${method}: ${error} on !json.ok. The "Slack API call fails" test is exercising real behavior, not an untested assumption.
  2. parseEnvFile is a strict superset of the old hand-rolled parser (adds BOM/CRLF handling, quote-stripping, inline-comment-stripping) — no regression.
  3. Minor positive behavior change: the old code stopped at the first existing candidate path regardless of whether it had the target key; the new loop continues past an existing-but-keyless file to the next candidate. More correct, worth a one-line mention in the PR body since it's an actual (if small) semantic change.

On the _replyMarkup design question: remove it outright. Grepped every call site on this branch — zero callers pass a 5th argument anymore, so there's no live signature-compat need, and the current object type wouldn't help SP3c anyway (Slack Block Kit is a different shape).

One finding beyond what was asked, not a blocker given the PR's stated scope: this PR removes buildApprovalKeyboard, the only producer of appr_allow_*/appr_deny_* callback_data in the repo, but leaves the full consumer chain wired: agent-manager.ts's maybeStartActivityChannelPoller (still starts a Telegram poller on ACTIVITY_BOT_TOKEN/ACTIVITY_CHAT_ID), fast-checker.ts's handleActivityCallback (line 609, still parses the old prefix), and bus/post-activity.sh (still documents the Telegram-only flow). Per the PR's own CHANGELOG these Telegram vars were never configured fleet-wide, so this isn't a live regression — but it's now orphaned code with no possible input. Worth a follow-up cleanup task. Same family, smaller: src/cli/init.ts's org scaffold (~line 128) still writes the old ACTIVITY_CHAT_ID= key and doesn't scaffold ACTIVITY_SLACK_CHANNEL_ID.

LGTM given the stated scope — recommend filing the orphaned-inbound-chain cleanup as a separate follow-up rather than blocking this PR on it.

dev's review of #180: grepped every call site on this branch (approval.ts,
both test files) and confirmed zero callers pass a 5th arg anymore, so the
Telegram-inline-keyboard-shaped param buys nothing kept around -- Block Kit
is a different shape and SP3c will define its own param when it lands.

Also documents (code comment + CHANGELOG) a real behavior note dev caught:
the config lookups now keep searching past a candidate file that exists but
lacks the needed key, rather than stopping at the first existing file
regardless of content -- more correct than the old Telegram version, worth
naming since nobody asked for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant