[codex] Add Discord read tools#4677
Open
orangebread wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: