You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds route-level actions filtering for webhook routes so providers such as GitHub can be filtered by payload action before the agent runs.
This fixes cases where a route accepts a broad event type such as pull_request, then still dispatches agents for non-actionable sub-actions like synchronize, closed, or labeled. With this change, routes can opt into action filtering:
events: [pull_request]actions: [opened]
A non-matching action now returns an ignored response and skips agent dispatch:
Works for what I needed. One edge case though: if allowed_actions and payload_action not in allowed_actions also drops a delivery whose payload has no action field, since None not in [...] is true. pull_request always carries an action, but actions is a generic route key, so a route that mixes pull_request with an action-less event like push or ping would silently drop those once an allow-list is set. A truthiness check fails open:
Thanks for this PR — webhook payload filtering has now landed on main via #60944 (salvage of @evelynburger's #57544), which generalizes this: route-level payload filters (equals/not_equals/contains/exists/... on payload fields, event type, and headers) plus optional route scripts for transform/narrow logic, wired through hermes webhook subscribe --filter/--script and config.yaml. Your use case should be covered by the generic filter syntax; if something specific is missing, please open a fresh issue against the new mechanism. Closing as superseded — appreciate the earlier push in this direction.
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
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.
What does this PR do?
Adds route-level
actionsfiltering for webhook routes so providers such as GitHub can be filtered by payload action before the agent runs.This fixes cases where a route accepts a broad event type such as
pull_request, then still dispatches agents for non-actionable sub-actions likesynchronize,closed, orlabeled. With this change, routes can opt into action filtering:A non-matching action now returns an ignored response and skips agent dispatch:
{"status":"ignored","event":"pull_request","action":"synchronize"}Related Issue
No linked issue.
Type of Change
Changes Made
gateway/platforms/webhook.pyactions.payload["action"]after event filtering and before prompt rendering / agent dispatch.status=ignoredwith the event and action when the action does not match.tests/gateway/test_webhook_adapter.pywebsite/docs/guides/webhook-github-pr-review.mdactionsroute field.How to Test
pull_requestpayload withaction: synchronize.{"status":"ignored","event":"pull_request","action":"synchronize"}pull_requestpayload withaction: opened.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Targeted test run:
Manual verification from a local Hermes gateway:
A real GitHub
pull_request/synchronizedelivery returned200after this change, where the same route previously returned202and dispatched the agent.