: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): let scouts keep their reports out of the shared inbox (#120193)
posthog[bot]8df895b02bf8
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex 240fad99db6f..c65bb238de5a 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -2080,6 +2080,8 @@ export interface SignalScoutOutputDestinationsApi {slack?: SignalScoutSlackDestinationApi | null/** The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle. */webhook?: SignalScoutWebhookDestinationApi | null+ /** Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value. */+ inbox?: boolean}/**diff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.tsindex e8da0af11b34..8cdd51d5de91 100644--- a/products/replay_vision/frontend/generated/api.zod.ts+++ b/products/replay_vision/frontend/generated/api.zod.ts@@ -1295,6 +1295,12 @@ export const VisionScannersScoutsCreateBody = /* @__PURE__ */ zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),diff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex 8018d03cce3b..b803b3b598ce 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -306,6 +306,15 @@ class InvalidStatusTransition(Exception):super().__init__(f"Cannot transition from {from_status} to {to_status}")+def scout_lists_reports_in_inbox(output_destinations: object) -> bool:+ """Whether a scout with these output destinations lists its reports in the shared inbox.++ Only an explicit `inbox: false` opts out, so configs written before the key existed keep+ listing their reports.+ """+ return not (isinstance(output_destinations, dict) and output_destinations.get("inbox") is False)++class SignalReport(UUIDModel):class Status(models.TextChoices):POTENTIAL = "potential"diff --git a/products/signals/backend/scout_authorship.py b/products/signals/backend/scout_authorship.pyindex fb88c2572605..d467fc395795 100644--- a/products/signals/backend/scout_authorship.py+++ b/products/signals/backend/scout_authorship.py@@ -8,7 +8,8 @@ on a request path resolve it from Postgres here.from __future__ import annotations-from django.db.models import Q+from django.db.models import CharField, Exists, OuterRef, Q, QuerySet+from django.db.models.functions import Cast, JSONArrayfrom products.signals.backend.models import SignalScoutConfig, SignalScoutRunfrom products.skills.backend.models.skills import LLMSkill@@ -128,3 +129,28 @@ def resolve_background_authoring_runs(team_id: int, report_ids: list[str]) -> didef report_is_from_background_scout(team_id: int, report_id: str) -> bool:return report_id in resolve_background_authoring_runs(team_id, [report_id])+++def _inbox_opted_out_runs(team_id: int) -> QuerySet[SignalScoutRun]:+ # Matches `scout_lists_reports_in_inbox`: only an explicit `inbox: false` opts a scout out.+ # A subquery rather than a join, so the inbox list query keeps its join-free plan.+ opted_out_configs = SignalScoutConfig.objects.for_team(team_id).filter(output_destinations__inbox=False)+ return SignalScoutRun.objects.for_team(team_id).filter(scout_config_id__in=opted_out_configs.values("id"))+++def inbox_hidden_report_exists(team_id: int) -> Exists:+ """Matches a report kept out of the inbox because the scout that authored it turned off its inbox destination.++ Only authorship counts, read from the config's current setting: an opted-out scout that edits+ another source's report does not hide it, and turning the scout back on lists its reports again.+ Use it in a filter on a `SignalReport` queryset, so the check stays in the database.+ """+ return Exists(+ _inbox_opted_out_runs(team_id).filter(+ emitted_report_ids__contains=JSONArray(Cast(OuterRef("id"), output_field=CharField()))+ )+ )+++def report_is_hidden_from_inbox(team_id: int, report_id: str) -> bool:+ return _inbox_opted_out_runs(team_id).filter(emitted_report_ids__contains=[report_id]).exists()diff --git a/products/signals/backend/scout_harness/inactivity.py b/products/signals/backend/scout_harness/inactivity.pyindex 03822c2e0555..310153b49274 100644--- a/products/signals/backend/scout_harness/inactivity.py+++ b/products/signals/backend/scout_harness/inactivity.py@@ -37,7 +37,8 @@ attribution on status transitions.The `ignored` verdict only applies when there is fair evidence to judge: the scout must hold atleast one touched report older than `ESTABLISHED_REPORT_AGE` (a report nobody has seen yet isnot a report nobody wanted), and Slack-routed scouts are exempt from it entirely because their-output is consumed in Slack where no evidence flows back. A scout with output but no judgeable+output is consumed in Slack where no evidence flows back. A scout that keeps its reports out of+the inbox is exempt for the same reason. A scout with output but no judgeablereport evidence (findings-only, Slack-routed, or all reports too fresh) is left alone.The sweep speaks the scout lifecycle vocabulary rather than keeping fields of its own. Every@@ -73,6 +74,7 @@ from products.signals.backend.models import (SignalReportArtefact,SignalScoutConfig,SignalScoutRun,+ scout_lists_reports_in_inbox,)from products.signals.backend.scout_harness.limits import SCOUT_TRIAL_METADATA_KEYfrom products.signals.backend.scout_harness.slack_delivery import get_scout_slack_destination@@ -228,10 +230,13 @@ def _apply_verdict(config: SignalScoutConfig, assessment: TeamAssessment, outcomif name not in assessment.judgeable:return- # A Slack-routed scout's output is consumed in Slack, where no evidence flows back, so the- # `ignored` verdict cannot be trusted for it. Its silence still warns below.- slack_routed = get_scout_slack_destination(config.output_destinations) is not None- if name in assessment.judged_on_reports and not slack_routed:+ # A Slack-routed scout's output is consumed in Slack, and a scout kept out of the inbox is read+ # elsewhere too, so no evidence flows back and the `ignored` verdict cannot be trusted for it.+ # Its silence still warns below.+ consumed_outside_inbox = get_scout_slack_destination(+ config.output_destinations+ ) is not None or not scout_lists_reports_in_inbox(config.output_destinations)+ if name in assessment.judged_on_reports and not consumed_outside_inbox:_apply_ignored_verdict(config, outcome, now, had_output=name in assessment.emitted, sweep_warned=sweep_warned)returndiff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.pyindex f6c2ca08a11c..aa8011680379 100644--- a/products/signals/backend/scout_harness/prompt.py+++ b/products/signals/backend/scout_harness/prompt.py@@ -415,7 +415,8 @@ _INBOX_SEARCH_RECIPE = ("Call `inbox-reports-list`, filtering or searching by the entity, error, or topic, with ""`ordering=-updated_at` (the default ordering buckets by your own reviewer-match and status first, so ""the most recent duplicate can sort below older rows) and `include_all_statuses=true` (statuses hidden "- "by default, human-dismissed ones especially, show up too). Read each row's `status` before deciding, "+ "by default, human-dismissed ones especially, show up too), and `include_unlisted=true` (reports kept out of "+ "the inbox, your own included, show up too). Read each row's `status` before deciding, ""and read the closest matches in full with `inbox-reports-retrieve`. Don't filter by ""`source_product=<your product>`: a report you authored persists its backing signals under ""`source_product=signals_scout`, so a product-named filter matches none of your own reports."diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex 378626427d5d..5d70c2437419 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -42,7 +42,12 @@ from products.signals.backend.artefact_schemas import ()from products.signals.backend.background_pilot import OPT_OUT_DISABLED, capture_background_scout_opted_outfrom products.signals.backend.enums import ReportLinkKind, ToolPreset-from products.signals.backend.models import SignalReportCheck, SignalScoutConfig, SignalScoutEmission+from products.signals.backend.models import (+ SignalReportCheck,+ SignalScoutConfig,+ SignalScoutEmission,+ scout_lists_reports_in_inbox,+)from products.signals.backend.presentation.scout_suggestion_serializers import ScoutOriginfrom products.signals.backend.report_charts import MAX_REPORT_CHARTSfrom products.signals.backend.report_metrics import MAX_REPORT_METRICS@@ -2966,6 +2971,21 @@ class SignalScoutOutputDestinationsSerializer(serializers.Serializer):"reference lives here so the owning product can manage the destination's lifecycle."),)+ inbox = serializers.BooleanField(+ required=False,+ help_text=(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to "+ "keep the reports this scout authors out of the inbox and its Slack notifications, for "+ "example for a digest scout read in Slack. Reports this scout only edits are not affected. "+ "An update that omits this key keeps the stored value."+ ),+ )++ def to_representation(self, instance: Any) -> dict[str, Any]:+ data = super().to_representation(instance)+ # Configs stored before the key existed carry no `inbox`, and they list their reports.+ data["inbox"] = scout_lists_reports_in_inbox(instance)+ return dataclass SignalScoutOutputDestinationsUpdateSerializer(SignalScoutOutputDestinationsSerializer):@@ -2980,9 +3000,11 @@ def _validate_output_destinations(value: dict, context: dict) -> dict:# The webhook reference is a pointer the owning product manages, not a channel Signals delivers# to, so it carries none of the Slack checks below and survives a write that clears Slack.webhook = value.get("webhook") or None+ # Absent means "not supplied", which the update path reads to keep a stored opt-out.+ inbox = {"inbox": value["inbox"]} if "inbox" in value else {}slack = value.get("slack")if slack is None:- return {"webhook": webhook} if webhook else {}+ return {**({"webhook": webhook} if webhook else {}), **inbox}project_id = context.get("project_id")if not isinstance(project_id, int):@@ -3014,7 +3036,7 @@ def _validate_output_destinations(value: dict, context: dict) -> dict:if not any(scope in key_scopes for scope in ("task:read", "task:write")):raise PermissionDenied("API key missing required scope 'task:read'")- return {"slack": slack, **({"webhook": webhook} if webhook else {})}+ return {"slack": slack, **({"webhook": webhook} if webhook else {}), **inbox}_SCOUT_TAGS_HELP_TEXT = (@@ -4057,6 +4079,12 @@ class SignalScoutConfigUpdateSerializer(_ScoutConfigCapabilityFieldsMixin, seriaand "thread_reports" not in incoming_slack):incoming_slack["thread_reports"] = False+ if (+ isinstance(output_destinations, dict)+ and "inbox" not in output_destinations+ and not scout_lists_reports_in_inbox(instance.output_destinations)+ ):+ output_destinations["inbox"] = False# Re-anchor the coordinator's cron due-check only when the schedule actually changes —# an emit/enabled-only save must not defer an already-overdue scheduled run.schedule_fields = ("run_interval_minutes", "run_cron_schedule")diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex a7f945fc9b0e..a86467192669 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -1936,6 +1936,15 @@ class SignalReportListQuerySerializer(serializers.Serializer):"shows, as repeated parameters or comma-separated. The other reports keep their order. At most 100."),)+ include_unlisted = serializers.BooleanField(+ required=False,+ default=False,+ help_text=(+ "Include reports kept out of the shared inbox. A report is kept out when the scout that "+ "authored it turned off its `inbox` output destination. Defaults to false. Fetching a report "+ "by id always works, whatever this value is."+ ),+ )# One list page, with room for a next page's ids that have not loaded yet.diff --git a/products/signals/backend/slack_inbox_notifications.py b/products/signals/backend/slack_inbox_notifications.pyindex cfb5fd1b0817..f01b5a63d07e 100644--- a/products/signals/backend/slack_inbox_notifications.py+++ b/products/signals/backend/slack_inbox_notifications.py@@ -54,6 +54,7 @@ from products.signals.backend.report_generation.resolve_reviewers import (resolve_org_users_by_uuid,)from products.signals.backend.report_urls import ReportLinkSource, build_report_url+from products.signals.backend.scout_authorship import report_is_hidden_from_inboxfrom products.signals.backend.slack_formatting import (is_safe_slack_http_url as _is_safe_http_url,prepare_slack_markdown as _prepare_markdown,@@ -809,6 +810,13 @@ def dispatch_inbox_item_notifications()return 0+ if report_is_hidden_from_inbox(team_id, report_id):+ logger.info(+ "dispatch_inbox_item_notifications: authoring scout keeps reports out of the inbox, skipping",+ extra={"report_id": report_id, "team_id": team_id},+ )+ return 0+# Mirror the inbox Reports tab: notify only for actionable reports (READY is enforced upstream# in the notification activity). Priority is read below for the message label and min-priority# routing, but it's optional now — an actionable report notifies even without a priority.diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.pyindex 7a45dc5b0e49..c6b8351e5f87 100644--- a/products/signals/backend/test/test_scout_harness.py+++ b/products/signals/backend/test/test_scout_harness.py@@ -1256,6 +1256,8 @@ class TestPromptBuilder(BaseTest):# author, so the guidance must keep the untrusted-content boundary — a scout holds# write scopes an injected note could otherwise steer.assert "include_all_statuses=true" in prompt+ # A scout that keeps its reports out of the inbox must still find them, or it re-emits each run.+ assert "include_unlisted=true" in promptassert "dismissal_note" in promptassert "record the rationale in your own words" in prompt# Report authors need the metric semantics the generated tool shape cannot express on its own:diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 758702d38866..a112e05347b5 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -3907,6 +3907,7 @@ class TestScoutHarnessConfigAPI(APIBaseTest):assert response.json()["output_destinations"] == {"slack": {**destination["slack"], "users": None, "thread_reports": True},"webhook": None,+ "inbox": True,}config.refresh_from_db()assert config.output_destinations == destination@@ -3927,6 +3928,7 @@ class TestScoutHarnessConfigAPI(APIBaseTest):assert response.json()["output_destinations"] == {"slack": {**destination["slack"], "channel": None, "thread_reports": True},"webhook": None,+ "inbox": True,}config.refresh_from_db()assert config.output_destinations == destination@@ -3955,6 +3957,29 @@ class TestScoutHarnessConfigAPI(APIBaseTest):config.refresh_from_db()assert config.output_destinations["slack"]["thread_reports"] is False+ def test_partial_update_inbox_opt_out_survives_a_write_that_omits_it(self) -> None:+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")++ response = self.client.patch(+ self._detail_url(str(config.id)), data={"output_destinations": {"inbox": False}}, format="json"+ )+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["output_destinations"]["inbox"] is False++ response = self.client.patch(+ self._detail_url(str(config.id)), data={"output_destinations": {"webhook": None}}, format="json"+ )+ assert response.status_code == status.HTTP_200_OK+ config.refresh_from_db()+ assert config.output_destinations == {"inbox": False}++ response = self.client.patch(+ self._detail_url(str(config.id)), data={"output_destinations": {"inbox": True}}, format="json"+ )+ assert response.status_code == status.HTTP_200_OK+ config.refresh_from_db()+ assert config.output_destinations == {"inbox": True}+@parameterized.expand([("missing_integration_scope", ["signal_scout:write"], status.HTTP_403_FORBIDDEN, "integration:read"),diff --git a/products/signals/backend/test/test_scout_inactivity.py b/products/signals/backend/test/test_scout_inactivity.pyindex 8def09934bee..89250d4a2231 100644--- a/products/signals/backend/test/test_scout_inactivity.py+++ b/products/signals/backend/test/test_scout_inactivity.py@@ -330,12 +330,18 @@ class TestScoutInactivitySweep(BaseTest):assert outcome.warned == []assert self._reload().status == SignalScoutConfig.Status.ACTIVE- def test_a_slack_routed_scout_is_not_judged_on_report_consumption(self) -> None:- # Slack output is consumed in Slack, where no evidence flows back, so the unconsumed+ @parameterized.expand(+ [+ ("slack_routed", {"slack": {"integration_id": 1, "channel": "C123"}}),+ ("kept_out_of_inbox", {"inbox": False, "webhook": {"hog_function_id": "hog-fn-1"}}),+ ]+ )+ def test_a_scout_read_outside_the_inbox_is_not_judged_on_report_consumption(+ self, _name: str, output_destinations: dict+ ) -> None:+ # This output is read outside the inbox, where no evidence flows back, so the unconsumed# verdict cannot be trusted for these scouts.- SignalScoutConfig.all_teams.filter(pk=self.config.pk).update(- output_destinations={"slack": {"integration_id": 1, "channel": "C123"}}- )+ SignalScoutConfig.all_teams.filter(pk=self.config.pk).update(output_destinations=output_destinations)self._emitting_runs(self._report())outcome = sweep_inactive_scouts(now=self.now)diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.pyindex a829f911fc97..d5134bf45f19 100644--- a/products/signals/backend/test/test_signal_report_api.py+++ b/products/signals/backend/test/test_signal_report_api.py@@ -66,6 +66,8 @@ from products.signals.backend.models import (SignalReportAssignment,SignalReportPullRequest,SignalReportTask,+ SignalScoutConfig,+ SignalScoutRun,SignalTeamConfig,SignalUserAutonomyConfig,)@@ -389,6 +391,32 @@ class TestSignalReportListAPI(APIBaseTest):assert retrieve_response.json()["metrics"][0]["metric_id"] == "affected-users"assert retrieve_response.json()["metrics"][0]["query"] == metric["query"]+ def test_list_hides_reports_an_opted_out_scout_authored_unless_asked(self) -> None:+ listed = self._create_report()+ edited_only = self._create_report()+ authored = self._create_report()+ config = SignalScoutConfig.objects.create(+ team=self.team, skill_name="signals-scout-digest", output_destinations={"inbox": False}+ )+ task = apps.get_model("tasks", "Task").objects.create(team=self.team, title="scout", description="d")+ SignalScoutRun.objects.create(+ team=self.team,+ task_run=apps.get_model("tasks", "TaskRun").objects.create(team=self.team, task=task),+ scout_config=config,+ skill_name=config.skill_name,+ skill_version=1,+ emitted_report_ids=[str(authored.id)],+ edited_report_ids=[str(edited_only.id)],+ )++ default_ids = {row["id"] for row in self.client.get(self._list_url()).json()["results"]}+ opt_in_ids = {row["id"] for row in self.client.get(self._list_url(include_unlisted="true")).json()["results"]}+ retrieve_response = self.client.get(f"{self._list_url()}{authored.id}/")++ assert default_ids == {str(listed.id), str(edited_only.id)}+ assert opt_in_ids == {str(listed.id), str(edited_only.id), str(authored.id)}+ assert retrieve_response.status_code == status.HTTP_200_OK+def test_property_restricted_member_cannot_read_metric_snapshot_or_definition(self) -> None:self._enable_feature(AvailableFeature.PROPERTY_ACCESS_CONTROL)property_definition = PropertyDefinition.objects.create(@@ -2087,7 +2115,10 @@ class TestSignalReportListAPI(APIBaseTest):self._create_implementation_task_with_run(report_with_pr, pr_url="https://github.com/org/repo/pull/42")with CaptureQueriesContext(connection) as ctx:- response = self.client.get(self._list_url(has_implementation_pr="true", count_only="true"))+ # `include_unlisted` drops the inbox-listing subquery, which also aliases a table as V0.+ response = self.client.get(+ self._list_url(has_implementation_pr="true", count_only="true", include_unlisted="true")+ )assert response.status_code == status.HTTP_200_OK# All association subqueries must stay team-scoped. Without the scope the planner candiff --git a/products/signals/backend/test/test_slack_inbox_notifications.py b/products/signals/backend/test/test_slack_inbox_notifications.pyindex 065920f73b96..dcd731551688 100644--- a/products/signals/backend/test/test_slack_inbox_notifications.py+++ b/products/signals/backend/test/test_slack_inbox_notifications.py@@ -3,6 +3,7 @@ import jsonimport pytestfrom unittest.mock import MagicMock, patch+from django.apps import appsfrom django.conf import settingsfrom rest_framework.exceptions import ValidationError@@ -20,6 +21,8 @@ from products.signals.backend.models import (AutonomyPriority,SignalReport,SignalReportArtefact,+ SignalScoutConfig,+ SignalScoutRun,SignalUserAutonomyConfig,)from products.signals.backend.report_generation.research import ActionabilityChoice@@ -401,6 +404,35 @@ def test_dispatch_skips_a_direct_message_to_an_ineligible_member(org_and_team):assert fake_client.chat_postMessage.call_count == 0+def test_dispatch_skips_report_authored_by_scout_kept_out_of_inbox(org_and_team):+ org, team = org_and_team+ reviewer = _make_reviewer_user(org, "[email protected]", "digest-bot")+ _make_slack_integration(team, reviewer)+ _set_team_channel(team, "CTEAM|#posthog-signals")+ report = _make_ready_report(team, priority=AutonomyPriority.P2, suggested_logins=["digest-bot"])+ config = SignalScoutConfig.objects.for_team(team.id).create(+ team=team, skill_name="signals-scout-digest", output_destinations={"inbox": False}+ )+ task = apps.get_model("tasks", "Task").objects.create(team=team, title="scout", description="d")+ SignalScoutRun.objects.for_team(team.id).create(+ team=team,+ task_run=apps.get_model("tasks", "TaskRun").objects.create(team=team, task=task),+ scout_config=config,+ skill_name=config.skill_name,+ skill_version=1,+ emitted_report_ids=[str(report.id)],+ )++ fake_client = MagicMock()+ with patch("products.signals.backend.slack_inbox_notifications.SlackIntegration") as slack_cls:+ slack_cls.return_value.client = fake_client+ sent = dispatch_inbox_item_notifications(str(report.id), team.id)++ assert sent == 0+ assert fake_client.chat_postMessage.call_count == 0++@pytest.mark.django_db@pytest.mark.parametrize("ai_approved", [True, False])def test_dispatch_posts_to_team_channel_without_per_user_config(org_and_team, ai_approved):diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 46a3006ee730..373b2a24d19c 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -219,6 +219,7 @@ from products.signals.backend.report_task_actions import ()from products.signals.backend.reviewer_correction_notes import ReviewerCorrection, forward_reviewer_correction_notefrom products.signals.backend.reviewer_pr_assignment import schedule_reviewer_pr_assignment+from products.signals.backend.scout_authorship import inbox_hidden_report_existsfrom products.signals.backend.scout_harness.trial_access import trial_state_errors, trial_store_for_requestfrom products.signals.backend.scout_report.trial_inbox import TrialInboxReads, private_report_artefactsfrom products.signals.backend.serializers import (@@ -1318,6 +1319,7 @@ class SignalReportViewSet(if renders_reports or self._channel_id_filter_value() is not None:qs = self._annotate_channel_id(qs)qs = self._apply_signal_report_status_filter(qs)+ qs = self._apply_signal_report_listed_filter(qs)qs = self._apply_signal_report_search_filter(qs)qs = self._apply_signal_report_created_after_filter(qs)unread = self.request.query_params.get("unread")@@ -1524,6 +1526,12 @@ class SignalReportViewSet(return Falseraise serializers.ValidationError({name: f"Invalid value: {raw!r}. Allowed: true, false."})+ def _apply_signal_report_listed_filter(self, queryset):+ # List-only: a report a scout kept out of the inbox stays reachable by id and by its other actions.+ if self.action != "list" or self._bool_query_param("include_unlisted") is True:+ return queryset+ return queryset.exclude(inbox_hidden_report_exists(self.team_id))+def _apply_signal_report_search_filter(self, queryset):search = self.request.query_params.get("search")if not search:diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 4409c30e304f..ec6b801ada52 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3988,6 +3988,8 @@ export interface SignalScoutOutputDestinationsApi {slack?: SignalScoutSlackDestinationApi | null/** The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle. */webhook?: SignalScoutWebhookDestinationApi | null+ /** Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value. */+ inbox?: boolean}/**@@ -4649,6 +4651,8 @@ export interface SignalScoutOutputDestinationsUpdateApi {slack?: SignalScoutSlackDestinationUpdateApi | null/** The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle. */webhook?: SignalScoutWebhookDestinationApi | null+ /** Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value. */+ inbox?: boolean}/**@@ -8171,6 +8175,10 @@ export type SignalsReportsListParams = {* Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.*/include_source_metadata?: boolean+ /**+ * Include reports kept out of the shared inbox. A report is kept out when the scout that authored it turned off its `inbox` output destination. Defaults to false. Fetching a report by id always works, whatever this value is.+ */+ include_unlisted?: boolean/*** Number of results to return per page.*/diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex a476aeff1950..618f53deef2b 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -1397,6 +1397,12 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),@@ -1647,6 +1653,12 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),@@ -1817,6 +1829,12 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe(diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 0851f5d9c3ac..4ccbc69cc08e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -86580,6 +86580,8 @@ export namespace Schemas {slack?: SignalScoutSlackDestinationUpdate | null;/** The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle. */webhook?: SignalScoutWebhookDestination | null;+ /** Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value. */+ inbox?: boolean;}/**@@ -100321,6 +100323,8 @@ export namespace Schemas {slack?: SignalScoutSlackDestination | null;/** The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle. */webhook?: SignalScoutWebhookDestination | null;+ /** Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value. */+ inbox?: boolean;}/**@@ -131554,6 +131558,10 @@ export namespace Schemas {* Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.*/include_source_metadata?: boolean;+ /**+ * Include reports kept out of the shared inbox. A report is kept out when the scout that authored it turned off its `inbox` output destination. Defaults to false. Fetching a report by id always works, whatever this value is.+ */+ include_unlisted?: boolean;/*** Number of results to return per page.*/diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.tsindex 4bf63bb2e9bb..a12f4300958c 100644--- a/services/mcp/src/generated/replay_vision/api.ts+++ b/services/mcp/src/generated/replay_vision/api.ts@@ -2005,6 +2005,12 @@ export const VisionScannersScoutsCreateBody = () => zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 428963b4a301..3d4f495183f6 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -155,6 +155,7 @@ export const signalsReportsListQueryCountOnlyDefault = falseexport const signalsReportsListQueryExcludeMax = 100export const signalsReportsListQueryIncludeSourceMetadataDefault = true+export const signalsReportsListQueryIncludeUnlistedDefault = falseexport const SignalsReportsListQueryParams = () => zod.object({actionability: zod@@ -214,6 +215,12 @@ export const SignalsReportsListQueryParams = () => zod.object({.describe('Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.'),+ include_unlisted: zod+ .boolean()+ .default(signalsReportsListQueryIncludeUnlistedDefault)+ .describe(+ 'Include reports kept out of the shared inbox. A report is kept out when the scout that authored it turned off its `inbox` output destination. Defaults to false. Fetching a report by id always works, whatever this value is.'+ ),limit: zod.number().optional().describe('Number of results to return per page.'),offset: zod.number().optional().describe('The initial index from which to return the results.'),ordering: zod@@ -1257,6 +1264,12 @@ export const SignalsScoutCreateBody = () => zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),@@ -1504,6 +1517,12 @@ export const SignalsScoutConfigCreateBody = () => zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe('Destinations that receive each finding or report this scout emits. Empty by default.'),@@ -1683,6 +1702,12 @@ export const SignalsScoutConfigUpdateBody = () => zod.describe("The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."),+ inbox: zod+ .boolean()+ .optional()+ .describe(+ "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."+ ),}).optional().describe(diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 36ea5ad20a2a..77dfa604ea4f 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -506,6 +506,7 @@ const inboxReportsList = (): ToolBase<has_implementation_pr: params.has_implementation_pr,include_all_statuses: params.include_all_statuses,include_source_metadata: params.include_source_metadata,+ include_unlisted: params.include_unlisted,limit: params.limit,offset: params.offset,ordering: params.ordering,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.jsonindex 23b3eb5f8051..9426b78f485e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json@@ -50,6 +50,11 @@"description": "Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.","type": "boolean"},+ "include_unlisted": {+ "default": false,+ "description": "Include reports kept out of the shared inbox. A report is kept out when the scout that authored it turned off its `inbox` output destination. Defaults to false. Fetching a report by id always works, whatever this value is.",+ "type": "boolean"+ },"limit": {"description": "Number of results to return per page.","type": "number"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.jsonindex 9c4fcb908ea6..b759eab5bff5 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json@@ -65,6 +65,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Empty by default.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.jsonindex 93d443e09cb1..88a15a1cd4cb 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json@@ -68,6 +68,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Pass an empty object to disable delivery.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.jsonindex 1cbdf6cf37e9..57a220b7ebe9 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json@@ -67,6 +67,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Empty by default.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.jsonindex 9c4fcb908ea6..b759eab5bff5 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json@@ -65,6 +65,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Empty by default.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.jsonindex 93d443e09cb1..88a15a1cd4cb 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json@@ -68,6 +68,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Pass an empty object to disable delivery.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.jsonindex 88e0a77939ee..8e759334a767 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json@@ -66,6 +66,10 @@"output_destinations": {"description": "Destinations that receive each finding or report this scout emits. Empty by default.","properties": {+ "inbox": {+ "description": "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value.",+ "type": "boolean"+ },"slack": {"anyOf": [{