: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(error_tracking): throttle alert openers and record delivery outcomes (#92053)
Catalin9ffe46a341f2
diff --git a/products/error_tracking/backend/facade/alerts.py b/products/error_tracking/backend/facade/alerts.pyindex 47a544e53fa3..386d1828c6c9 100644--- a/products/error_tracking/backend/facade/alerts.py+++ b/products/error_tracking/backend/facade/alerts.py@@ -15,6 +15,7 @@ from . import contractsAlertValidationError = _alerts.AlertValidationErrorNATIVE_ALERTS_FLAG = _alerts.NATIVE_ALERTS_FLAG+MAX_THROTTLE_SECONDS = _alerts.MAX_THROTTLE_SECONDSnative_alerts_enabled = _alerts.native_alerts_enabled# Presentation code reads choice values from here so it never imports Django models.@@ -36,6 +37,10 @@ def _to_alert(alert: ErrorTrackingAlertModel) -> contracts.ErrorTrackingAlert:channel_type=destination.channel_type,integration_id=destination.integration_id,config=dict(destination.config),+ last_delivered_at=destination.last_delivered_at,+ last_failure_at=destination.last_failure_at,+ last_error=destination.last_error,+ consecutive_failures=destination.consecutive_failures,created_at=destination.created_at,updated_at=destination.updated_at,)diff --git a/products/error_tracking/backend/facade/contracts.py b/products/error_tracking/backend/facade/contracts.pyindex c5cd621f55a0..d8b5759f8085 100644--- a/products/error_tracking/backend/facade/contracts.py+++ b/products/error_tracking/backend/facade/contracts.py@@ -290,6 +290,10 @@ class ErrorTrackingAlertDestination:channel_type: strintegration_id: int | Noneconfig: dict+ last_delivered_at: datetime | None+ last_failure_at: datetime | None+ last_error: str+ consecutive_failures: intcreated_at: datetimeupdated_at: datetimediff --git a/products/error_tracking/backend/logic/alerts.py b/products/error_tracking/backend/logic/alerts.pyindex 53b97b3a2ea9..52f417e395d1 100644--- a/products/error_tracking/backend/logic/alerts.py+++ b/products/error_tracking/backend/logic/alerts.py@@ -21,6 +21,10 @@ logger = structlog.get_logger(__name__)NATIVE_ALERTS_FLAG = "error-tracking-native-alerts"+# Longest throttle window an alert may configure. Per-issue throttle claims live in+# shared Redis for exactly this long, so the API and delivery must agree on it.+MAX_THROTTLE_SECONDS = 30 * 24 * 60 * 60+def native_alerts_enabled(team_id: int) -> bool:try:diff --git a/products/error_tracking/backend/migrations/0041_errortrackingalertdestination_consecutive_failures_and_more.py b/products/error_tracking/backend/migrations/0041_errortrackingalertdestination_consecutive_failures_and_more.pynew file mode 100644index 000000000000..06759b157e1b--- /dev/null+++ b/products/error_tracking/backend/migrations/0041_errortrackingalertdestination_consecutive_failures_and_more.py@@ -0,0 +1,32 @@+# Generated by Django 5.2.17 on 2026-08-31 19:24++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("error_tracking", "0040_errortrackingalertthread_pending_claim"),+ ]++ operations = [+ migrations.AddField(+ model_name="errortrackingalertdestination",+ name="consecutive_failures",+ field=models.PositiveIntegerField(db_default=0, default=0),+ ),+ migrations.AddField(+ model_name="errortrackingalertdestination",+ name="last_delivered_at",+ field=models.DateTimeField(blank=True, null=True),+ ),+ migrations.AddField(+ model_name="errortrackingalertdestination",+ name="last_error",+ field=models.TextField(blank=True, db_default="", default=""),+ ),+ migrations.AddField(+ model_name="errortrackingalertdestination",+ name="last_failure_at",+ field=models.DateTimeField(blank=True, null=True),+ ),+ ]diff --git a/products/error_tracking/backend/migrations/max_migration.txt b/products/error_tracking/backend/migrations/max_migration.txtindex 0a0330dce35d..04b711453104 100644--- a/products/error_tracking/backend/migrations/max_migration.txt+++ b/products/error_tracking/backend/migrations/max_migration.txt@@ -1 +1 @@-0040_errortrackingalertthread_pending_claim+0041_errortrackingalertdestination_consecutive_failures_and_morediff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.pyindex e3f97c489e50..d90562361731 100644--- a/products/error_tracking/backend/models.py+++ b/products/error_tracking/backend/models.py@@ -961,6 +961,14 @@ class ErrorTrackingAlertDestination(TeamScopedRootMixin, UUIDTModel):integration = models.ForeignKey(Integration, on_delete=models.SET_NULL, related_name="+", null=True, blank=True)# Channel-specific delivery settings, e.g. {"channel": "C0123", "channel_name": "#alerts"} for Slackconfig = models.JSONField(default=dict, blank=True)+ # Delivery outcome record: visibility only, nothing auto-disables a failing+ # destination (per the alerting RFC that stays an open question).+ last_delivered_at = models.DateTimeField(null=True, blank=True)+ last_failure_at = models.DateTimeField(null=True, blank=True)+ # db_default keeps inserts from pods that predate these columns valid during a+ # rolling deploy; Django would otherwise drop the database default after backfill.+ last_error = models.TextField(blank=True, default="", db_default="")+ consecutive_failures = models.PositiveIntegerField(default=0, db_default=0)created_at = models.DateTimeField(auto_now_add=True)updated_at = models.DateTimeField(auto_now=True)diff --git a/products/error_tracking/backend/presentation/views/alerts.py b/products/error_tracking/backend/presentation/views/alerts.pyindex bbf983f75c05..e03d5843dbc2 100644--- a/products/error_tracking/backend/presentation/views/alerts.py+++ b/products/error_tracking/backend/presentation/views/alerts.py@@ -13,7 +13,6 @@ from posthog.models.user import Userfrom products.error_tracking.backend.facade import alerts as alerts_facade# PostgreSQL integer column bound; larger values would 500 on save.-MAX_THROTTLE_SECONDS = 2**31 - 1class _StrictCharField(serializers.CharField):@@ -72,6 +71,18 @@ class ErrorTrackingAlertDestinationRequestSerializer(serializers.Serializer):class ErrorTrackingAlertDestinationSerializer(ErrorTrackingAlertDestinationRequestSerializer):id = serializers.UUIDField(read_only=True, help_text="Unique identifier of the destination.")+ last_delivered_at = serializers.DateTimeField(+ read_only=True, allow_null=True, help_text="When a notification last reached this destination."+ )+ last_failure_at = serializers.DateTimeField(+ read_only=True, allow_null=True, help_text="When delivery to this destination last failed."+ )+ last_error = serializers.CharField(+ read_only=True, allow_blank=True, help_text="Message of the most recent delivery failure."+ )+ consecutive_failures = serializers.IntegerField(+ read_only=True, help_text="Delivery failures since the last successful delivery."+ )class ErrorTrackingAlertSerializer(serializers.Serializer):@@ -113,8 +124,8 @@ class ErrorTrackingAlertCreateRequestSerializer(serializers.Serializer):required=False,default=0,min_value=0,- max_value=MAX_THROTTLE_SECONDS,- help_text="Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.",+ max_value=alerts_facade.MAX_THROTTLE_SECONDS,+ help_text="Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.",)destinations = ErrorTrackingAlertDestinationRequestSerializer(many=True,@@ -144,8 +155,8 @@ class ErrorTrackingAlertUpdateRequestSerializer(serializers.Serializer):throttle_seconds = serializers.IntegerField(required=False,min_value=0,- max_value=MAX_THROTTLE_SECONDS,- help_text="Minimum seconds between thread-opening notifications per issue. Omit to keep the current value.",+ max_value=alerts_facade.MAX_THROTTLE_SECONDS,+ help_text="Minimum seconds between thread-opening notifications per issue, at most 30 days. Omit to keep the current value.",)destinations = ErrorTrackingAlertDestinationRequestSerializer(many=True,diff --git a/products/error_tracking/backend/temporal/alerts/activities.py b/products/error_tracking/backend/temporal/alerts/activities.pyindex c81d1cdbd509..e3e8f76b2437 100644--- a/products/error_tracking/backend/temporal/alerts/activities.py+++ b/products/error_tracking/backend/temporal/alerts/activities.py@@ -6,14 +6,16 @@ from posthog.temporal.common.utils import close_db_connectionsfrom products.error_tracking.backend.temporal.alerts.delivery import AlertThreadBusyError, deliver_alert_notificationsfrom products.error_tracking.backend.temporal.alerts.types import THREAD_BUSY_ERROR_TYPE, AlertDeliveryWorkflowInputs+from products.error_tracking.backend.temporal.alerts.workflow import ACTIVITY_RETRY_POLICY@activity.defn@posthoganalytics.scoped()@close_db_connectionsdef deliver_alert_notifications_activity(inputs: AlertDeliveryWorkflowInputs) -> int:+ final_attempt = activity.info().attempt >= ACTIVITY_RETRY_POLICY.maximum_attemptstry:- return deliver_alert_notifications(inputs)+ return deliver_alert_notifications(inputs, final_attempt=final_attempt)except AlertThreadBusyError as error:# Non-retryable here so contention never spends the activity's failure budget;# the workflow waits and schedules the activity again.diff --git a/products/error_tracking/backend/temporal/alerts/delivery.py b/products/error_tracking/backend/temporal/alerts/delivery.pyindex 736fd470b199..b66b0a102e90 100644--- a/products/error_tracking/backend/temporal/alerts/delivery.py+++ b/products/error_tracking/backend/temporal/alerts/delivery.py@@ -19,14 +19,18 @@ from datetime import datetime, timedeltafrom uuid import UUIDfrom django.db import IntegrityError-from django.db.models import Q+from django.db.models import F, Qfrom django.utils import timezoneimport structlogfrom slack_sdk import WebClient+from slack_sdk.errors import SlackApiError+from temporalio.exceptions import ApplicationErrorfrom posthog.models.integration import Integration, SlackIntegration+from posthog.redis import get_client+from products.error_tracking.backend.logic.alerts import MAX_THROTTLE_SECONDSfrom products.error_tracking.backend.models import (ErrorTrackingAlert,ErrorTrackingAlertDestination,@@ -71,8 +75,38 @@ class AlertThreadBusyError(Exception):"""Another notification holds this thread's send claim; retry after it saves."""-class AlertDeliveryError(Exception):- pass+ALERT_THROTTLE_KEY_PREFIX = "error_tracking:alert_throttle:v1"+_RELEASE_IF_HELD = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) end return 0"+MAX_RECORDED_ERROR_LENGTH = 500+++# Slack error codes that no retry can fix: the bot was removed, the channel is gone+# or archived, or the token lost a scope. Recorded on the destination and skipped.+SLACK_TERMINAL_ERRORS = frozenset(+ {+ "not_in_channel",+ "account_inactive",+ "is_archived",+ "channel_not_found",+ "invalid_auth",+ "token_revoked",+ "missing_scope",+ "not_allowed_token_type",+ "not_authed",+ "no_permission",+ "org_login_required",+ "ekm_access_denied",+ "restricted_action",+ "team_access_not_granted",+ # token_expired is deliberately absent: Slack is an OAuth integration here and+ # the periodic refresh sweep replaces expired tokens, so a retry can succeed.+ }+)+++class AlertDeliveryError(ApplicationError):+ def __init__(self, message: str, *, retry_after: timedelta | None = None) -> None:+ super().__init__(message, next_retry_delay=retry_after)@dataclasses.dataclass(frozen=True)@@ -155,12 +189,21 @@ def _opener_filter_matches(}-def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs) -> int:+def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs, *, final_attempt: bool = False) -> int:planned = plan_alert_deliveries(inputs)filter_matches = _opener_filter_matches(planned, inputs)+ throttle_allowed: dict = {}+ # Throttled alerts with an opener in this run, minus those that rooted a+ # conversation or are still owed a retry: the rest give their window back at+ # the end. Openers re-rooting an unrooted row count too, so a retry that+ # turns terminal releases the window its first attempt claimed.+ throttled_openers: dict = {}+ rooted: set = set()+ retrying: set = set()delivered = 0failures = 0busy = 0+ retry_after = timedelta(0)for delivery in planned:if delivery.is_opener:verdict = filter_matches.get(delivery.alert.id, True)@@ -173,9 +216,24 @@ def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs) -> int:# A filtered-out opener leaves no thread behind, so later replies for# this issue stay unclaimed and a matching opener can still root one.continue+ if delivery.is_opener and delivery.alert.throttle_seconds > 0:+ throttled_openers.setdefault(delivery.alert.id, delivery.alert)+ if delivery.is_opener and delivery.thread is None:+ # The throttle window is claimed only for openers that would start a+ # new conversation, once per alert; every destination of the alert+ # shares the claim. An existing unrooted row was authorized by an+ # earlier claim (its root post failed), so rooting it bypasses the+ # window and stays retryable no matter who holds the key now.+ # Replies are never throttled.+ if delivery.alert.id not in throttle_allowed:+ throttle_allowed[delivery.alert.id] = _opener_throttle_allows(delivery.alert, inputs)+ if not throttle_allowed[delivery.alert.id]:+ continuetry:if _deliver_one(delivery, inputs):delivered += 1+ if delivery.is_opener:+ rooted.add(delivery.alert.id)except AlertThreadBusyError:# Expected contention, not a fault: the workflow waits and runs the# activity again once the holder has saved its root.@@ -188,6 +246,33 @@ def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs) -> int:notification_id=inputs.notification_id,)busy += 1+ retrying.add(delivery.alert.id)+ except SlackApiError as error:+ code = _slack_error_code(error)+ _record_delivery_outcome(delivery.destination, error=f"Slack error: {code}")+ if code in SLACK_TERMINAL_ERRORS:+ # A configuration gap, like the missing-integration path: retrying+ # would burn every attempt for the same outcome.+ logger.warning(+ "error_tracking_alert_destination_rejected",+ team_id=inputs.team_id,+ alert_id=str(delivery.alert.id),+ destination_id=str(delivery.destination.id),+ slack_error=code,+ )+ continue+ retrying.add(delivery.alert.id)+ if code == "ratelimited":+ retry_after = max(retry_after, _slack_retry_after(error))+ logger.warning(+ "error_tracking_alert_delivery_failed",+ team_id=inputs.team_id,+ alert_id=str(delivery.alert.id),+ destination_id=str(delivery.destination.id),+ slack_error=code,+ notification_id=inputs.notification_id,+ )+ failures += 1except Exception:# Give every destination a chance before surfacing the failure to# Temporal; the per-notification claim makes the retry safe for the@@ -201,9 +286,24 @@ def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs) -> int:lifecycle_event=inputs.event,notification_id=inputs.notification_id,)+ # The exception text can name internal hosts; the log line above keeps it.+ _record_delivery_outcome(delivery.destination, error="Delivery failed unexpectedly")failures += 1+ retrying.add(delivery.alert.id)+ for alert_id, alert in throttled_openers.items():+ # On the last attempt nothing is coming back for the retrying alerts either.+ if alert_id not in rooted and (final_attempt or alert_id not in retrying):+ # Every destination of this alert failed for good (or nothing was+ # posted) and no retry is coming: a window that never opened a+ # conversation must not silence the next opener, which is the first+ # one after the user repairs the destination.+ _release_opener_throttle(alert, inputs)if failures:- raise AlertDeliveryError(f"{failures} of {len(planned)} alert deliveries failed")+ # Slack's Retry-After drives the next attempt so early retries do not land+ # inside the rate-limit window and burn the budget.+ raise AlertDeliveryError(+ f"{failures} of {len(planned)} alert deliveries failed", retry_after=retry_after or None+ )if busy:# Only contention left: surfaced as its own error so the wait does not spend# the activity's failure budget.@@ -211,6 +311,89 @@ def deliver_alert_notifications(inputs: AlertDeliveryWorkflowInputs) -> int:return delivered+def _slack_error_code(error: SlackApiError) -> str:+ try:+ return str(error.response["error"])+ except (KeyError, TypeError):+ return "unknown"+++def _slack_retry_after(error: SlackApiError) -> timedelta:+ try:+ return timedelta(seconds=int(error.response.headers.get("Retry-After", 0)))+ except (AttributeError, TypeError, ValueError):+ return timedelta(0)+++def _throttle_key(alert: ErrorTrackingAlert, inputs: AlertDeliveryWorkflowInputs) -> str:+ return f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{inputs.issue_id}"+++def _release_opener_throttle(alert: ErrorTrackingAlert, inputs: AlertDeliveryWorkflowInputs) -> None:+ # An earlier attempt of this notification may have rooted a sibling+ # destination; that conversation keeps the window. Older conversations that+ # only got a reply here do not.+ if (+ ErrorTrackingAlertThread.objects.for_team(alert.team_id, canonical=True)+ .filter(alert=alert, issue_id=inputs.issue_id, external_ref__notification_id=inputs.notification_id)+ .exists()+ ):+ return+ try:+ # Compare-and-delete in one step: a stale claimer must never remove a+ # window that a later notification claimed after this key expired.+ get_client().eval(_RELEASE_IF_HELD, 1, _throttle_key(alert, inputs), inputs.notification_id)+ except Exception:+ logger.exception("error_tracking_alert_throttle_release_failed", alert_id=str(alert.id))+++def _opener_throttle_allows(alert: ErrorTrackingAlert, inputs: AlertDeliveryWorkflowInputs) -> bool:+ if alert.throttle_seconds <= 0:+ return True+ key = _throttle_key(alert, inputs)+ try:+ client = get_client()+ # The API rejects longer windows; the clamp keeps shared Redis safe from rows+ # that predate that limit.+ ttl = min(alert.throttle_seconds, MAX_THROTTLE_SECONDS)+ if client.set(key, inputs.notification_id, nx=True, ex=ttl):+ return True+ holder = client.get(key)+ allowed = holder is not None and holder.decode() == inputs.notification_id+ if not allowed:+ logger.info(+ "error_tracking_alert_opener_throttled",+ team_id=inputs.team_id,+ alert_id=str(alert.id),+ issue_id=inputs.issue_id,+ notification_id=inputs.notification_id,+ )+ # A retry of the notification that claimed the window must still deliver.+ return allowed+ except Exception:+ # Throttling is noise control: without Redis, deliver rather than drop.+ logger.exception("error_tracking_alert_throttle_check_failed", alert_id=str(alert.id))+ return True+++def _record_delivery_outcome(destination: ErrorTrackingAlertDestination, *, error: str | None) -> None:+ now = timezone.now()+ rows = ErrorTrackingAlertDestination.objects.for_team(destination.team_id, canonical=True).filter(id=destination.id)+ try:+ if error is None:+ rows.update(last_delivered_at=now, consecutive_failures=0, last_error="", updated_at=now)+ else:+ rows.update(+ last_failure_at=now,+ last_error=error[:MAX_RECORDED_ERROR_LENGTH],+ consecutive_failures=F("consecutive_failures") + 1,+ updated_at=now,+ )+ except Exception:+ # The outcome record is observability, never worth failing a delivery over.+ logger.exception("error_tracking_alert_outcome_record_failed", destination_id=str(destination.id))++def _deliver_one(delivery: PlannedDelivery, inputs: AlertDeliveryWorkflowInputs) -> bool:thread = delivery.threadif thread is None:@@ -247,6 +430,7 @@ def _deliver_one(delivery: PlannedDelivery, inputs: AlertDeliveryWorkflowInputs)alert_id=str(delivery.alert.id),destination_id=str(delivery.destination.id),)+ _record_delivery_outcome(delivery.destination, error="Slack integration is missing or was revoked")return Falseclaimed_at = _claim_thread(thread, inputs)@@ -254,6 +438,15 @@ def _deliver_one(delivery: PlannedDelivery, inputs: AlertDeliveryWorkflowInputs)# Everything below reads row state written by whoever held the claim last.thread.refresh_from_db()posted = _post_claimed(client, thread, delivery, inputs, claimed_at)+ except SlackApiError as error:+ if _slack_error_code(error) in SLACK_TERMINAL_ERRORS:+ # Nothing to retry for this destination, so the notification counts as+ # handled here: an activity retry for a sibling destination's transient+ # failure must not call Slack for this one again.+ _finalize_thread(thread, inputs, claimed_at)+ else:+ _release_thread(thread, inputs, claimed_at)+ raiseexcept Exception:# A failed post frees the thread for whoever comes next; this notification's# retry then lands wherever the thread is by that time.@@ -283,6 +476,7 @@ def _post_claimed(return Falsechannel = delivery.destination.config.get("channel")if not channel:+ _record_delivery_outcome(delivery.destination, error="Destination has no Slack channel configured")return False# Transitions run as independent workflows, so a later one (resolved, assigned)# can land before the opener: the root shows the issue row as it is now, not@@ -290,7 +484,14 @@ def _post_claimed(root_inputs = _with_current_status(inputs)message = build_root_message(root_inputs)response = client.chat_postMessage(channel=channel, blocks=message["blocks"], text=message["text"])- external_ref = {"channel": response["channel"], "ts": response["ts"], "root_status": root_inputs.status}+ # The rooting notification is recorded so a later attempt of it can tell+ # its own root from an older conversation.+ external_ref = {+ "channel": response["channel"],+ "ts": response["ts"],+ "notification_id": inputs.notification_id,+ "root_status": root_inputs.status,+ }root_headline = message["headline"]else:reply = build_reply_text(inputs)@@ -301,17 +502,33 @@ def _post_claimed(client.chat_postMessage(channel=external_ref["channel"], thread_ts=external_ref["ts"], text=reply)external_ref = _reconcile_root_status(client, thread, inputs)+ _finalize_thread(thread, inputs, claimed_at, external_ref=external_ref, root_headline=root_headline)+ _record_delivery_outcome(delivery.destination, error=None)+ return True+++def _finalize_thread(+ thread: ErrorTrackingAlertThread,+ inputs: AlertDeliveryWorkflowInputs,+ claimed_at: datetime,+ *,+ external_ref: dict | None = None,+ root_headline: str | None = None,+) -> None:+ """Record the notification as handled on the thread and release the claim.++ Fenced on the claim time: a holder that outlived the TTL and was superseded must+ not overwrite the successor's state or clear the successor's claim.+ """delivered_ids = [*(thread.delivered_notification_ids or []), inputs.notification_id][-DELIVERED_NOTIFICATION_IDS_CAP:]- # Fenced on the claim time: a holder that outlived the TTL and was superseded- # must not overwrite the successor's state or clear the successor's claim.finalized = (ErrorTrackingAlertThread.objects.for_team(thread.team_id, canonical=True).filter(id=thread.id, pending_notification_id=inputs.notification_id, pending_claimed_at=claimed_at).update(- external_ref=external_ref,- root_headline=root_headline,+ external_ref=external_ref if external_ref is not None else thread.external_ref,+ root_headline=root_headline if root_headline is not None else thread.root_headline,delivered_notification_ids=delivered_ids,pending_notification_id=None,pending_claimed_at=None,@@ -324,7 +541,6 @@ def _post_claimed(thread_id=str(thread.id),notification_id=inputs.notification_id,)- return Truedef _claim_thread(thread: ErrorTrackingAlertThread, inputs: AlertDeliveryWorkflowInputs) -> datetime:diff --git a/products/error_tracking/backend/tests/api/test_alerts_api.py b/products/error_tracking/backend/tests/api/test_alerts_api.pyindex 3f820df2cb17..3d53c5abc316 100644--- a/products/error_tracking/backend/tests/api/test_alerts_api.py+++ b/products/error_tracking/backend/tests/api/test_alerts_api.py@@ -179,6 +179,7 @@ class TestErrorTrackingAlerts(APIBaseTest):("empty_triggers", {"triggers": []}),("empty_destinations", {"destinations": []}),("negative_throttle", {"throttle_seconds": -1}),+ ("throttle_over_30_days", {"throttle_seconds": 30 * 24 * 60 * 60 + 1}),("unknown_channel",{"destinations": [{"channel_type": "carrier_pigeon", "integration_id": 1, "config": {}}]},diff --git a/products/error_tracking/backend/tests/test_alert_delivery.py b/products/error_tracking/backend/tests/test_alert_delivery.pyindex d543fd983766..74469018977d 100644--- a/products/error_tracking/backend/tests/test_alert_delivery.py+++ b/products/error_tracking/backend/tests/test_alert_delivery.py@@ -12,17 +12,22 @@ from django.test import SimpleTestCasefrom django.utils import timezonefrom parameterized import parameterized+from slack_sdk.errors import SlackApiError+from slack_sdk.web.slack_response import SlackResponsefrom temporalio.common import WorkflowIDReusePolicyfrom temporalio.exceptions import ApplicationError, WorkflowAlreadyStartedErrorfrom posthog.cdp.filters import compile_filters_bytecodefrom posthog.models.integration import Integrationfrom posthog.models.scoping import team_scope+from posthog.redis import get_client+from products.error_tracking.backend.logic.alerts import MAX_THROTTLE_SECONDS, update_alertfrom products.error_tracking.backend.models import ErrorTrackingAlert, ErrorTrackingAlertThread, ErrorTrackingIssuefrom products.error_tracking.backend.tasks.tasks import dispatch_error_tracking_alert_deliveriesfrom products.error_tracking.backend.temporal.alerts.activities import deliver_alert_notifications_activityfrom products.error_tracking.backend.temporal.alerts.delivery import (+ ALERT_THROTTLE_KEY_PREFIX,PENDING_CLAIM_TTL,AlertDeliveryError,AlertThreadBusyError,@@ -89,6 +94,18 @@ class AlertTestMixin(BaseTest):client.chat_postMessage.return_value = {"channel": "C0123", "ts": "111.222"}return client+ def _slack_error(self, code: str, status: int = 200, headers: dict | None = None) -> SlackApiError:+ response = SlackResponse(+ client=None,+ http_verb="POST",+ api_url="https://slack.com/api/chat.postMessage",+ req_args={},+ data={"ok": False, "error": code},+ headers=headers or {},+ status_code=status,+ )+ return SlackApiError(f"slack {code}", response)+def _thread(self, alert, *, rooted=True) -> ErrorTrackingAlertThread:with team_scope(self.team.id):return ErrorTrackingAlertThread.objects.create(@@ -96,7 +113,7 @@ class AlertTestMixin(BaseTest):alert=alert,issue=self.issue,destination=alert.destinations.get(),- external_ref={"channel": "C0123", "ts": "111.222"} if rooted else {},+ external_ref={"channel": "C0123", "ts": "111.222", "notification_id": "notif-root"} if rooted else {},root_headline="🔴 New issue" if rooted else "",)@@ -276,7 +293,12 @@ class TestSlackThreadDelivery(AlertTestMixin):assert "TypeError" in kwargs["text"]with team_scope(self.team.id):thread = ErrorTrackingAlertThread.objects.get(alert=alert, issue=self.issue)- assert thread.external_ref == {"channel": "C0123", "ts": "111.222", "root_status": "Active"}+ assert thread.external_ref == {+ "channel": "C0123",+ "ts": "111.222",+ "notification_id": "notif-1",+ "root_status": "Active",+ }assert thread.root_headline == "🔴 New issue"assert thread.delivered_notification_ids == ["notif-1"]@@ -443,6 +465,10 @@ class TestSlackThreadDelivery(AlertTestMixin):"products.error_tracking.backend.temporal.alerts.activities.deliver_alert_notifications",side_effect=AlertThreadBusyError("busy"),),+ patch(+ "products.error_tracking.backend.temporal.alerts.activities.activity.info",+ return_value=MagicMock(attempt=1),+ ),self.assertRaises(ApplicationError) as raised,):deliver_alert_notifications_activity(self._inputs("$error_tracking_issue_created"))@@ -521,7 +547,12 @@ class TestSlackThreadDelivery(AlertTestMixin):assert delivered == 1assert client.chat_postMessage.call_args.kwargs["channel"] == "C0123"thread.refresh_from_db()- assert thread.external_ref == {"channel": "C0123", "ts": "111.222", "root_status": "Active"}+ assert thread.external_ref == {+ "channel": "C0123",+ "ts": "111.222",+ "notification_id": "notif-1",+ "root_status": "Active",+ }assert thread.delivered_notification_ids == ["notif-1"]def test_root_header_stays_within_slack_limit(self):@@ -579,6 +610,73 @@ class TestSlackThreadDelivery(AlertTestMixin):rooted = [t for t in ErrorTrackingAlertThread.objects.filter(issue=self.issue) if t.external_ref.get("ts")]assert len(rooted) == 1+ @parameterized.expand([("not_in_channel",), ("channel_not_found",), ("token_revoked",), ("missing_scope",)])+ def test_terminal_slack_errors_are_recorded_and_not_retried(self, code):+ # No retry fixes a missing channel or a dead token, so the destination is+ # marked failed and the notification completes without burning attempts.+ client = self._mock_slack()+ client.chat_postMessage.side_effect = self._slack_error(code)+ alert = self._create_alert(triggers=["issue_created"])++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 0++ client.chat_postMessage.assert_called_once()+ with team_scope(self.team.id):+ destination = alert.destinations.get()+ thread = ErrorTrackingAlertThread.objects.get(alert=alert, issue=self.issue)+ assert destination.last_error == f"Slack error: {code}"+ assert destination.consecutive_failures == 1+ assert thread.pending_notification_id is None++ def test_terminal_failure_is_not_recalled_when_a_sibling_destination_retries(self):+ # Destination A is terminal, destination B is rate limited: the activity retries+ # for B, and that retry must not call Slack for A again.+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ with team_scope(self.team.id):+ alert.destinations.create(+ team=self.team, channel_type="slack", integration=self.integration, config={"channel": "C0456"}+ )+ client.chat_postMessage.side_effect = [+ self._slack_error("not_in_channel"),+ self._slack_error("ratelimited", 429, {"Retry-After": "1"}),+ {"channel": "C0456", "ts": "333.444"},+ ]+ inputs = self._inputs("$error_tracking_issue_created")++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs)+ assert deliver_alert_notifications(inputs) == 1++ channels = [c.kwargs["channel"] for c in client.chat_postMessage.call_args_list]+ terminal_channel, retried_channel = channels[0], channels[1]+ assert terminal_channel != retried_channel+ assert channels == [terminal_channel, retried_channel, retried_channel]++ def test_throttle_key_ttl_is_capped(self):+ # throttle_seconds is project-controlled; a per-issue key must not outlive the cap in shared Redis.+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ with team_scope(self.team.id):+ ErrorTrackingAlert.objects.filter(id=alert.id).update(throttle_seconds=2**31 - 1)++ with patch("products.error_tracking.backend.temporal.alerts.delivery.get_client") as redis:+ redis.return_value.set.return_value = True+ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 1++ assert redis.return_value.set.call_args.kwargs["ex"] == MAX_THROTTLE_SECONDS+ client.chat_postMessage.assert_called_once()++ def test_rate_limited_slack_call_retries_after_the_window(self):+ client = self._mock_slack()+ client.chat_postMessage.side_effect = self._slack_error("ratelimited", 429, {"Retry-After": "30"})+ self._create_alert(triggers=["issue_created"])++ with self.assertRaises(AlertDeliveryError) as raised:+ deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ assert raised.exception.next_retry_delay == timedelta(seconds=30)+class TestAlertFilterEvaluation(AlertTestMixin):def _create_filtered_alert(self, filters: dict, *, triggers=None) -> ErrorTrackingAlert:@@ -866,6 +964,244 @@ class TestAlertFilterEvaluation(AlertTestMixin):client.chat_postMessage.assert_not_called()+class TestAlertThrottlingAndOutcomes(AlertTestMixin):+ def _set_throttle(self, alert, seconds: int) -> None:+ with team_scope(self.team.id):+ ErrorTrackingAlert.objects.filter(id=alert.id).update(throttle_seconds=seconds)++ def _prune_threads(self, alert) -> None:+ with team_scope(self.team.id):+ ErrorTrackingAlertThread.objects.filter(alert=alert).delete()++ def test_opener_throttle_limits_reopened_conversations(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 1+ # After a thread is pruned, the next opener inside the window stays quiet.+ self._prune_threads(alert)+ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created", notification_id="n-2")) == 0++ client.chat_postMessage.assert_called_once()+ with team_scope(self.team.id):+ assert not ErrorTrackingAlertThread.objects.filter(alert=alert).exists()++ def test_zero_throttle_never_limits(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 1+ self._prune_threads(alert)+ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created", notification_id="n-2")) == 1++ assert client.chat_postMessage.call_count == 2++ def test_throttle_window_claimer_can_retry(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ client.chat_postMessage.side_effect = [Exception("transient"), {"channel": "C0123", "ts": "111.222"}]+ inputs = self._inputs("$error_tracking_issue_created")++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs)+ # The failed attempt claimed the window; its own retry must still deliver.+ assert deliver_alert_notifications(inputs) == 1++ def test_unrooted_thread_bypasses_a_window_held_by_another_notification(self):+ # A failed opener's retry must survive its throttle claim expiring and a+ # different notification taking the window: the unrooted row keeps it+ # retryable.+ self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ thread = self._thread(alert, rooted=False)+ get_client().set(f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}", "someone-else", ex=3600)++ delivered = deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ assert delivered == 1+ thread.refresh_from_db()+ assert thread.external_ref.get("ts") == "111.222"++ def test_terminal_opener_failure_releases_the_window_for_a_repaired_destination(self):+ # The root was never posted, so the user's repair (a new channel) must+ # alert inside the window instead of waiting for the key to expire.+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ client.chat_postMessage.side_effect = [+ self._slack_error("channel_not_found"),+ {"channel": "C0999", "ts": "5.6"},+ ]++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 0+ with team_scope(self.team.id):+ update_alert(+ self.team.id,+ alert.id,+ destinations=[+ {"channel_type": "slack", "integration_id": self.integration.id, "config": {"channel": "C0999"}}+ ],+ )+ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created", notification_id="n-2")) == 1++ assert client.chat_postMessage.call_args.kwargs["channel"] == "C0999"++ def test_window_stays_when_one_destination_rooted_and_another_is_terminal(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ with team_scope(self.team.id):+ alert.destinations.create(+ team=self.team, channel_type="slack", integration=self.integration, config={"channel": "C0456"}+ )+ client.chat_postMessage.side_effect = [+ {"channel": "C0123", "ts": "1.2"},+ self._slack_error("channel_not_found"),+ ]++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 1++ assert get_client().get(f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}") == b"notif-1"++ def test_window_stays_when_a_sibling_rooted_on_an_earlier_attempt(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ with team_scope(self.team.id):+ alert.destinations.create(+ team=self.team, channel_type="slack", integration=self.integration, config={"channel": "C0456"}+ )+ client.chat_postMessage.side_effect = [+ {"channel": "C0123", "ts": "1.2"},+ Exception("transient"),+ self._slack_error("channel_not_found"),+ ]+ inputs = self._inputs("$error_tracking_issue_created")++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs)+ assert deliver_alert_notifications(inputs) == 0++ assert get_client().get(f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}") == b"notif-1"++ def test_an_older_sibling_conversation_does_not_keep_a_failed_opener_claim(self):+ # Destination A rooted in an earlier window and only gets a reply now; the+ # window claimed for the new destination B opened nothing, so it is released.+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ self._thread(alert)+ with team_scope(self.team.id):+ alert.destinations.create(+ team=self.team, channel_type="slack", integration=self.integration, config={"channel": "C0456"}+ )+ terminal = self._slack_error("channel_not_found")++ def post(**kwargs):+ if kwargs["channel"] == "C0456":+ raise terminal+ return {"channel": "C0123", "ts": "3.4"}++ client.chat_postMessage.side_effect = post++ deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ assert get_client().get(f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}") is None++ def test_final_attempt_releases_the_window_of_a_still_failing_opener(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ client.chat_postMessage.side_effect = Exception("transient")+ inputs = self._inputs("$error_tracking_issue_created")+ key = f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}"++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs)+ assert get_client().get(key) == b"notif-1"+ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs, final_attempt=True)++ assert get_client().get(key) is None++ def test_retry_that_turns_terminal_releases_the_window(self):+ # The first attempt claimed the window and left an unrooted row; the retry+ # finds that row, fails for good, and must give the window back.+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ client.chat_postMessage.side_effect = [Exception("transient"), self._slack_error("channel_not_found")]+ inputs = self._inputs("$error_tracking_issue_created")++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(inputs)+ assert deliver_alert_notifications(inputs) == 0++ assert get_client().get(f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}") is None++ def test_release_leaves_another_notifications_window_alone(self):+ self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ self._set_throttle(alert, 3600)+ thread = self._thread(alert, rooted=False)+ key = f"{ALERT_THROTTLE_KEY_PREFIX}:{alert.id}:{self.issue.id}"+ get_client().set(key, "someone-else", ex=3600)+ with team_scope(self.team.id):+ alert.destinations.update(integration=None)++ assert deliver_alert_notifications(self._inputs("$error_tracking_issue_created")) == 0++ assert get_client().get(key) == b"someone-else"+ thread.refresh_from_db()+ assert thread.external_ref == {}++ def test_successful_delivery_records_outcome_and_resets_failures(self):+ self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ with team_scope(self.team.id):+ alert.destinations.update(consecutive_failures=2, last_error="boom")++ deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ with team_scope(self.team.id):+ destination = alert.destinations.get()+ assert destination.last_delivered_at is not None+ assert destination.consecutive_failures == 0+ assert destination.last_error == ""++ def test_failed_delivery_records_outcome(self):+ client = self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ # The API shows last_error to every reader, so the exception text stays in the logs.+ client.chat_postMessage.side_effect = ConnectionError("db-host-1:5432 refused")++ with self.assertRaises(AlertDeliveryError):+ deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ with team_scope(self.team.id):+ destination = alert.destinations.get()+ assert destination.consecutive_failures == 1+ assert destination.last_error == "Delivery failed unexpectedly"+ assert destination.last_failure_at is not None+ assert destination.last_delivered_at is None++ def test_unusable_integration_records_config_gap(self):+ self._mock_slack()+ alert = self._create_alert(triggers=["issue_created"])+ with team_scope(self.team.id):+ alert.destinations.update(integration=None)++ deliver_alert_notifications(self._inputs("$error_tracking_issue_created"))++ with team_scope(self.team.id):+ destination = alert.destinations.get()+ assert "integration" in destination.last_error+ assert destination.consecutive_failures == 1++class TestAlertDeliveryDispatch(AlertTestMixin):def _dispatch(self, *notification_ids: str) -> None:batch = [diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.tsindex ca758d783692..a2775ae6500c 100644--- a/products/error_tracking/frontend/generated/api.schemas.ts+++ b/products/error_tracking/frontend/generated/api.schemas.ts@@ -71,6 +71,20 @@ export interface ErrorTrackingAlertDestinationApi {config: ErrorTrackingAlertSlackConfigApi/** Unique identifier of the destination. */readonly id: string+ /**+ * When a notification last reached this destination.+ * @nullable+ */+ readonly last_delivered_at: string | null+ /**+ * When delivery to this destination last failed.+ * @nullable+ */+ readonly last_failure_at: string | null+ /** Message of the most recent delivery failure. */+ readonly last_error: string+ /** Delivery failures since the last successful delivery. */+ readonly consecutive_failures: number}export interface ErrorTrackingAlertApi {@@ -128,9 +142,9 @@ export interface ErrorTrackingAlertCreateRequestApi {/** Property filters a transition must match to open a notification thread. Same shape as hog function filters; the bytecode is compiled on save. */filters?: ErrorTrackingAlertFiltersApi/**- * Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number/** Delivery targets notifications fan out to. */@@ -148,9 +162,9 @@ export interface ErrorTrackingAlertPutRequestApi {/** Property filters a transition must match to open a notification thread. Same shape as hog function filters; the bytecode is compiled on save. */filters?: ErrorTrackingAlertFiltersApi/**- * Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number/** Delivery targets notifications fan out to. */@@ -172,9 +186,9 @@ export interface PatchedErrorTrackingAlertUpdateRequestApi {/** Property filters a transition must match to open a notification thread. Omit to keep the current filters. */filters?: ErrorTrackingAlertFiltersApi/**- * Minimum seconds between thread-opening notifications per issue. Omit to keep the current value.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. Omit to keep the current value.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number/** Delivery targets notifications fan out to. When provided, replaces all current destinations. */diff --git a/products/error_tracking/frontend/generated/api.zod.ts b/products/error_tracking/frontend/generated/api.zod.tsindex 6e463181ad48..c4d736da781b 100644--- a/products/error_tracking/frontend/generated/api.zod.ts+++ b/products/error_tracking/frontend/generated/api.zod.ts@@ -13,7 +13,7 @@ export const errorTrackingAlertsCreateBodyNameMax = 400export const errorTrackingAlertsCreateBodyThrottleSecondsDefault = 0export const errorTrackingAlertsCreateBodyThrottleSecondsMin = 0-export const errorTrackingAlertsCreateBodyThrottleSecondsMax = 2147483647+export const errorTrackingAlertsCreateBodyThrottleSecondsMax = 2592000export const ErrorTrackingAlertsCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(errorTrackingAlertsCreateBodyNameMax).describe('Human-readable name of the alert.'),@@ -52,7 +52,9 @@ export const ErrorTrackingAlertsCreateBody = /* @__PURE__ */ zod.object({.min(errorTrackingAlertsCreateBodyThrottleSecondsMin).max(errorTrackingAlertsCreateBodyThrottleSecondsMax).default(errorTrackingAlertsCreateBodyThrottleSecondsDefault)- .describe('Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.'),+ .describe(+ 'Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.'+ ),destinations: zod.array(zod.object({@@ -82,7 +84,7 @@ export const errorTrackingAlertsUpdateBodyNameMax = 400export const errorTrackingAlertsUpdateBodyThrottleSecondsDefault = 0export const errorTrackingAlertsUpdateBodyThrottleSecondsMin = 0-export const errorTrackingAlertsUpdateBodyThrottleSecondsMax = 2147483647+export const errorTrackingAlertsUpdateBodyThrottleSecondsMax = 2592000export const errorTrackingAlertsUpdateBodyEnabledDefault = true@@ -123,7 +125,9 @@ export const ErrorTrackingAlertsUpdateBody = /* @__PURE__ */ zod.object({.min(errorTrackingAlertsUpdateBodyThrottleSecondsMin).max(errorTrackingAlertsUpdateBodyThrottleSecondsMax).default(errorTrackingAlertsUpdateBodyThrottleSecondsDefault)- .describe('Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.'),+ .describe(+ 'Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.'+ ),destinations: zod.array(zod.object({@@ -156,7 +160,7 @@ export const ErrorTrackingAlertsUpdateBody = /* @__PURE__ */ zod.object({export const errorTrackingAlertsPartialUpdateBodyNameMax = 400export const errorTrackingAlertsPartialUpdateBodyThrottleSecondsMin = 0-export const errorTrackingAlertsPartialUpdateBodyThrottleSecondsMax = 2147483647+export const errorTrackingAlertsPartialUpdateBodyThrottleSecondsMax = 2592000export const ErrorTrackingAlertsPartialUpdateBody = /* @__PURE__ */ zod.object({name: zod@@ -204,7 +208,9 @@ export const ErrorTrackingAlertsPartialUpdateBody = /* @__PURE__ */ zod.object({.min(errorTrackingAlertsPartialUpdateBodyThrottleSecondsMin).max(errorTrackingAlertsPartialUpdateBodyThrottleSecondsMax).optional()- .describe('Minimum seconds between thread-opening notifications per issue. Omit to keep the current value.'),+ .describe(+ 'Minimum seconds between thread-opening notifications per issue, at most 30 days. Omit to keep the current value.'+ ),destinations: zod.array(zod.object({diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex fe365cc0951a..9fcf32580fe7 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -34058,6 +34058,20 @@ export namespace Schemas {config: ErrorTrackingAlertSlackConfig;/** Unique identifier of the destination. */readonly id: string;+ /**+ * When a notification last reached this destination.+ * @nullable+ */+ readonly last_delivered_at: string | null;+ /**+ * When delivery to this destination last failed.+ * @nullable+ */+ readonly last_failure_at: string | null;+ /** Message of the most recent delivery failure. */+ readonly last_error: string;+ /** Delivery failures since the last successful delivery. */+ readonly consecutive_failures: number;}export interface ErrorTrackingAlert {@@ -34106,9 +34120,9 @@ export namespace Schemas {/** Property filters a transition must match to open a notification thread. Same shape as hog function filters; the bytecode is compiled on save. */filters?: ErrorTrackingAlertFilters;/**- * Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number;/** Delivery targets notifications fan out to. */@@ -34126,9 +34140,9 @@ export namespace Schemas {/** Property filters a transition must match to open a notification thread. Same shape as hog function filters; the bytecode is compiled on save. */filters?: ErrorTrackingAlertFilters;/**- * Minimum seconds between thread-opening notifications per issue. 0 disables the throttle.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. 0 disables the throttle.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number;/** Delivery targets notifications fan out to. */@@ -67564,9 +67578,9 @@ export namespace Schemas {/** Property filters a transition must match to open a notification thread. Omit to keep the current filters. */filters?: ErrorTrackingAlertFilters;/**- * Minimum seconds between thread-opening notifications per issue. Omit to keep the current value.+ * Minimum seconds between thread-opening notifications per issue, at most 30 days. Omit to keep the current value.* @minimum 0- * @maximum 2147483647+ * @maximum 2592000*/throttle_seconds?: number;/** Delivery targets notifications fan out to. When provided, replaces all current destinations. */