Skip to content

[codex] Add Discord read tools#4677

Open
orangebread wants to merge 2 commits into
NousResearch:mainfrom
orangebread:feat/discord-read-tools
Open

[codex] Add Discord read tools#4677
orangebread wants to merge 2 commits into
NousResearch:mainfrom
orangebread:feat/discord-read-tools

Conversation

@orangebread

@orangebread orangebread commented Apr 3, 2026

Copy link
Copy Markdown

Summary

Adds three read-only Discord tools scoped by explicit allowlists:

  • discord_list_channels
  • discord_read_history
  • discord_search_messages

The implementation uses Discord HTTP API v10, auto-allows the current Discord session target when appropriate, includes active thread discovery and thread-aware name resolution, enforces hard safety bounds on history/search windows, and returns message permalinks when possible.

Why

Hermes could write to Discord through the gateway but had no safe, bounded way to inspect Discord context from tools. This change adds production-scoped read access without pretending to provide unrestricted server-wide search.

Impact

  • New discord_read toolset and core-tool registrations
  • Config/env support for:
    • DISCORD_READ_ALLOWED_GUILDS
    • DISCORD_READ_ALLOWED_CHANNELS
    • DISCORD_READ_INCLUDE_DMS
  • Deterministic Discord channel/thread resolution in the gateway directory
  • Docs and tests covering allowlists, current-session access, thread discovery, and result limits
  • Branch updated with current main and conflict resolution completed

Validation

Passed:

  • python -m pytest tests/tools/test_discord_read_tool.py -q
  • python -m pytest tests/gateway/test_channel_directory.py -q
  • python -m pytest tests/gateway/test_session.py -q
  • python -m pytest tests/gateway/test_config.py -q
  • python -m pytest tests/gateway/test_api_server_toolset.py -q
  • python -m pytest tests/test_toolsets.py -q
  • python -m pytest tests/tools/test_discord_read_tool.py tests/gateway/test_channel_directory.py tests/gateway/test_session.py tests/gateway/test_config.py tests/gateway/test_api_server_toolset.py tests/test_toolsets.py -q
    • Result: 129 passed

Full suite status in this environment after merging current main:

  • python -m pytest tests/ -q
    • Branch result: 7 failed, 7801 passed, 188 skipped, 1 xpassed
    • Current origin/main result: 6 failed, 7791 passed, 188 skipped, 1 xpassed

Known baseline failures on current origin/main:

  • tests/hermes_cli/test_tools_config.py::test_first_install_nous_auto_configures_managed_defaults
  • tests/tools/test_transcription.py::TestGetProvider::test_explicit_local_no_cloud_fallback
  • tests/tools/test_transcription.py::TestGetProvider::test_local_nothing_available
  • tests/tools/test_file_read_guards.py::TestConfigOverride::test_custom_config_raises_limit
  • tests/tools/test_file_read_guards.py::TestCharacterCountGuard::test_content_under_limit_passes
  • tests/tools/test_file_read_guards.py::TestCharacterCountGuard::test_oversized_read_rejected

Additional flaky failure observed both on this branch and when run directly on origin/main:

  • tests/gateway/test_approve_deny_commands.py::TestBlockingApprovalE2E::test_parallel_mixed_approve_deny

Environment note:

  • Validation used the shared venv with the repo installed editable from this branch.

@orangebread orangebread marked this pull request as ready for review April 3, 2026 07:24
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have platform/discord Discord bot adapter comp/tools Tool registry, model_tools, toolsets labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have platform/discord Discord bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants