[codex] Add Discord read tools - #4677
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the bounded, read-only design and the coverage around current-session access and thread discovery.
Problems
- Current main already has REST-backed Discord message retrieval and channel listing:
tools/discord_tool.py:511-526implementsfetch_messages, andtools/discord_tool.py:382-384implementslist_channels. Current main intentionally keepsdiscordanddiscord_adminoff_HERMES_CORE_TOOLS(toolsets.py:453-459;tests/tools/test_discord_tool.py:661-676). Adding three parallel schemas to the core bundle in this PR duplicates that surface and expands it to non-Discord platform bundles. hermes_cli/config.py:924-944andwebsite/docs/user-guide/messaging/discord.md:277-280make read scope a user-facing.envconfiguration.AGENTS.md:102-106requires behavioral settings to be documented inconfig.yamlinstead.
Suggested changes
- Re-scope the bounded search/current-session work onto the existing Discord toolsets rather than adding core tools.
- Keep
discord.read.*as the documented configuration path and remove the new.envsetup surface.
Automated hermes-sweeper review.
| # Cross-platform messaging (gated on gateway running via check_fn) | ||
| "send_message", | ||
| # Discord read-only access (gated on Discord bot config) | ||
| "discord_list_channels", "discord_read_history", "discord_search_messages", |
There was a problem hiding this comment.
Please do not add these Discord-specific schemas to _HERMES_CORE_TOOLS. Current main deliberately keeps the existing discord and discord_admin REST tools on hermes-discord only (toolsets.py:453-459; tests/tools/test_discord_tool.py:661-676). Re-scope the bounded read behavior onto that established Discord surface instead of exposing parallel tools to every platform bundle.
| "password": False, | ||
| "category": "messaging", | ||
| }, | ||
| "DISCORD_READ_ALLOWED_GUILDS": { |
There was a problem hiding this comment.
These are non-secret behavioral allowlist settings. Please retain discord.read.* in config.yaml as the user-facing interface and remove these entries from .env setup; AGENTS.md requires behavioral settings to be documented in config rather than .env.
Summary
Adds three read-only Discord tools scoped by explicit allowlists:
discord_list_channelsdiscord_read_historydiscord_search_messagesThe 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
discord_readtoolset and core-tool registrationsDISCORD_READ_ALLOWED_GUILDSDISCORD_READ_ALLOWED_CHANNELSDISCORD_READ_INCLUDE_DMSmainand conflict resolution completedValidation
Passed:
python -m pytest tests/tools/test_discord_read_tool.py -qpython -m pytest tests/gateway/test_channel_directory.py -qpython -m pytest tests/gateway/test_session.py -qpython -m pytest tests/gateway/test_config.py -qpython -m pytest tests/gateway/test_api_server_toolset.py -qpython -m pytest tests/test_toolsets.py -qpython -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 -q129 passedFull suite status in this environment after merging current
main:python -m pytest tests/ -q7 failed, 7801 passed, 188 skipped, 1 xpassedorigin/mainresult:6 failed, 7791 passed, 188 skipped, 1 xpassedKnown baseline failures on current
origin/main:tests/hermes_cli/test_tools_config.py::test_first_install_nous_auto_configures_managed_defaultstests/tools/test_transcription.py::TestGetProvider::test_explicit_local_no_cloud_fallbacktests/tools/test_transcription.py::TestGetProvider::test_local_nothing_availabletests/tools/test_file_read_guards.py::TestConfigOverride::test_custom_config_raises_limittests/tools/test_file_read_guards.py::TestCharacterCountGuard::test_content_under_limit_passestests/tools/test_file_read_guards.py::TestCharacterCountGuard::test_oversized_read_rejectedAdditional 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_denyEnvironment note: