Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(loops): filter github event triggers on the webhook payload (#77905)

Tom Piccirelloebe89b23674c
diff --git a/products/tasks/backend/loop_github_events.py b/products/tasks/backend/loop_github_events.py
index 924e845e0f84..618a3c38c56d 100644
--- a/products/tasks/backend/loop_github_events.py
+++ b/products/tasks/backend/loop_github_events.py
@@ -246,6 +246,10 @@ def _filters_match(filters: dict[str, Any], action: str | None, payload: dict[st
if allowed_labels and not _labels_match(allowed_labels, payload):
return False
+ payload_conditions = filters.get("payload")
+ if payload_conditions and not _payload_matches(payload_conditions, payload):
+ return False
+
return True
@@ -280,6 +284,42 @@ def _labels_match(allowed_labels: list[Any], payload: dict[str, Any]) -> bool:
return bool(_event_labels(payload).intersection(allowed_labels))
+def _resolve_payload_path(payload: dict[str, Any], path: str) -> Any:
+ """Walk a dot-path through nested objects. Objects only: a segment landing on a list or a
+ scalar resolves to nothing, so `pull_request.labels.0.name` never matches — that is what the
+ `labels` filter is for."""
+ current: Any = payload
+ for segment in path.split("."):
+ if not isinstance(current, dict) or segment not in current:
+ return None
+ current = current[segment]
+ return current
+
+
+def _payload_leaf_as_string(value: Any) -> str | None:
+ # bool before int: `isinstance(True, int)` is True, and "true" is what an author writes.
+ if isinstance(value, bool):
+ return "true" if value else "false"
+ if isinstance(value, str):
+ return value
+ if isinstance(value, int | float):
+ return str(value)
+ return None
+
+
+def _payload_matches(conditions: list[Any], payload: dict[str, Any]) -> bool:
+ """Every condition's dot-path must resolve to a scalar whose string form is one of its
+ expected values (AND across conditions, OR within one), matching how `actions`/`branches`/
+ `labels` combine. Values arrive normalized to lists of strings from the trigger serializer."""
+ for condition in conditions:
+ if not isinstance(condition, dict):
+ return False
+ leaf = _payload_leaf_as_string(_resolve_payload_path(payload, str(condition.get("path", ""))))
+ if leaf is None or leaf not in (condition.get("equals") or []):
+ return False
+ return True
+
+
def _excerpt(text: Any, limit: int = _EXCERPT_LIMIT) -> str | None:
if not isinstance(text, str):
return None
@@ -312,6 +352,17 @@ def _build_event_summary(event_type: str, payload: dict[str, Any]) -> dict[str,
"base_ref": (pull_request.get("base") or {}).get("ref"),
}
+ # A loop can gate on "my team was asked to review", so the run needs to know which team.
+ # Unlike the commit messages dropped below, a team slug and a reviewer login are
+ # org-controlled identifiers rather than text an external contributor can author.
+ requested_team = payload.get("requested_team")
+ if isinstance(requested_team, dict):
+ summary["requested_team"] = {"slug": requested_team.get("slug"), "name": requested_team.get("name")}
+
+ requested_reviewer = payload.get("requested_reviewer")
+ if isinstance(requested_reviewer, dict):
+ summary["requested_reviewer"] = {"login": requested_reviewer.get("login")}
+
issue = payload.get("issue")
if isinstance(issue, dict):
summary["issue"] = {
diff --git a/products/tasks/backend/presentation/serializers_loops.py b/products/tasks/backend/presentation/serializers_loops.py
index 9b4d8e11bd66..7115d08eb0e8 100644
--- a/products/tasks/backend/presentation/serializers_loops.py
+++ b/products/tasks/backend/presentation/serializers_loops.py
@@ -8,8 +8,9 @@ relations through facade-exposed queryset helpers, mirroring the existing patter
`presentation/serializers.py` (`tasks_facade.channel_queryset()` et al.).
"""
+import re
from datetime import UTC, datetime
-from typing import cast
+from typing import Any, cast
from zoneinfo import available_timezones
from django.utils import timezone as django_timezone
@@ -179,6 +180,78 @@ def _validate_schedule_trigger_config(config: dict, *, now: datetime) -> dict:
return {"cron_expression": normalized_cron, "timezone": timezone_name}
+MAX_PAYLOAD_CONDITIONS = 16
+MAX_PAYLOAD_CONDITION_VALUES = 20
+MAX_PAYLOAD_PATH_SEGMENTS = 8
+MAX_PAYLOAD_STRING_LENGTH = 200
+_PAYLOAD_PATH_SEGMENT = re.compile(r"^[A-Za-z0-9_-]+$")
+
+
+def _validate_payload_conditions(raw: Any) -> list[dict[str, Any]]:
+ """`filters.payload`: dot-path conditions on the webhook body, for the fields no named filter
+ covers (the motivating one being `requested_team.slug` on a review request). Bounded because a
+ stored condition is re-evaluated on every delivery for the repo."""
+ if not isinstance(raw, list):
+ raise serializers.ValidationError({"filters": "Filter 'payload' must be a list of {path, equals} objects."})
+ if len(raw) > MAX_PAYLOAD_CONDITIONS:
+ raise serializers.ValidationError({"filters": f"At most {MAX_PAYLOAD_CONDITIONS} payload conditions."})
+
+ conditions: list[dict[str, Any]] = []
+ for condition in raw:
+ if not isinstance(condition, dict):
+ raise serializers.ValidationError({"filters": "Each payload condition must be a {path, equals} object."})
+
+ path = condition.get("path")
+ if not isinstance(path, str) or not path.strip():
+ raise serializers.ValidationError({"filters": "Each payload condition needs a non-empty `path`."})
+ path = path.strip()
+ segments = path.split(".")
+ if len(path) > MAX_PAYLOAD_STRING_LENGTH or len(segments) > MAX_PAYLOAD_PATH_SEGMENTS:
+ raise serializers.ValidationError(
+ {
+ "filters": (
+ f"Payload condition `path` must be at most {MAX_PAYLOAD_STRING_LENGTH} characters "
+ f"and {MAX_PAYLOAD_PATH_SEGMENTS} dot-separated segments."
+ )
+ }
+ )
+ if not all(_PAYLOAD_PATH_SEGMENT.match(segment) for segment in segments):
+ raise serializers.ValidationError(
+ {"filters": f"Payload condition path '{path}' must be dot-separated keys, like 'requested_team.slug'."}
+ )
+ # Matching walks object keys only, so a list index would save fine and then never fire.
+ # Reject it here rather than let the trigger sit there silently doing nothing.
+ if any(segment.isdigit() for segment in segments):
+ raise serializers.ValidationError(
+ {
+ "filters": (
+ f"Payload condition path '{path}' indexes into a list. Conditions match object "
+ "keys only, so this would never fire. To match labels, use the `labels` filter."
+ )
+ }
+ )
+
+ expected = condition.get("equals")
+ values = [expected] if isinstance(expected, str) else expected
+ if not isinstance(values, list) or not values or not all(isinstance(item, str) for item in values):
+ raise serializers.ValidationError(
+ {"filters": f"Payload condition '{path}' needs `equals`: a string or a non-empty list of strings."}
+ )
+ if len(values) > MAX_PAYLOAD_CONDITION_VALUES or any(len(item) > MAX_PAYLOAD_STRING_LENGTH for item in values):
+ raise serializers.ValidationError(
+ {
+ "filters": (
+ f"Payload condition '{path}' allows at most {MAX_PAYLOAD_CONDITION_VALUES} values "
+ f"of {MAX_PAYLOAD_STRING_LENGTH} characters each."
+ )
+ }
+ )
+
+ conditions.append({"path": path, "equals": values})
+
+ return conditions
+
+
def _validate_github_trigger_config(config: dict, team_id: int) -> dict:
github_integration_id = config.get("github_integration_id")
if not isinstance(github_integration_id, int):
@@ -248,12 +321,15 @@ def _validate_github_trigger_config(config: dict, team_id: int) -> dict:
# Accept singular keys and a bare string value too: agents (and GitHub's own webhook
# payloads) naturally reach for `action`/`"opened"` over `actions`/`["opened"]`.
filter_key_aliases = {"action": "actions", "branch": "branches", "label": "labels"}
- filters: dict[str, list[str]] = {}
+ filters: dict[str, Any] = {}
for raw_key, filter_value in filters_raw.items():
key = filter_key_aliases.get(raw_key, raw_key)
+ if key == "payload":
+ filters[key] = _validate_payload_conditions(filter_value)
+ continue
if key not in ("actions", "branches", "labels"):
raise serializers.ValidationError(
- {"filters": f"Unsupported filter key: '{raw_key}'. Allowed: actions, branches, labels."}
+ {"filters": f"Unsupported filter key: '{raw_key}'. Allowed: actions, branches, labels, payload."}
)
values = [filter_value] if isinstance(filter_value, str) else filter_value
if not isinstance(values, list) or not all(isinstance(item, str) for item in values):
@@ -302,7 +378,12 @@ class LoopTriggerWriteSerializer(serializers.Serializer):
f"{', '.join(f'`{event}`' for event in loops_facade.ALLOWED_GITHUB_TRIGGER_EVENTS)} "
"(`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one "
"event per trigger) and "
- "`filters` takes `{actions, branches, labels}`; api takes no config."
+ "`filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event "
+ "action; `payload` is for anything else in the webhook body, as a list of "
+ "`{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is "
+ "a string or list of strings, e.g. "
+ '`[{"path": "requested_team.slug", "equals": "team-security"}]` to run only when that '
+ "team is asked to review. All filters must match. API triggers take no config."
),
)
diff --git a/products/tasks/backend/tests/test_loop_github_events.py b/products/tasks/backend/tests/test_loop_github_events.py
index 5a571a0fc4de..bb71e15d2fb6 100644
--- a/products/tasks/backend/tests/test_loop_github_events.py
+++ b/products/tasks/backend/tests/test_loop_github_events.py
@@ -261,6 +261,97 @@ class TestHandleGithubEventForLoops(TestCase):
self.assertEqual(mock_fire_loop.called, expect_fired)
+ @parameterized.expand(
+ [
+ (
+ "requested_team_matches",
+ [{"path": "requested_team.slug", "equals": ["team-security"]}],
+ {"requested_team": {"slug": "team-security"}},
+ True,
+ ),
+ (
+ "another_team_was_asked",
+ [{"path": "requested_team.slug", "equals": ["team-security"]}],
+ {"requested_team": {"slug": "team-platform"}},
+ False,
+ ),
+ # Review requested from a person carries requested_reviewer, not requested_team.
+ (
+ "reviewer_is_a_person_not_a_team",
+ [{"path": "requested_team.slug", "equals": ["team-security"]}],
+ {"requested_reviewer": {"login": "alice"}},
+ False,
+ ),
+ (
+ "scalar_where_the_path_expects_an_object",
+ [{"path": "requested_team.slug", "equals": ["team-security"]}],
+ {"requested_team": "team-security"},
+ False,
+ ),
+ # Paths address object keys only, so a list hop resolves to nothing; `labels` is the
+ # filter for that.
+ (
+ "path_through_an_array",
+ [{"path": "pull_request.labels.0.name", "equals": ["security"]}],
+ {},
+ False,
+ ),
+ (
+ "one_matching_condition_cannot_carry_a_failing_one",
+ [
+ {"path": "requested_team.slug", "equals": ["team-security"]},
+ {"path": "pull_request.draft", "equals": ["true"]},
+ ],
+ {"requested_team": {"slug": "team-security"}},
+ False,
+ ),
+ # Authors write strings; a numeric or boolean leaf is compared by its string form.
+ (
+ "non_string_leaf_compares_by_string_form",
+ [{"path": "pull_request.number", "equals": ["7"]}],
+ {},
+ True,
+ ),
+ ]
+ )
+ @patch(FIRE_LOOP_PATCH_TARGET, autospec=True)
+ def test_pull_request_payload_conditions(self, _name, conditions, payload_extra, expect_fired, mock_fire_loop):
+ loop = self._create_loop(self.team)
+ self._create_github_trigger(
+ self.team,
+ loop,
+ github_integration_id=self.integration.id,
+ repository="acme/repo",
+ events=["pull_request"],
+ filters={"actions": ["review_requested"], "payload": conditions},
+ )
+ payload = {
+ "installation": {"id": 998877},
+ "repository": {"full_name": "acme/repo"},
+ "action": "review_requested",
+ "pull_request": {
+ "author_association": "MEMBER",
+ "number": 7,
+ "draft": False,
+ "labels": [{"name": "security"}],
+ },
+ **payload_extra,
+ }
+
+ handle_github_event_for_loops("pull_request", payload, delivery_id="del-payload-filter")
+
+ self.assertEqual(mock_fire_loop.called, expect_fired)
+
+ def test_review_request_target_reaches_the_event_summary(self):
+ # A loop that fires on "a team was asked to review" needs to know which team, and the
+ # summary is the only thing that reaches the run's prompt.
+ summary = _build_event_summary(
+ "pull_request",
+ {"action": "review_requested", "requested_team": {"slug": "team-security", "name": "Security"}},
+ )
+
+ self.assertEqual(summary["requested_team"], {"slug": "team-security", "name": "Security"})
+
@parameterized.expand(
[
("owner", "OWNER", True),
diff --git a/products/tasks/backend/tests/test_loops_api.py b/products/tasks/backend/tests/test_loops_api.py
index 9407ab423180..c6c03e07b7fa 100644
--- a/products/tasks/backend/tests/test_loops_api.py
+++ b/products/tasks/backend/tests/test_loops_api.py
@@ -1048,6 +1048,49 @@ class LoopGithubTriggerValidationAPITest(LoopsAPITestCase):
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.content)
+ def test_payload_conditions_normalize_a_bare_string_to_a_list(self):
+ # The matcher reads `equals` as a list, so a string that survived unnormalized would be
+ # compared character by character and never match.
+ created = self._create_loop(
+ self.owner_client,
+ triggers=[
+ self._github_trigger(
+ ["pull_request"],
+ {"payload": [{"path": "requested_team.slug", "equals": "team-security"}]},
+ )
+ ],
+ )
+ self.assertEqual(
+ created["triggers"][0]["config"]["filters"]["payload"],
+ [{"path": "requested_team.slug", "equals": ["team-security"]}],
+ )
+
+ @parameterized.expand(
+ [
+ ("not_a_list", {"payload": {"path": "action", "equals": "opened"}}),
+ ("entry_not_an_object", {"payload": ["requested_team.slug"]}),
+ ("missing_path", {"payload": [{"equals": "team-security"}]}),
+ ("empty_path", {"payload": [{"path": " ", "equals": "team-security"}]}),
+ ("path_with_empty_segment", {"payload": [{"path": "requested_team..slug", "equals": "x"}]}),
+ # Saves fine and then never fires: matching walks objects, not lists.
+ ("path_indexing_into_a_list", {"payload": [{"path": "pull_request.labels.0.name", "equals": "x"}]}),
+ ("too_many_path_segments", {"payload": [{"path": ".".join("abcdefghi"), "equals": "x"}]}),
+ ("missing_equals", {"payload": [{"path": "requested_team.slug"}]}),
+ ("empty_equals", {"payload": [{"path": "requested_team.slug", "equals": []}]}),
+ ("non_string_equals", {"payload": [{"path": "pull_request.number", "equals": 7}]}),
+ ("too_many_conditions", {"payload": [{"path": f"a{i}", "equals": "x"} for i in range(17)]}),
+ # The allowlist is how an agent discovers the vocabulary after a failed call.
+ ("unknown_filter_key", {"reviewers": ["alice"]}),
+ ]
+ )
+ def test_invalid_payload_conditions_are_rejected(self, _name, filters):
+ response = self.owner_client.post(
+ self._loops_url(),
+ self._valid_loop_payload(triggers=[self._github_trigger(["pull_request"], filters)]),
+ format="json",
+ )
+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.content)
+
class LoopServiceReadbackAPITest(LoopsAPITestCase):
def _psak(self, scopes) -> str:
diff --git a/products/tasks/frontend/generated/api.schemas.ts b/products/tasks/frontend/generated/api.schemas.ts
index 9d95243358b3..c9e140718b29 100644
--- a/products/tasks/frontend/generated/api.schemas.ts
+++ b/products/tasks/frontend/generated/api.schemas.ts
@@ -368,7 +368,7 @@ export interface LoopTriggerWriteApi {
type: LoopTriggerTypeEnumApi
/** Whether this trigger is active. Disabling pauses only this trigger. */
enabled?: boolean
- /** Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config. */
+ /** Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{"path": "requested_team.slug", "equals": "team-security"}]` to run only when that team is asked to review. All filters must match. API triggers take no config. */
config?: unknown
}
diff --git a/products/tasks/frontend/generated/api.zod.ts b/products/tasks/frontend/generated/api.zod.ts
index bdc99b4c0d2e..79ce2bcbc7ef 100644
--- a/products/tasks/frontend/generated/api.zod.ts
+++ b/products/tasks/frontend/generated/api.zod.ts
@@ -307,7 +307,7 @@ export const LoopsCreateBody = /* @__PURE__ */ zod
.unknown()
.optional()
.describe(
- 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config.'
+ 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config.'
),
})
)
@@ -608,7 +608,7 @@ export const LoopsPartialUpdateBody = /* @__PURE__ */ zod
.unknown()
.optional()
.describe(
- 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config.'
+ 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config.'
),
})
)
diff --git a/products/tasks/mcp/apps/LoopReviewView.test.ts b/products/tasks/mcp/apps/LoopReviewView.test.ts
index b54dd3d9c09c..a23c94064fc3 100644
--- a/products/tasks/mcp/apps/LoopReviewView.test.ts
+++ b/products/tasks/mcp/apps/LoopReviewView.test.ts
@@ -151,6 +151,27 @@ describe('LoopReviewView', () => {
},
'GitHub (posthog/code: issues labeled bug) · skips overlapping runs',
],
+ [
+ 'github trigger with payload conditions',
+ {
+ triggers: [
+ {
+ type: 'github',
+ config: {
+ repository: 'posthog/posthog',
+ events: ['pull_request.review_requested'],
+ filters: {
+ payload: [
+ { path: 'requested_team.slug', equals: ['team-security', 'team-infra'] },
+ { path: 'pull_request.draft', equals: 'false' },
+ ],
+ },
+ },
+ },
+ ],
+ },
+ 'GitHub (posthog/posthog: pull_request review_requested where requested_team.slug is team-security or team-infra and pull_request.draft is false) · skips overlapping runs',
+ ],
['paused loop', { enabled: false }, 'Manual only · paused · skips overlapping runs'],
['allow policy', { overlap_policy: 'allow' }, 'Manual only · allows overlapping runs'],
['cancel_previous policy', { overlap_policy: 'cancel_previous' }, 'Manual only · cancels the previous run'],
diff --git a/products/tasks/mcp/apps/LoopReviewView.tsx b/products/tasks/mcp/apps/LoopReviewView.tsx
index d55f183c00d2..52bfbb48d051 100644
--- a/products/tasks/mcp/apps/LoopReviewView.tsx
+++ b/products/tasks/mcp/apps/LoopReviewView.tsx
@@ -92,6 +92,21 @@ function stringList(value: unknown): string[] {
return []
}
+function describePayloadConditions(value: unknown): string {
+ if (!Array.isArray(value)) {
+ return ''
+ }
+ return value
+ .map((entry) => {
+ const condition = (entry ?? {}) as Record<string, unknown>
+ const path = typeof condition.path === 'string' ? condition.path : ''
+ const expected = stringList(condition.equals)
+ return path && expected.length > 0 ? `${path} is ${expected.join(' or ')}` : ''
+ })
+ .filter(Boolean)
+ .join(' and ')
+}
+
function describeGithubTrigger(config: Record<string, unknown>): string {
const repository = typeof config.repository === 'string' ? config.repository : 'a repo'
const filters = (config.filters ?? {}) as Record<string, unknown>
@@ -124,6 +139,10 @@ function describeGithubTrigger(config: Record<string, unknown>): string {
if (labels.length > 0) {
summary += ` labeled ${labels.join(', ')}`
}
+ const conditions = describePayloadConditions(filters.payload)
+ if (conditions) {
+ summary += ` where ${conditions}`
+ }
return `GitHub (${repository}: ${summary})`
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index cb05633dae6b..05fb3255c590 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -41407,7 +41407,7 @@ export namespace Schemas {
type: LoopTriggerTypeEnum;
/** Whether this trigger is active. Disabling pauses only this trigger. */
enabled?: boolean;
- /** Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config. */
+ /** Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{"path": "requested_team.slug", "equals": "team-security"}]` to run only when that team is asked to review. All filters must match. API triggers take no config. */
config?: unknown;
}
diff --git a/services/mcp/src/generated/tasks/api.ts b/services/mcp/src/generated/tasks/api.ts
index 8225688ac293..d661584066e0 100644
--- a/services/mcp/src/generated/tasks/api.ts
+++ b/services/mcp/src/generated/tasks/api.ts
@@ -321,7 +321,7 @@ export const LoopsCreateBody = /* @__PURE__ */ zod
.unknown()
.optional()
.describe(
- 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config.'
+ 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config.'
),
})
)
@@ -636,7 +636,7 @@ export const LoopsPartialUpdateBody = /* @__PURE__ */ zod
.unknown()
.optional()
.describe(
- 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config.'
+ 'Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config.'
),
})
)
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-create-prepare.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-create-prepare.json
index d263eddd8a75..2bd7d499a6b8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-create-prepare.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-create-prepare.json
@@ -278,7 +278,7 @@
"items": {
"properties": {
"config": {
- "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config."
+ "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config."
},
"enabled": {
"default": true,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-partial-update.json
index 7359e8e1508c..296485e7bbff 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-partial-update.json
@@ -275,7 +275,7 @@
"items": {
"properties": {
"config": {
- "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config."
+ "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config."
},
"enabled": {
"default": true,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-review.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-review.json
index d263eddd8a75..2bd7d499a6b8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-review.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/loops-review.json
@@ -278,7 +278,7 @@
"items": {
"properties": {
"config": {
- "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels}`; api takes no config."
+ "description": "Trigger configuration, shape validated per `type`: schedule takes `{cron_expression, timezone}` or `{run_at}` for a one-time run; github takes `{github_integration_id, repository, events, filters}` where `events` is one or more of `issues`, `issue_comment`, `pull_request`, `push` (`event.action` shorthand like `issues.opened` is folded into an `actions` filter, one event per trigger) and `filters` takes `{actions, branches, labels, payload}`. Use `actions` for the event action; `payload` is for anything else in the webhook body, as a list of `{path, equals}` conditions where `path` is a dot-path of object keys and `equals` is a string or list of strings, e.g. `[{\"path\": \"requested_team.slug\", \"equals\": \"team-security\"}]` to run only when that team is asked to review. All filters must match. API triggers take no config."
},
"enabled": {
"default": true,