: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(signals): add bulk state transition and constrain dismissal reason (#65008)
posthog[bot]573cd329d123
diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 8cf9af73f13d..ad64ac03bab4 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -513,6 +513,11 @@ SPECTACULAR_SETTINGS = {# generated names so the shared enums don't get component-prefixed auto-names on collision."ExperimentTypeEnum": ["web", "product", None],"ExperimentStatusEnum": ["draft", "running", "paused", "stopped"],+ # Signals now has two serializers (single SignalReportStateRequest + bulk+ # SignalReportBulkStateRequest) that both expose the same `state` ChoiceField. Pin the+ # shared enum to a stable name so it doesn't collide with the other `state` enums+ # (tasks, cdp) into a component-prefixed auto-name.+ "SignalReportStateEnum": ["suppressed", "potential"],# Two serializers now expose an `op` ChoiceField (metrics filters and email-template design# patches). Pin both to stable names so neither gets a component-prefixed auto-name on collision.# "OpEnum" keeps the metrics filter enum at its pre-existing generated name.diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.pyindex b181095d1801..f7d0363484b5 100644--- a/products/signals/backend/test/test_signal_report_api.py+++ b/products/signals/backend/test/test_signal_report_api.py@@ -992,13 +992,12 @@ class TestSignalReportSuppressionAPI(APIBaseTest):None,"free-form note",),- # The caller (PostHog Code) owns the set of valid reason codes; the API persists whatever it gets.(- "suppress_accepts_arbitrary_reason",- {"state": "suppressed", "dismissal_reason": "some_brand_new_code"},+ "suppress_with_other_reason",+ {"state": "suppressed", "dismissal_reason": "other", "dismissal_note": "edge case"},SignalReport.Status.SUPPRESSED,- "some_brand_new_code",- None,+ "other",+ "edge case",),("snooze_with_reason_and_note",@@ -1083,6 +1082,11 @@ class TestSignalReportSuppressionAPI(APIBaseTest):"oversized_dismissal_note",{"state": "suppressed", "dismissal_reason": "other", "dismissal_note": "x" * 4001},),+ # Reason codes are now constrained to the canonical inbox set, so invented codes are rejected.+ (+ "non_canonical_dismissal_reason",+ {"state": "suppressed", "dismissal_reason": "some_brand_new_code"},+ ),])def test_state_transition_rejects_invalid_dismissal(self, _name, body):@@ -1305,3 +1309,125 @@ class TestAvailableReviewersAPI(APIBaseTest):response = self.client.get(self._url())assert response.status_code == status.HTTP_200_OKassert response.json() == {}+++class TestSignalReportBulkStateAPI(APIBaseTest):+ def _bulk_url(self) -> str:+ return f"/api/projects/{self.team.id}/signals/reports/bulk-state/"++ def _create_report(self, team=None, report_status=SignalReport.Status.READY) -> SignalReport:+ return SignalReport.objects.create(+ team=team or self.team,+ status=report_status,+ title="Test report",+ summary="Test summary",+ )++ def _post(self, body: dict):+ return self.client.post(self._bulk_url(), data=json.dumps(body), content_type="application/json")++ def test_bulk_suppress_transitions_all_reports(self):+ reports = [self._create_report() for _ in range(3)]+ ids = [str(r.id) for r in reports]++ response = self._post({"ids": ids, "state": "suppressed", "dismissal_reason": "wontfix_intentional"})++ assert response.status_code == status.HTTP_200_OK, response.json()+ body = response.json()+ assert body["transitioned_count"] == 3+ assert body["skipped_count"] == 0+ assert body["failed_count"] == 0+ assert body["not_found_count"] == 0+ # Results are in request order, each carrying the post-transition status.+ assert [row["id"] for row in body["results"]] == ids+ assert all(row["outcome"] == "transitioned" for row in body["results"])+ assert all(row["status"] == SignalReport.Status.SUPPRESSED for row in body["results"])++ for report in reports:+ report.refresh_from_db()+ assert report.status == SignalReport.Status.SUPPRESSED+ artefacts = SignalReportArtefact.objects.filter(+ report=report, type=SignalReportArtefact.ArtefactType.DISMISSAL+ )+ assert artefacts.count() == 1+ assert json.loads(artefacts.get().content)["reason"] == "wontfix_intentional"++ def test_bulk_skips_disallowed_transitions_but_processes_the_rest(self):+ ready = self._create_report(report_status=SignalReport.Status.READY)+ # POTENTIAL -> POTENTIAL is not an allowed transition, so it comes back as `skipped`.+ already_potential = self._create_report(report_status=SignalReport.Status.POTENTIAL)++ response = self._post({"ids": [str(ready.id), str(already_potential.id)], "state": "potential"})++ assert response.status_code == status.HTTP_200_OK, response.json()+ body = response.json()+ assert body["transitioned_count"] == 1+ assert body["skipped_count"] == 1+ outcomes = {row["id"]: row["outcome"] for row in body["results"]}+ assert outcomes[str(ready.id)] == "transitioned"+ assert outcomes[str(already_potential.id)] == "skipped"++ ready.refresh_from_db()+ assert ready.status == SignalReport.Status.POTENTIAL++ def test_bulk_reports_not_found_for_unknown_and_other_team_ids(self):+ mine = self._create_report()+ other_team = Team.objects.create(organization=self.organization, name="other")+ other_teams_report = self._create_report(team=other_team)+ missing_id = "00000000-0000-0000-0000-000000000000"++ response = self._post({"ids": [str(mine.id), str(other_teams_report.id), missing_id], "state": "suppressed"})++ assert response.status_code == status.HTTP_200_OK, response.json()+ body = response.json()+ assert body["transitioned_count"] == 1+ assert body["not_found_count"] == 2+ outcomes = {row["id"]: row["outcome"] for row in body["results"]}+ assert outcomes[str(mine.id)] == "transitioned"+ # Another team's report is invisible (IDOR boundary) — reported as not_found, never touched.+ assert outcomes[str(other_teams_report.id)] == "not_found"+ assert outcomes[missing_id] == "not_found"++ other_teams_report.refresh_from_db()+ assert other_teams_report.status == SignalReport.Status.READY++ def test_bulk_deduplicates_ids_preserving_order(self):+ first = self._create_report()+ second = self._create_report()+ ids = [str(first.id), str(second.id), str(first.id)]++ response = self._post({"ids": ids, "state": "suppressed"})++ assert response.status_code == status.HTTP_200_OK, response.json()+ body = response.json()+ assert [row["id"] for row in body["results"]] == [str(first.id), str(second.id)]+ assert body["transitioned_count"] == 2++ def test_bulk_restore_reaches_suppressed_reports(self):+ report = self._create_report(report_status=SignalReport.Status.SUPPRESSED)+ report.status_before_suppression = SignalReport.Status.READY+ report.save(update_fields=["status_before_suppression"])++ response = self._post({"ids": [str(report.id)], "state": "potential"})++ assert response.status_code == status.HTTP_200_OK, response.json()+ assert response.json()["transitioned_count"] == 1+ report.refresh_from_db()+ assert report.status == SignalReport.Status.READY++ @parameterized.expand(+ [+ ("empty_ids", {"ids": [], "state": "suppressed"}),+ ("missing_ids", {"state": "suppressed"}),+ ("too_many_ids", {"ids": [f"00000000-0000-0000-0000-{i:012d}" for i in range(101)], "state": "suppressed"}),+ (+ "invalid_reason",+ {"ids": ["00000000-0000-0000-0000-000000000001"], "state": "suppressed", "dismissal_reason": "made_up"},+ ),+ ("invalid_state", {"ids": ["00000000-0000-0000-0000-000000000001"], "state": "ready"}),+ ("non_uuid_id", {"ids": ["not-a-uuid"], "state": "suppressed"}),+ ]+ )+ def test_bulk_rejects_invalid_requests(self, _name, body):+ response = self._post(body)+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 624ec694a4ca..41b4ef2bd0e3 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -5,7 +5,7 @@ from typing import castfrom django.conf import settingsfrom django.core.cache import cache-from django.db import IntegrityError, transaction+from django.db import IntegrityError, models, transactionfrom django.db.models import (BooleanField,Case,@@ -377,6 +377,41 @@ SIGNAL_REPORT_DISMISSAL_NOTE_MAX_LENGTH = 4000# Upper bound on how far a snooze can push out re-promotion. Generous enough for any# realistic snooze, but bounded so a caller can't effectively block a report forever.SIGNAL_REPORT_MAX_SNOOZE_FOR = 100_000+# Upper bound on how many reports a single bulk transition may touch. Keeps one call+# from fanning out into an unbounded write; callers page through larger sets.+SIGNAL_REPORT_BULK_STATE_MAX_IDS = 100++# Canonical dismissal reason codes, mirrored from the inbox UI source of truth at+# frontend/src/scenes/inbox/utils/dismissalReasons.ts (itself a port of desktop's+# packages/shared/src/dismissal-reasons.ts). Constraining the API to these values keeps+# agent-supplied reasons rendering as labelled chips in the inbox instead of raw,+# unrecognised codes. Keep the values (and order) in sync with that file.+SIGNAL_REPORT_DISMISSAL_REASON_CHOICES = [+ ("already_fixed", "Already fixed"),+ ("report_unclear", "Report is unclear to me"),+ ("analysis_wrong", "Agent's analysis is wrong"),+ ("wontfix_intentional", "Won't fix - intentional behavior"),+ ("wontfix_irrelevant", "Won't fix - issue is real but insignificant"),+ ("other", "Something else…"),+]++_DISMISSAL_REASON_HELP_TEXT = (+ "Optional canonical reason code for the dismissal. Must be one of: already_fixed, "+ "report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match "+ "the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' "+ "is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if "+ "the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code."+)+++class SignalReportBulkStateOutcome(models.TextChoices):+ """Per-id result of a bulk state transition. Mirrors the single-report responses:+ `transitioned` ~ 200, `skipped` ~ 409 (transition not allowed), `failed` ~ 400."""++ TRANSITIONED = "transitioned", "transitioned"+ SKIPPED = "skipped", "skipped"+ FAILED = "failed", "failed"+ NOT_FOUND = "not_found", "not_found"class SignalReportStateRequestSerializer(serializers.Serializer):@@ -387,13 +422,10 @@ class SignalReportStateRequestSerializer(serializers.Serializer):"or 'potential' to snooze/reopen it for later review."),)- dismissal_reason = serializers.CharField(+ dismissal_reason = serializers.ChoiceField(required=False,- allow_blank=True,- help_text=(- "Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). "- "The set of reason codes is owned by the caller and is not validated server-side."- ),+ choices=SIGNAL_REPORT_DISMISSAL_REASON_CHOICES,+ help_text=_DISMISSAL_REASON_HELP_TEXT,)dismissal_note = serializers.CharField(required=False,@@ -413,6 +445,56 @@ class SignalReportStateRequestSerializer(serializers.Serializer):)+class SignalReportBulkStateRequestSerializer(SignalReportStateRequestSerializer):+ ids = serializers.ListField(+ child=serializers.UUIDField(),+ allow_empty=False,+ max_length=SIGNAL_REPORT_BULK_STATE_MAX_IDS,+ help_text=(+ "Report ids to transition to `state` in one call (1–"+ f"{SIGNAL_REPORT_BULK_STATE_MAX_IDS}). Duplicates are de-duplicated; each id is "+ "processed independently so one disallowed transition does not block the rest. "+ "`dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id."+ ),+ )+++class SignalReportBulkStateResultSerializer(serializers.Serializer):+ id = serializers.UUIDField(help_text="The report id this result refers to.")+ # CharField (not ChoiceField) on purpose: this is a server-generated response value, so it+ # needs no input validation, and a ChoiceField named `outcome` would collide with another+ # product's `OutcomeEnum` in the shared OpenAPI schema. Values come from SignalReportBulkStateOutcome.+ outcome = serializers.CharField(+ help_text=(+ "One of: transitioned, skipped, failed, not_found. transitioned: the state change was applied. "+ "skipped: the transition was not allowed from the report's current status (a 409 on the "+ "single-report endpoint). failed: the request data was invalid for this report. not_found: no "+ "report with this id is visible to you."+ ),+ )+ status = serializers.CharField(+ required=False,+ allow_null=True,+ help_text="The report's status after the transition. Present only when outcome is 'transitioned'.",+ )+ detail = serializers.CharField(+ required=False,+ allow_null=True,+ help_text="Human-readable explanation for non-transitioned outcomes (skipped / failed / not_found).",+ )+++class SignalReportBulkStateResponseSerializer(serializers.Serializer):+ results = SignalReportBulkStateResultSerializer(+ many=True,+ help_text="One result per requested id, in request order (after de-duplication).",+ )+ transitioned_count = serializers.IntegerField(help_text="Number of reports whose state was changed.")+ skipped_count = serializers.IntegerField(help_text="Number of reports whose transition was not allowed.")+ failed_count = serializers.IntegerField(help_text="Number of reports that failed on invalid request data.")+ not_found_count = serializers.IntegerField(help_text="Number of requested ids not visible to the caller.")++@extend_schema_view(destroy=extend_schema(exclude=True),)@@ -488,10 +570,19 @@ class SignalReportViewSet(# Actions allowed to resolve a suppressed report by ID even without an explicit# `status` filter. These are the read/reopen paths the inbox's Dismissed tab needs:# `state` reopens a dismissed report, `retrieve` loads its detail, and `signals`- # loads its evidence. Mutating-by-ID actions (delete, reingest) are deliberately- # NOT here, so a suppressed report stays unreachable for those and keeps returning- # 404 — matching the existing contract.- _SUPPRESSED_VISIBLE_ACTIONS = frozenset({"state", "retrieve", "signals"})+ # loads its evidence. `bulk_state` is included so a bulk restore (state='potential')+ # can reach suppressed reports too. Mutating-by-ID actions (delete, reingest) are+ # deliberately NOT here, so a suppressed report stays unreachable for those and keeps+ # returning 404 — matching the existing contract.+ _SUPPRESSED_VISIBLE_ACTIONS = frozenset({"state", "bulk_state", "retrieve", "signals"})++ # Human-readable explanation per bulk outcome, surfaced in each result's `detail` field+ # (transitioned needs none — its `status` already says where the report landed).+ _BULK_STATE_OUTCOME_DETAIL = {+ SignalReportBulkStateOutcome.SKIPPED: "This transition is not allowed from the report's current status.",+ SignalReportBulkStateOutcome.FAILED: "The request data was invalid for this report.",+ SignalReportBulkStateOutcome.NOT_FOUND: "No report with this id is visible to you.",+ }def _apply_signal_report_status_filter(self, queryset):status_filter = self.request.query_params.get("status")@@ -1077,7 +1168,7 @@ class SignalReportViewSet(Body: {"state": "suppressed" | "potential",# Optional dismissal feedback (honored when state == "suppressed" or "potential"):- "dismissal_reason": "<any string code, owned by the caller>",+ "dismissal_reason": "<canonical reason code, see SIGNAL_REPORT_DISMISSAL_REASON_CHOICES>","dismissal_note": "free-form text",# Optional, only honored for state == "potential":"snooze_for": <number of additional signals before re-promotion>,@@ -1089,16 +1180,48 @@ class SignalReportViewSet(serializer.is_valid(raise_exception=True)data = serializer.validated_data- target = data["state"]- dismissal_reason = data.get("dismissal_reason")- dismissal_note = data.get("dismissal_note")+ outcome = self._transition_report_state(+ report,+ target=data["state"],+ dismissal_reason=data.get("dismissal_reason"),+ dismissal_note=data.get("dismissal_note"),+ snooze_for=data.get("snooze_for"),+ )++ if outcome == SignalReportBulkStateOutcome.SKIPPED:+ return Response(+ {"error": "Invalid state transition for this report."},+ status=status.HTTP_409_CONFLICT,+ )+ if outcome == SignalReportBulkStateOutcome.FAILED:+ return Response(+ {"error": "Invalid data for state transition."},+ status=status.HTTP_400_BAD_REQUEST,+ )- # Only `snooze_for` (on a snooze back to "potential") is caller-controllable. Every other- # `transition_to` kwarg (signals_at_run_increment, reset_weight, title, summary, error) is an- # internal pipeline concern and must never be reachable from this public API surface, so it is- # passed explicitly rather than splatting caller-supplied kwargs.- snooze_for = data.get("snooze_for") if target == "potential" else None+ return Response(SignalReportSerializer(report, context=self._enriched_report_context(report)).data)+ def _transition_report_state(+ self,+ report: SignalReport,+ *,+ target: str,+ dismissal_reason: str | None,+ dismissal_note: str | None,+ snooze_for: int | None,+ ) -> "SignalReportBulkStateOutcome":+ """+ Apply one report state transition (plus optional dismissal artefact) and return a+ compact outcome. Shared by the single `state` action and the bulk `bulk_state` action+ so both honour the same restore/snooze semantics and transition guards. Expected+ invalid transitions are returned as outcomes (never raised) so a bulk run can record a+ per-id result and keep going.++ Only `snooze_for` (on a snooze back to "potential") is caller-controllable. Every other+ `transition_to` kwarg (signals_at_run_increment, reset_weight, title, summary, error) is an+ internal pipeline concern and must never be reachable from this public API surface, so it is+ passed explicitly rather than splatting caller-supplied kwargs.+ """# "potential" on a suppressed report means "restore" (un-archive): return it to the state it# held before suppression when that was a researched, user-visible report, instead of always# dropping back to potential. snooze_for is irrelevant here and ignored by transition_to.@@ -1106,20 +1229,16 @@ class SignalReportViewSet(if report.status == SignalReport.Status.SUPPRESSED and target_status == SignalReport.Status.POTENTIAL:target_status = report.restore_target_status()+ effective_snooze_for = snooze_for if target == "potential" else None+try:- updated_fields = report.transition_to(target_status, snooze_for=snooze_for)+ updated_fields = report.transition_to(target_status, snooze_for=effective_snooze_for)except InvalidStatusTransition as e:logger.warning("Invalid status transition for SignalReport %s: %s", report.id, e, exc_info=True)- return Response(- {"error": "Invalid state transition for this report."},- status=status.HTTP_409_CONFLICT,- )+ return SignalReportBulkStateOutcome.SKIPPEDexcept (ValueError, TypeError) as e:logger.warning("Invalid data when transitioning SignalReport %s: %s", report.id, e, exc_info=True)- return Response(- {"error": "Invalid data for state transition."},- status=status.HTTP_400_BAD_REQUEST,- )+ return SignalReportBulkStateOutcome.FAILEDwith transaction.atomic():report.save(update_fields=updated_fields)@@ -1128,14 +1247,15 @@ class SignalReportViewSet(# and so multiple dismissals (with different rationales) can stack over time.# Captured for both suppress and snooze (transition to potential) flows.if target in ("suppressed", "potential") and (dismissal_reason or dismissal_note):- user = request.user+ user = self.request.user+ is_authenticated = getattr(user, "is_authenticated", False)+ # getattr (not direct attribute access) so the AnonymousUser branch type-checks.+ user_uuid = getattr(user, "uuid", None) if is_authenticated else Noneartefact_content = {"reason": dismissal_reason,"note": dismissal_note,- "user_id": getattr(user, "id", None) if getattr(user, "is_authenticated", False) else None,- "user_uuid": str(user.uuid)- if getattr(user, "is_authenticated", False) and getattr(user, "uuid", None)- else None,+ "user_id": getattr(user, "id", None) if is_authenticated else None,+ "user_uuid": str(user_uuid) if user_uuid else None,}SignalReportArtefact.objects.create(team=self.team,@@ -1143,13 +1263,87 @@ class SignalReportViewSet(type=SignalReportArtefact.ArtefactType.DISMISSAL,content=json.dumps(artefact_content),)- # get_object() evaluated the dismissal prefetch before this artefact- # existed; drop the stale cache so the response serializer re-reads the+ # The dismissal prefetch may have been evaluated before this artefact+ # existed; drop the stale cache so a follow-up serializer re-reads the# just-written reason/note instead of the previous (or empty) dismissal.if hasattr(report, "prefetched_dismissal_artefacts"):del report.prefetched_dismissal_artefacts- return Response(SignalReportSerializer(report, context=self._enriched_report_context(report)).data)+ return SignalReportBulkStateOutcome.TRANSITIONED++ @extend_schema(+ request=SignalReportBulkStateRequestSerializer,+ responses={200: SignalReportBulkStateResponseSerializer},+ )+ @action(detail=False, methods=["post"], url_path="bulk-state", required_scopes=["task:write"])+ def bulk_state(self, request, **kwargs):+ """+ Transition many reports to a new state in one call.++ Each id is processed independently: a report whose transition isn't allowed from its+ current status is reported as `skipped` (a 409 on the single-report endpoint) and the+ rest still go through. Returns one result per requested id (in request order, after+ de-duplication) plus per-outcome counts. The whole call is 200 even on partial failure —+ inspect `results` / the counts to see what happened.+ """+ serializer = SignalReportBulkStateRequestSerializer(data=request.data)+ serializer.is_valid(raise_exception=True)+ data = serializer.validated_data++ target = data["state"]+ dismissal_reason = data.get("dismissal_reason")+ dismissal_note = data.get("dismissal_note")+ snooze_for = data.get("snooze_for")++ # De-duplicate while preserving request order so the response lines up with what was asked.+ ordered_ids: list[str] = []+ seen: set[str] = set()+ for raw_id in data["ids"]:+ key = str(raw_id)+ if key not in seen:+ seen.add(key)+ ordered_ids.append(key)++ # One team-scoped fetch for every requested report. get_queryset() scopes to the team and+ # excludes deleted reports; suppressed reports are reachable because bulk_state is in+ # _SUPPRESSED_VISIBLE_ACTIONS, so bulk restore (state='potential') works too.+ reports_by_id = {str(report.id): report for report in self.get_queryset().filter(id__in=ordered_ids)}++ results: list[dict] = []+ counts: dict[str, int] = {outcome.value: 0 for outcome in SignalReportBulkStateOutcome}+ for report_id in ordered_ids:+ report = reports_by_id.get(report_id)+ if report is None:+ outcome = SignalReportBulkStateOutcome.NOT_FOUND+ report_status = None+ else:+ outcome = self._transition_report_state(+ report,+ target=target,+ dismissal_reason=dismissal_reason,+ dismissal_note=dismissal_note,+ snooze_for=snooze_for,+ )+ report_status = report.status if outcome == SignalReportBulkStateOutcome.TRANSITIONED else None+ results.append(+ {+ "id": report_id,+ "outcome": outcome.value,+ "status": report_status,+ "detail": self._BULK_STATE_OUTCOME_DETAIL.get(outcome),+ }+ )+ counts[outcome.value] += 1++ return Response(+ {+ "results": results,+ "transitioned_count": counts[SignalReportBulkStateOutcome.TRANSITIONED.value],+ "skipped_count": counts[SignalReportBulkStateOutcome.SKIPPED.value],+ "failed_count": counts[SignalReportBulkStateOutcome.FAILED.value],+ "not_found_count": counts[SignalReportBulkStateOutcome.NOT_FOUND.value],+ }+ )@extend_schema(exclude=True)@action(detail=True, methods=["post"], url_path="reingest", required_scopes=["task:write"])diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 375d5c2df560..ec7f120d7ca5 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -122,22 +122,75 @@ export interface PaginatedSignalReportListApi {* * `suppressed` - suppressed* * `potential` - potential*/-export type SignalReportStateRequestStateEnumApi =- (typeof SignalReportStateRequestStateEnumApi)[keyof typeof SignalReportStateRequestStateEnumApi]+export type SignalReportStateEnumApi = (typeof SignalReportStateEnumApi)[keyof typeof SignalReportStateEnumApi]-export const SignalReportStateRequestStateEnumApi = {+export const SignalReportStateEnumApi = {Suppressed: 'suppressed',Potential: 'potential',} as const+/**+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else…+ */+export type DismissalReasonEnumApi = (typeof DismissalReasonEnumApi)[keyof typeof DismissalReasonEnumApi]++export const DismissalReasonEnumApi = {+ AlreadyFixed: 'already_fixed',+ ReportUnclear: 'report_unclear',+ AnalysisWrong: 'analysis_wrong',+ WontfixIntentional: 'wontfix_intentional',+ WontfixIrrelevant: 'wontfix_irrelevant',+ Other: 'other',+} as const+export interface SignalReportStateRequestApi {/** Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.** * `suppressed` - suppressed* * `potential` - potential */- state: SignalReportStateRequestStateEnumApi- /** Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). The set of reason codes is owned by the caller and is not validated server-side. */- dismissal_reason?: string+ state: SignalReportStateEnumApi+ /** Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.+ *+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else… */+ dismissal_reason?: DismissalReasonEnumApi+ /**+ * Optional free-form note explaining the dismissal. Capped at 4000 characters.+ * @maxLength 4000+ */+ dismissal_note?: string+ /**+ * Optional, only honored when state is 'potential'. Number of additional signals the report must accumulate before it is re-promoted into the pipeline — effectively snoozing it until then. Omit to let the report re-enter the pipeline on the next matching signal.+ * @minimum 1+ * @maximum 100000+ */+ snooze_for?: number+}++export interface SignalReportBulkStateRequestApi {+ /** Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.+ *+ * * `suppressed` - suppressed+ * * `potential` - potential */+ state: SignalReportStateEnumApi+ /** Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.+ *+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else… */+ dismissal_reason?: DismissalReasonEnumApi/*** Optional free-form note explaining the dismissal. Capped at 4000 characters.* @maxLength 4000@@ -149,6 +202,41 @@ export interface SignalReportStateRequestApi {* @maximum 100000*/snooze_for?: number+ /**+ * Report ids to transition to `state` in one call (1–100). Duplicates are de-duplicated; each id is processed independently so one disallowed transition does not block the rest. `dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id.+ * @maxItems 100+ */+ ids: string[]+}++export interface SignalReportBulkStateResultApi {+ /** The report id this result refers to. */+ id: string+ /** One of: transitioned, skipped, failed, not_found. transitioned: the state change was applied. skipped: the transition was not allowed from the report's current status (a 409 on the single-report endpoint). failed: the request data was invalid for this report. not_found: no report with this id is visible to you. */+ outcome: string+ /**+ * The report's status after the transition. Present only when outcome is 'transitioned'.+ * @nullable+ */+ status?: string | null+ /**+ * Human-readable explanation for non-transitioned outcomes (skipped / failed / not_found).+ * @nullable+ */+ detail?: string | null+}++export interface SignalReportBulkStateResponseApi {+ /** One result per requested id, in request order (after de-duplication). */+ results: SignalReportBulkStateResultApi[]+ /** Number of reports whose state was changed. */+ transitioned_count: number+ /** Number of reports whose transition was not allowed. */+ skipped_count: number+ /** Number of reports that failed on invalid request data. */+ failed_count: number+ /** Number of requested ids not visible to the caller. */+ not_found_count: number}export type ScoutOriginEnumApi = (typeof ScoutOriginEnumApi)[keyof typeof ScoutOriginEnumApi]diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex a31cd3d7985e..193cd1fc194b 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -25,6 +25,8 @@ import type {ScoutEmissionReportLinkApi,ScratchpadEntryApi,SignalReportApi,+ SignalReportBulkStateRequestApi,+ SignalReportBulkStateResponseApi,SignalReportStateRequestApi,SignalScoutConfigApi,SignalScoutConfigCreateApi,@@ -182,7 +184,7 @@ export const getSignalsReportsStateCreateUrl = (projectId: string, id: string) =* Body: {* "state": "suppressed" | "potential",* # Optional dismissal feedback (honored when state == "suppressed" or "potential"):- * "dismissal_reason": "<any string code, owned by the caller>",+ * "dismissal_reason": "<canonical reason code, see SIGNAL_REPORT_DISMISSAL_REASON_CHOICES>",* "dismissal_note": "free-form text",* # Optional, only honored for state == "potential":* "snooze_for": <number of additional signals before re-promotion>,@@ -202,6 +204,32 @@ export const signalsReportsStateCreate = async (})}+export const getSignalsReportsBulkStateCreateUrl = (projectId: string) => {+ return `/api/projects/${projectId}/signals/reports/bulk-state/`+}++/**+ * Transition many reports to a new state in one call.+ *+ * Each id is processed independently: a report whose transition isn't allowed from its+ * current status is reported as `skipped` (a 409 on the single-report endpoint) and the+ * rest still go through. Returns one result per requested id (in request order, after+ * de-duplication) plus per-outcome counts. The whole call is 200 even on partial failure —+ * inspect `results` / the counts to see what happened.+ */+export const signalsReportsBulkStateCreate = async (+ projectId: string,+ signalReportBulkStateRequestApi: SignalReportBulkStateRequestApi,+ options?: RequestInit+): Promise<SignalReportBulkStateResponseApi> => {+ return apiMutator<SignalReportBulkStateResponseApi>(getSignalsReportsBulkStateCreateUrl(projectId), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(signalReportBulkStateRequestApi),+ })+}+export const getSignalsScoutConfigListUrl = (projectId: string) => {return `/api/projects/${projectId}/signals/scout/configs/`}diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 3ba3f871539a..90a547a06497 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -29,7 +29,7 @@ export const SignalsProcessingPauseUpdateBody = /* @__PURE__ */ zod.object({* Body: {* "state": "suppressed" | "potential",* # Optional dismissal feedback (honored when state == "suppressed" or "potential"):- * "dismissal_reason": "<any string code, owned by the caller>",+ * "dismissal_reason": "<canonical reason code, see SIGNAL_REPORT_DISMISSAL_REASON_CHOICES>",* "dismissal_note": "free-form text",* # Optional, only honored for state == "potential":* "snooze_for": <number of additional signals before re-promotion>,@@ -47,10 +47,20 @@ export const SignalsReportsStateCreateBody = /* @__PURE__ */ zod.object({"Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze\/reopen it for later review.\n\n\* `suppressed` - suppressed\n\* `potential` - potential"),dismissal_reason: zod- .string()+ .enum([+ 'already_fixed',+ 'report_unclear',+ 'analysis_wrong',+ 'wontfix_intentional',+ 'wontfix_irrelevant',+ 'other',+ ])+ .describe(+ "\* `already_fixed` - Already fixed\n\* `report_unclear` - Report is unclear to me\n\* `analysis_wrong` - Agent's analysis is wrong\n\* `wontfix_intentional` - Won't fix - intentional behavior\n\* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n\* `other` - Something else…"+ ).optional().describe(- "Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). The set of reason codes is owned by the caller and is not validated server-side."+ "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n\* `already_fixed` - Already fixed\n\* `report_unclear` - Report is unclear to me\n\* `analysis_wrong` - Agent's analysis is wrong\n\* `wontfix_intentional` - Won't fix - intentional behavior\n\* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n\* `other` - Something else…"),dismissal_note: zod.string()@@ -67,6 +77,65 @@ export const SignalsReportsStateCreateBody = /* @__PURE__ */ zod.object({),})+/**+ * Transition many reports to a new state in one call.+ *+ * Each id is processed independently: a report whose transition isn't allowed from its+ * current status is reported as `skipped` (a 409 on the single-report endpoint) and the+ * rest still go through. Returns one result per requested id (in request order, after+ * de-duplication) plus per-outcome counts. The whole call is 200 even on partial failure —+ * inspect `results` / the counts to see what happened.+ */+export const signalsReportsBulkStateCreateBodyDismissalNoteMax = 4000++export const signalsReportsBulkStateCreateBodySnoozeForMax = 100000++export const signalsReportsBulkStateCreateBodyIdsMax = 100++export const SignalsReportsBulkStateCreateBody = /* @__PURE__ */ zod.object({+ state: zod+ .enum(['suppressed', 'potential'])+ .describe('\* `suppressed` - suppressed\n\* `potential` - potential')+ .describe(+ "Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze\/reopen it for later review.\n\n\* `suppressed` - suppressed\n\* `potential` - potential"+ ),+ dismissal_reason: zod+ .enum([+ 'already_fixed',+ 'report_unclear',+ 'analysis_wrong',+ 'wontfix_intentional',+ 'wontfix_irrelevant',+ 'other',+ ])+ .describe(+ "\* `already_fixed` - Already fixed\n\* `report_unclear` - Report is unclear to me\n\* `analysis_wrong` - Agent's analysis is wrong\n\* `wontfix_intentional` - Won't fix - intentional behavior\n\* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n\* `other` - Something else…"+ )+ .optional()+ .describe(+ "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n\* `already_fixed` - Already fixed\n\* `report_unclear` - Report is unclear to me\n\* `analysis_wrong` - Agent's analysis is wrong\n\* `wontfix_intentional` - Won't fix - intentional behavior\n\* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n\* `other` - Something else…"+ ),+ dismissal_note: zod+ .string()+ .max(signalsReportsBulkStateCreateBodyDismissalNoteMax)+ .optional()+ .describe('Optional free-form note explaining the dismissal. Capped at 4000 characters.'),+ snooze_for: zod+ .number()+ .min(1)+ .max(signalsReportsBulkStateCreateBodySnoozeForMax)+ .optional()+ .describe(+ "Optional, only honored when state is 'potential'. Number of additional signals the report must accumulate before it is re-promoted into the pipeline — effectively snoozing it until then. Omit to let the report re-enter the pipeline on the next matching signal."+ ),+ ids: zod+ .array(zod.uuid())+ .max(signalsReportsBulkStateCreateBodyIdsMax)+ .describe(+ 'Report ids to transition to `state` in one call (1–100). Duplicates are de-duplicated; each id is processed independently so one disallowed transition does not block the rest. `dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id.'+ ),+})+/*** Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting `run_interval_minutes`, `enabled`, and `emit` in the same call. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.* @summary Create a scout configdiff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex ea2887c6f8ac..ec9d06d13f67 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -18,6 +18,25 @@ tools:inbox-processing-pause-update:operation: signals_processing_pause_updateenabled: false+ inbox-reports-bulk-set-state:+ operation: signals_reports_bulk_state_create+ enabled: true+ scopes:+ - task:write+ annotations:+ readOnly: false+ destructive: true+ idempotent: false+ title: Dismiss or snooze signal reports in bulk+ description: >+ Transition many signal reports to the same state in one call — the bulk form of `inbox-reports-set-state`,+ for clearing or snoozing a batch of inbox reports without one request per report. Pass `ids` (1–100 report+ ids) and a `state` ('suppressed' to dismiss, 'potential' to snooze/restore); the optional `dismissal_reason`+ (same canonical codes as the single-report tool), `dismissal_note`, and `snooze_for` apply to every id. Each+ id is processed independently, so the whole call returns 200 even on partial failure: inspect `results` (one+ entry per id, in request order) and the `transitioned_count` / `skipped_count` / `failed_count` /+ `not_found_count` summary. An id whose transition isn't allowed from its current status comes back as+ `skipped` (the single-report 409) while the rest still go through.inbox-reports-list:operation: signals_reports_listenabled: true@@ -83,12 +102,16 @@ tools:enrich_url: '{id}'title: Dismiss or snooze a signal reportdescription: >- Transition a signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the user- has reviewed it and decided no action is needed), or 'potential' to snooze it back into the pipeline for- later review. Optionally include a `dismissal_reason` (a short string code owned by the caller, e.g.- 'not_a_bug', 'wont_fix', 'duplicate') and a `dismissal_note` (free-form text, up to 4000 chars) — both are- persisted as a DISMISSAL artefact on the report so the rationale is preserved even if the report transitions- again later. Returns 409 if the transition is not allowed from the report's current status.+ Transition a single signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the+ user has reviewed it and decided no action is needed), or 'potential' to snooze/restore it back into the+ pipeline for later review. Optionally include a `dismissal_reason` — a canonical code from the inbox UI+ (`already_fixed`, `report_unclear`, `analysis_wrong`, `wontfix_intentional`, `wontfix_irrelevant`, `other`),+ so it renders as a labelled chip rather than a raw string. `already_fixed` is a snooze, not a dismissal:+ pair it with state='potential'. Use `other` plus a `dismissal_note` (free-form text, up to 4000 chars) for+ anything that doesn't fit a code. Both are persisted as a DISMISSAL artefact on the report so the rationale+ survives later transitions. Returns 409 if the transition is not allowed from the report's current status.+ To transition several reports at once, use `inbox-reports-bulk-set-state` instead of calling this per+ report.inbox-source-configs-create:operation: signals_source_configs_createenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 9797c717566f..cc407787e1e1 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -3614,6 +3614,20 @@},"feature_flag": "heatmaps-mcp"},+ "inbox-reports-bulk-set-state": {+ "description": "Transition many signal reports to the same state in one call — the bulk form of `inbox-reports-set-state`, for clearing or snoozing a batch of inbox reports without one request per report. Pass `ids` (1–100 report ids) and a `state` ('suppressed' to dismiss, 'potential' to snooze/restore); the optional `dismissal_reason` (same canonical codes as the single-report tool), `dismissal_note`, and `snooze_for` apply to every id. Each id is processed independently, so the whole call returns 200 even on partial failure: inspect `results` (one entry per id, in request order) and the `transitioned_count` / `skipped_count` / `failed_count` / `not_found_count` summary. An id whose transition isn't allowed from its current status comes back as `skipped` (the single-report 409) while the rest still go through.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Dismiss or snooze signal reports in bulk",+ "title": "Dismiss or snooze signal reports in bulk",+ "required_scopes": ["task:write"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-reports-list": {"description": "List signal reports for the current project. A signal report is a cluster of related observations (signals) that PostHog has aggregated into a single issue or trend. Reports surface in the Inbox. Supports filtering by status (potential, candidate, in_progress, pending_input, ready, resolved, failed, suppressed), free-text search across title and summary, source_product (e.g. error_tracking, session_replay), and suggested_reviewers (PostHog user UUIDs). Results are paginated and ordered by '-is_suggested_reviewer,status,-updated_at' by default.","category": "Signals",@@ -3643,7 +3657,7 @@}},"inbox-reports-set-state": {- "description": "Transition a signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the user has reviewed it and decided no action is needed), or 'potential' to snooze it back into the pipeline for later review. Optionally include a `dismissal_reason` (a short string code owned by the caller, e.g. 'not_a_bug', 'wont_fix', 'duplicate') and a `dismissal_note` (free-form text, up to 4000 chars) — both are persisted as a DISMISSAL artefact on the report so the rationale is preserved even if the report transitions again later. Returns 409 if the transition is not allowed from the report's current status.",+ "description": "Transition a single signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the user has reviewed it and decided no action is needed), or 'potential' to snooze/restore it back into the pipeline for later review. Optionally include a `dismissal_reason` — a canonical code from the inbox UI (`already_fixed`, `report_unclear`, `analysis_wrong`, `wontfix_intentional`, `wontfix_irrelevant`, `other`), so it renders as a labelled chip rather than a raw string. `already_fixed` is a snooze, not a dismissal: pair it with state='potential'. Use `other` plus a `dismissal_note` (free-form text, up to 4000 chars) for anything that doesn't fit a code. Both are persisted as a DISMISSAL artefact on the report so the rationale survives later transitions. Returns 409 if the transition is not allowed from the report's current status. To transition several reports at once, use `inbox-reports-bulk-set-state` instead of calling this per report.","category": "Signals","feature": "signals","summary": "Dismiss or snooze a signal report",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 0a3bf336abcd..0203895ff846 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -3882,6 +3882,20 @@},"feature_flag": "heatmaps-mcp"},+ "inbox-reports-bulk-set-state": {+ "description": "Transition many signal reports to the same state in one call — the bulk form of `inbox-reports-set-state`, for clearing or snoozing a batch of inbox reports without one request per report. Pass `ids` (1–100 report ids) and a `state` ('suppressed' to dismiss, 'potential' to snooze/restore); the optional `dismissal_reason` (same canonical codes as the single-report tool), `dismissal_note`, and `snooze_for` apply to every id. Each id is processed independently, so the whole call returns 200 even on partial failure: inspect `results` (one entry per id, in request order) and the `transitioned_count` / `skipped_count` / `failed_count` / `not_found_count` summary. An id whose transition isn't allowed from its current status comes back as `skipped` (the single-report 409) while the rest still go through.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Dismiss or snooze signal reports in bulk",+ "title": "Dismiss or snooze signal reports in bulk",+ "required_scopes": ["task:write"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-reports-list": {"description": "List signal reports for the current project. A signal report is a cluster of related observations (signals) that PostHog has aggregated into a single issue or trend. Reports surface in the Inbox. Supports filtering by status (potential, candidate, in_progress, pending_input, ready, resolved, failed, suppressed), free-text search across title and summary, source_product (e.g. error_tracking, session_replay), and suggested_reviewers (PostHog user UUIDs). Results are paginated and ordered by '-is_suggested_reviewer,status,-updated_at' by default.","category": "Signals",@@ -3911,7 +3925,7 @@}},"inbox-reports-set-state": {- "description": "Transition a signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the user has reviewed it and decided no action is needed), or 'potential' to snooze it back into the pipeline for later review. Optionally include a `dismissal_reason` (a short string code owned by the caller, e.g. 'not_a_bug', 'wont_fix', 'duplicate') and a `dismissal_note` (free-form text, up to 4000 chars) — both are persisted as a DISMISSAL artefact on the report so the rationale is preserved even if the report transitions again later. Returns 409 if the transition is not allowed from the report's current status.",+ "description": "Transition a single signal report to a new state. Use 'suppressed' to dismiss the report from the inbox (the user has reviewed it and decided no action is needed), or 'potential' to snooze/restore it back into the pipeline for later review. Optionally include a `dismissal_reason` — a canonical code from the inbox UI (`already_fixed`, `report_unclear`, `analysis_wrong`, `wontfix_intentional`, `wontfix_irrelevant`, `other`), so it renders as a labelled chip rather than a raw string. `already_fixed` is a snooze, not a dismissal: pair it with state='potential'. Use `other` plus a `dismissal_note` (free-form text, up to 4000 chars) for anything that doesn't fit a code. Both are persisted as a DISMISSAL artefact on the report so the rationale survives later transitions. Returns 409 if the transition is not allowed from the report's current status. To transition several reports at once, use `inbox-reports-bulk-set-state` instead of calling this per report.","category": "Signals","feature": "signals","summary": "Dismiss or snooze a signal report",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 721830aed0a4..916e8b4c9a8a 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -17225,6 +17225,26 @@ export namespace Schemas {checks: DiagnosticCheckResult[];}+ /**+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else…+ */+ export type DismissalReasonEnum = typeof DismissalReasonEnum[keyof typeof DismissalReasonEnum];+++ export const DismissalReasonEnum = {+ AlreadyFixed: 'already_fixed',+ ReportUnclear: 'report_unclear',+ AnalysisWrong: 'analysis_wrong',+ WontfixIntentional: 'wontfix_intentional',+ WontfixIrrelevant: 'wontfix_irrelevant',+ Other: 'other',+ } as const;+export type DistanceFunc = typeof DistanceFunc[keyof typeof DistanceFunc];@@ -45438,22 +45458,92 @@ export namespace Schemas {* * `suppressed` - suppressed* * `potential` - potential*/- export type SignalReportStateRequestStateEnum = typeof SignalReportStateRequestStateEnum[keyof typeof SignalReportStateRequestStateEnum];+ export type SignalReportStateEnum = typeof SignalReportStateEnum[keyof typeof SignalReportStateEnum];- export const SignalReportStateRequestStateEnum = {+ export const SignalReportStateEnum = {Suppressed: 'suppressed',Potential: 'potential',} as const;+ export interface SignalReportBulkStateRequest {+ /** Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.+ *+ * * `suppressed` - suppressed+ * * `potential` - potential */+ state: SignalReportStateEnum;+ /** Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.+ *+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else… */+ dismissal_reason?: DismissalReasonEnum;+ /**+ * Optional free-form note explaining the dismissal. Capped at 4000 characters.+ * @maxLength 4000+ */+ dismissal_note?: string;+ /**+ * Optional, only honored when state is 'potential'. Number of additional signals the report must accumulate before it is re-promoted into the pipeline — effectively snoozing it until then. Omit to let the report re-enter the pipeline on the next matching signal.+ * @minimum 1+ * @maximum 100000+ */+ snooze_for?: number;+ /**+ * Report ids to transition to `state` in one call (1–100). Duplicates are de-duplicated; each id is processed independently so one disallowed transition does not block the rest. `dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id.+ * @maxItems 100+ */+ ids: string[];+ }++ export interface SignalReportBulkStateResult {+ /** The report id this result refers to. */+ id: string;+ /** One of: transitioned, skipped, failed, not_found. transitioned: the state change was applied. skipped: the transition was not allowed from the report's current status (a 409 on the single-report endpoint). failed: the request data was invalid for this report. not_found: no report with this id is visible to you. */+ outcome: string;+ /**+ * The report's status after the transition. Present only when outcome is 'transitioned'.+ * @nullable+ */+ status?: string | null;+ /**+ * Human-readable explanation for non-transitioned outcomes (skipped / failed / not_found).+ * @nullable+ */+ detail?: string | null;+ }++ export interface SignalReportBulkStateResponse {+ /** One result per requested id, in request order (after de-duplication). */+ results: SignalReportBulkStateResult[];+ /** Number of reports whose state was changed. */+ transitioned_count: number;+ /** Number of reports whose transition was not allowed. */+ skipped_count: number;+ /** Number of reports that failed on invalid request data. */+ failed_count: number;+ /** Number of requested ids not visible to the caller. */+ not_found_count: number;+ }+export interface SignalReportStateRequest {/** Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.** * `suppressed` - suppressed* * `potential` - potential */- state: SignalReportStateRequestStateEnum;- /** Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). The set of reason codes is owned by the caller and is not validated server-side. */- dismissal_reason?: string;+ state: SignalReportStateEnum;+ /** Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.+ *+ * * `already_fixed` - Already fixed+ * * `report_unclear` - Report is unclear to me+ * * `analysis_wrong` - Agent's analysis is wrong+ * * `wontfix_intentional` - Won't fix - intentional behavior+ * * `wontfix_irrelevant` - Won't fix - issue is real but insignificant+ * * `other` - Something else… */+ dismissal_reason?: DismissalReasonEnum;/*** Optional free-form note explaining the dismissal. Capped at 4000 characters.* @maxLength 4000diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 54f5c0d550d9..176a03a3df47 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 20 enabled ops+ * PostHog API - MCP 21 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -78,7 +78,7 @@ export const SignalsReportsRetrieveParams = /* @__PURE__ */ zod.object({* Body: {* "state": "suppressed" | "potential",* # Optional dismissal feedback (honored when state == "suppressed" or "potential"):- * "dismissal_reason": "<any string code, owned by the caller>",+ * "dismissal_reason": "<canonical reason code, see SIGNAL_REPORT_DISMISSAL_REASON_CHOICES>",* "dismissal_note": "free-form text",* # Optional, only honored for state == "potential":* "snooze_for": <number of additional signals before re-promotion>,@@ -105,10 +105,20 @@ export const SignalsReportsStateCreateBody = /* @__PURE__ */ zod.object({"Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.\n\n* `suppressed` - suppressed\n* `potential` - potential"),dismissal_reason: zod- .string()+ .enum([+ 'already_fixed',+ 'report_unclear',+ 'analysis_wrong',+ 'wontfix_intentional',+ 'wontfix_irrelevant',+ 'other',+ ])+ .describe(+ "* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…"+ ).optional().describe(- "Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). The set of reason codes is owned by the caller and is not validated server-side."+ "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…"),dismissal_note: zod.string()@@ -125,6 +135,73 @@ export const SignalsReportsStateCreateBody = /* @__PURE__ */ zod.object({),})+/**+ * Transition many reports to a new state in one call.+ *+ * Each id is processed independently: a report whose transition isn't allowed from its+ * current status is reported as `skipped` (a 409 on the single-report endpoint) and the+ * rest still go through. Returns one result per requested id (in request order, after+ * de-duplication) plus per-outcome counts. The whole call is 200 even on partial failure —+ * inspect `results` / the counts to see what happened.+ */+export const SignalsReportsBulkStateCreateParams = /* @__PURE__ */ zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const signalsReportsBulkStateCreateBodyDismissalNoteMax = 4000++export const signalsReportsBulkStateCreateBodySnoozeForMax = 100000++export const signalsReportsBulkStateCreateBodyIdsMax = 100++export const SignalsReportsBulkStateCreateBody = /* @__PURE__ */ zod.object({+ state: zod+ .enum(['suppressed', 'potential'])+ .describe('* `suppressed` - suppressed\n* `potential` - potential')+ .describe(+ "Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.\n\n* `suppressed` - suppressed\n* `potential` - potential"+ ),+ dismissal_reason: zod+ .enum([+ 'already_fixed',+ 'report_unclear',+ 'analysis_wrong',+ 'wontfix_intentional',+ 'wontfix_irrelevant',+ 'other',+ ])+ .describe(+ "* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…"+ )+ .optional()+ .describe(+ "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…"+ ),+ dismissal_note: zod+ .string()+ .max(signalsReportsBulkStateCreateBodyDismissalNoteMax)+ .optional()+ .describe('Optional free-form note explaining the dismissal. Capped at 4000 characters.'),+ snooze_for: zod+ .number()+ .min(1)+ .max(signalsReportsBulkStateCreateBodySnoozeForMax)+ .optional()+ .describe(+ "Optional, only honored when state is 'potential'. Number of additional signals the report must accumulate before it is re-promoted into the pipeline — effectively snoozing it until then. Omit to let the report re-enter the pipeline on the next matching signal."+ ),+ ids: zod+ .array(zod.string())+ .max(signalsReportsBulkStateCreateBodyIdsMax)+ .describe(+ 'Report ids to transition to `state` in one call (1–100). Duplicates are de-duplicated; each id is processed independently so one disallowed transition does not block the rest. `dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id.'+ ),+})+/*** List the per-(team, skill) scout configs for this project — schedule (`run_interval_minutes`), `enabled`, and `emit` posture per scout. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.* @summary List scout configsdiff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 34f1143b1f65..dd3e464a1e39 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -3,6 +3,7 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import {+ SignalsReportsBulkStateCreateBody,SignalsReportsListQueryParams,SignalsReportsRetrieveParams,SignalsReportsStateCreateBody,@@ -31,6 +32,41 @@ import {import { withPostHogUrl, pickResponseFields, type WithPostHogUrl } from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'+const InboxReportsBulkSetStateSchema = SignalsReportsBulkStateCreateBody++const inboxReportsBulkSetState = (): ToolBase<+ typeof InboxReportsBulkSetStateSchema,+ Schemas.SignalReportBulkStateResponse+> => ({+ name: 'inbox-reports-bulk-set-state',+ schema: InboxReportsBulkSetStateSchema,+ handler: async (context: Context, params: z.infer<typeof InboxReportsBulkSetStateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.state !== undefined) {+ body['state'] = params.state+ }+ if (params.dismissal_reason !== undefined) {+ body['dismissal_reason'] = params.dismissal_reason+ }+ if (params.dismissal_note !== undefined) {+ body['dismissal_note'] = params.dismissal_note+ }+ if (params.snooze_for !== undefined) {+ body['snooze_for'] = params.snooze_for+ }+ if (params.ids !== undefined) {+ body['ids'] = params.ids+ }+ const result = await context.api.request<Schemas.SignalReportBulkStateResponse>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reports/bulk-state/`,+ body,+ })+ return result+ },+})+const InboxReportsListSchema = SignalsReportsListQueryParamsconst inboxReportsList = (): ToolBase<@@ -590,6 +626,7 @@ const signalsScoutScratchpadSearch = (): ToolBase<})export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {+ 'inbox-reports-bulk-set-state': inboxReportsBulkSetState,'inbox-reports-list': inboxReportsList,'inbox-reports-retrieve': inboxReportsRetrieve,'inbox-reports-set-state': inboxReportsSetState,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-bulk-set-state.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-bulk-set-state.jsonnew file mode 100644index 000000000000..e248e07bc244--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-bulk-set-state.json@@ -0,0 +1,43 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "dismissal_note": {+ "description": "Optional free-form note explaining the dismissal. Capped at 4000 characters.",+ "maxLength": 4000,+ "type": "string"+ },+ "dismissal_reason": {+ "description": "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…",+ "enum": [+ "already_fixed",+ "report_unclear",+ "analysis_wrong",+ "wontfix_intentional",+ "wontfix_irrelevant",+ "other"+ ],+ "type": "string"+ },+ "ids": {+ "description": "Report ids to transition to `state` in one call (1–100). Duplicates are de-duplicated; each id is processed independently so one disallowed transition does not block the rest. `dismissal_reason`, `dismissal_note` and `snooze_for` apply to every id.",+ "items": {+ "type": "string"+ },+ "maxItems": 100,+ "type": "array"+ },+ "snooze_for": {+ "description": "Optional, only honored when state is 'potential'. Number of additional signals the report must accumulate before it is re-promoted into the pipeline — effectively snoozing it until then. Omit to let the report re-enter the pipeline on the next matching signal.",+ "maximum": 100000,+ "minimum": 1,+ "type": "number"+ },+ "state": {+ "description": "Target state for the report. Use 'suppressed' to dismiss the report from the inbox, or 'potential' to snooze/reopen it for later review.\n\n* `suppressed` - suppressed\n* `potential` - potential",+ "enum": ["suppressed", "potential"],+ "type": "string"+ }+ },+ "required": ["state", "ids"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-set-state.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-set-state.jsonindex 27326899d739..d69c06104b17 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-set-state.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-set-state.json@@ -7,7 +7,15 @@"type": "string"},"dismissal_reason": {- "description": "Optional short reason code for the dismissal (e.g. 'not_a_bug', 'wont_fix', 'duplicate'). The set of reason codes is owned by the caller and is not validated server-side.",+ "description": "Optional canonical reason code for the dismissal. Must be one of: already_fixed, report_unclear, analysis_wrong, wontfix_intentional, wontfix_irrelevant, other — these match the inbox UI so the rationale renders as a labelled chip rather than a raw code. 'already_fixed' is a snooze, not a dismissal: pair it with state='potential' (restore) so the report reappears if the issue recurs. Use 'other' together with a dismissal_note for anything that doesn't fit a code.\n\n* `already_fixed` - Already fixed\n* `report_unclear` - Report is unclear to me\n* `analysis_wrong` - Agent's analysis is wrong\n* `wontfix_intentional` - Won't fix - intentional behavior\n* `wontfix_irrelevant` - Won't fix - issue is real but insignificant\n* `other` - Something else…",+ "enum": [+ "already_fixed",+ "report_unclear",+ "analysis_wrong",+ "wontfix_intentional",+ "wontfix_irrelevant",+ "other"+ ],"type": "string"},"id": {