Skip to content

feat(channels): run Slack, Discord and Telegram on the AgentController (foreman-uz3j) - #57

Merged
hamchowderr merged 2 commits into
mainfrom
claude/channels-controller
Oct 22, 2026
Merged

hamchowderr merged 2 commits into
mainfrom
claude/channels-controller

Conversation

@hamchowderr

@hamchowderr hamchowderr commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Requested by Chowderr · project thread

This is part 2 of 3 of the channels split that replaces #54. It is stacked on #55 and moves to main once #55 merges. CI only runs on PRs into main, so it runs then.

Before: Slack, Discord and Telegram called agent.generate() directly, which caused four problems:

  • Gated actions, including every Zapier write, stalled with no way to answer them.
  • Runs were capped at 5 steps, and there were no schedules or subagents.
  • The Discord bot stopped responding 24 hours after each deploy.
  • /link broke the DM it was typed in.

After: all three run on the Foreman AgentController, the same engine as the web chat:

  • Gated actions post Approve / Deny buttons on every platform, and Zapier writes always ask.
  • Schedules, subagents and plan mode work, and memory is shared with the web chat.
  • The Discord Gateway reconnects on its own.
  • /link moves earlier channel conversations onto the linked account.

How

  • src/channels/controller-channels.ts builds the controller's channels config, adding only the platforms that have credentials:
    • The sender's Foreman user owns each channel thread.
    • Each channel thread gets one Session in its own scope, and only the thread's owner can use it.
    • Every message and click stamps the user and workspace on the run.
    • Core's default cards display is kept, which keeps the approval buttons; a test guards this.
  • src/channels/relink.ts moves threads after /link, and isChannelOnlyUser is added to lib/identity.ts.
  • The old /slack|/discord|/telegram/webhook paths forward to the Mastra-generated routes.
  • webhook-server.ts and the inbox worker stop hosting these three, so no message is answered twice. dev:telegram is removed because polling now starts with the agent server.
  • New Slack OAuth installs load into the live adapter.

The old bot modules stay in place but unused; #58 removes them and updates the docs. This PR adds about 940 lines, roughly half of them tests. The controller config, the /link handling and the hosting switch only work together, so they stay in one PR.

Checks run locally: tsc is clean, lint is clean with no new warnings, and npm test shows 578 passed and 10 skipped.

Beads: foreman-uz3j


🤖 Generated with Claude Code

https://claude.ai/code/session_01T3R2sPwBzA2bpj3HT2BDv2

…r (foreman-uz3j)

The three channel bots called agent.generate() directly, so tool approvals had
no way to be shown or answered (every Zapier write stalled), runs were capped
at 5 steps, there were no schedules or subagents, Chat SDK state was in
memory, the Discord Gateway stopped after 24 hours, and /link broke the DM it
was typed in.

They now run on the Foreman AgentController's channels, the same engine as
the web chat:
- one Session per channel thread, owned by the sender's Foreman user (memory
  shared with web), in its own registry scope so it never touches the web
  session; only the thread's owner can use it or answer its approval cards
- the sender's user id and workspace are stamped on every run and click
- Approve/Deny buttons on every platform (core's "cards" display); the same
  auto-allowed tools as web, Zapier writes always ask
- Postgres-backed Chat SDK state; the Discord Gateway reconnects on its own
- /link moves the sender's earlier channel threads onto the linked account
- the old /slack|/discord|/telegram/webhook paths forward to the generated
  routes; the :4112 webhook server and the inbox worker stop hosting these
  three, and dev:telegram goes (polling starts with the agent server)
- new Slack OAuth installs load into the live adapter

The old bot modules are now unused; the next change removes them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3R2sPwBzA2bpj3HT2BDv2
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foreman Ready Ready Preview Oct 22, 2026 5:37pm UTC

Request Review

@hamchowderr
hamchowderr force-pushed the claude/channels-link-codes branch from e0b0537 to 0cc521e Compare October 20, 2026 14:07
@hamchowderr
hamchowderr force-pushed the claude/channels-controller branch from d440f0e to c121273 Compare October 20, 2026 14:07
@hamchowderr hamchowderr changed the title feat(channels): run Slack, Discord and Telegram on the AgentController feat(channels): run Slack, Discord and Telegram on the AgentController (foreman-uz3j) Oct 20, 2026
@hamchowderr
hamchowderr changed the base branch from claude/channels-link-codes to main October 22, 2026 17:36
@hamchowderr
hamchowderr marked this pull request as ready for review October 22, 2026 17:36
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T17:36:45.806778Z
We couldn’t complete this review. Comment @codex review to try again.
c121273 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hamchowderr
hamchowderr merged commit 59c9a96 into main Oct 22, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — db0f7f88 Deployed Oct 22, 2026 by vercel[bot]
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.

2 participants