chore(gateway): drop plugin-migrated platforms from /update allowlist#32525
Closed
kshitijk4poor wants to merge 1 commit into
Closed
Conversation
`gateway/run.py::_UPDATE_ALLOWED_PLATFORMS` was a hardcoded frozenset listing every messaging platform allowed to invoke the `/update` slash command. Plugin-migrated platforms (currently Discord and Mattermost, soon also Home Assistant via NousResearch#32500) declare `allow_update_command=True` on their `PlatformEntry`, and `_handle_update_command` already falls back to the registry when a platform isn't in the frozenset. The result was a silent redundancy: those entries said "allowed" twice, and the registry flag was a no-op for them in practice. - Removed `Platform.DISCORD` and `Platform.MATTERMOST` from the frozenset. - Updated the docstring to make the split explicit (built-ins live in the frozenset; plugins use `allow_update_command` on the registry entry). The remaining frozenset entries are all still built-in platforms living under `gateway/platforms/` today. Future plugin migrations should drop their entry from the frozenset as part of the migration PR (or in a sibling chore PR like this one). Added a `TestUpdateCommandPlatformGate` test class that pins down all three branches of the gate so future changes don't silently regress: - Programmatic interfaces (`Platform.WEBHOOK`, `Platform.API_SERVER`) must remain blocked. - Plugin-migrated platforms (Discord, Mattermost) must pass via the registry fallback. - Built-in platforms in the hardcoded frozenset (Telegram) must still pass without needing the registry. The gate previously had zero direct test coverage — its only existing coverage was `test_no_adapter_for_platform` which exercised a different code path.
Contributor
|
Merged via #40711 — your commit was cherry-picked onto current main with your authorship preserved in git log (the original branch was 1211 commits behind). The CI flake on the rerun was an unrelated concurrent-tool-execution shard race, not your diff. Thanks for the cleanup and the +5 gate-coverage tests. |
28 tasks
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Jun 7, 2026
signal is now a bundled plugin; its PlatformEntry already permits /update via allow_update_command (defaults True), honored by the registry fallback in _handle_update_command. The hardcoded Platform.SIGNAL entry in _UPDATE_ALLOWED_PLATFORMS is therefore redundant. Same cleanup as NousResearch#32525 did for Discord/Mattermost.
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Jun 7, 2026
qqbot is now a bundled plugin; its PlatformEntry already permits /update via allow_update_command (defaults True), honored by the registry fallback in _handle_update_command. The hardcoded Platform.QQBOT entry in _UPDATE_ALLOWED_PLATFORMS is therefore redundant. Same cleanup as NousResearch#32525 did for Discord/Mattermost.
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Jun 7, 2026
weixin is now a bundled plugin; its PlatformEntry already permits /update via allow_update_command (defaults True), honored by the registry fallback in _handle_update_command. The hardcoded Platform.WEIXIN entry in _UPDATE_ALLOWED_PLATFORMS is therefore redundant. Same cleanup as NousResearch#32525 did for Discord/Mattermost.
This was referenced Jun 7, 2026
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
Drops
Platform.DISCORDandPlatform.MATTERMOSTfrom the hardcoded_UPDATE_ALLOWED_PLATFORMSfrozenset ingateway/run.py. Both platforms are bundled plugins now (PR #24356 migrated Discord, PR #31748 migrated Mattermost) and they declareallow_update_command=Trueon theirPlatformEntry. The gate at_handle_update_commandalready falls back to the registry when a platform isn't in the frozenset:Today both entries say "allowed" twice — once in the frozenset, once on the registry. Cleaning up the frozenset makes the registry flag actually do work for these platforms instead of being a redundant no-op.
What's NOT touched
teams,irc,line,google_chat,ntfy,simplex) were never in the frozenset to begin with — they've always relied on the registry fallback.Verification
Empirical test from the worktree:
Tests
Added
TestUpdateCommandPlatformGatetotests/gateway/test_update_command.pywith five cases that pin down every branch of the allowlist gate. The gate previously had zero direct coverage:test_blocks_programmatic_interface—Platform.WEBHOOKmust be blockedtest_blocks_api_server_platform—Platform.API_SERVERmust be blockedtest_allows_plugin_platform_via_registry_fallback—Platform.DISCORDmust pass via registry fallback (the regression test for this PR's change)test_allows_mattermost_via_registry_fallback— same forPlatform.MATTERMOSTtest_allows_builtin_platform_in_allowlist—Platform.TELEGRAMmust still pass directly via the frozensetEach plugin-platform test asserts the precondition
Platform.X not in _UPDATE_ALLOWED_PLATFORMSexplicitly, so if anyone re-adds Discord/Mattermost to the frozenset in the future, the tests fail loudly.All 74
/update-related tests pass (was 69 before, +5 new).Surfaced during
Self-review of PR #32500 (Home Assistant migration). The migration playbook calls out this redundancy as out-of-scope tech debt for the migration PR itself; this PR closes that follow-up for the platforms already migrated.