Skip to content

feat(talon): add Discord channel adapter - #5992

Open
Mike Merrill (linted) wants to merge 3 commits into
mainfrom
mmerrill/talon/discord-channel-adapter
Open

feat(talon): add Discord channel adapter#5992
Mike Merrill (linted) wants to merge 3 commits into
mainfrom
mmerrill/talon/discord-channel-adapter

Conversation

@linted

Copy link
Copy Markdown

Summary

  • Adds a Discord channel adapter to deepagents_talon (talon), built on discord.py's Gateway client, following the same architectural pattern as the existing Telegram/WhatsApp adapters.
  • Full feature parity: text/media send and receive, typing indicator, message edit, reactions, exposure/allowlist gating, and session persistence.
  • Outbound text over Discord's 2000-character limit is split into multiple separate messages sent in order (not truncated).
  • Wires --discord into the CLI/host factory and documents setup (including the required Message Content privileged intent) in libs/talon/README.md.

Test plan

  • uv run --group test pytest (full libs/talon suite, includes new tests/channels/test_discord.py)
  • uv run --group test ruff check .
  • uv run --group test ty check (clean aside from 2 pre-existing unrelated errors in tests/test_observability.py, confirmed present on main independent of this change)
  • Manual smoke test with a real Discord bot token (DM round-trip, media attachment, reaction)

Adds a Discord channel using the discord.py Gateway client, mirroring
the Telegram adapter's shape: text/media send and receive, typing,
edit, reactions, and exposure/allowlist gating. Outbound text over
Discord's 2000-character limit is split into multiple messages sent
in order.
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

ℹ️ Project README edits acknowledged via the readme: acknowledged label.

  • libs/talon/README.md

Remove the label to re-enable the block.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: XL 1000+ LOC talon labels Aug 30, 2026
@socket-security

socket-security Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​discord-py@​2.7.196100100100100

View full report

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 2 potential issues.

Open in WebView Open SWE trace

Comment thread libs/talon/deepagents_talon/channels/discord.py
Comment thread libs/talon/deepagents_talon/channels/discord.py

@corridor-security corridor-security Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Discord channel adapter lacks a self-message guard: the bot's own replies are fed back into Talon's message handler, enabling an unbounded agent invocation loop that any allowed user can trigger.

Comment thread libs/talon/deepagents_talon/channels/discord.py
… 3.12

discord.py's voice-playback module unconditionally imports the deprecated
stdlib audioop module even though talon never uses Discord voice features,
which fails CI under this package's warnings-as-errors pytest config.
@linted Mike Merrill (linted) added the readme: acknowledged Acknowledge intentional project README edits in a non-docs PR label Aug 30, 2026
Discord's Gateway redelivers the bot's own outbound messages through
on_message; the from_self metadata flag was treated as an admitted
sender (a case meant for Telegram/WhatsApp operator-device messages),
so every reply looped back into a new agent invocation. Drop
self-authored messages before exposure checks in every mode.

Also fix a startup race in the gateway connect wait: on the normal
success path the readiness task wins FIRST_COMPLETED, leaving the
actual gateway task in `pending` -- which then got cancelled right
after marking the adapter connected, killing the receive loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization readme: acknowledged Acknowledge intentional project README edits in a non-docs PR size: XL 1000+ LOC talon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant