Skip to content

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

feat(signals): count report views and thumbs ratings as scout consumption (#79011)

Andrew Maguire2170f6c47b9f
diff --git a/.semgrep/rules/security/idor-team-scoped-models.yaml b/.semgrep/rules/security/idor-team-scoped-models.yaml
index bc8c664b5fd5..e3c1f2359de8 100644
--- a/.semgrep/rules/security/idor-team-scoped-models.yaml
+++ b/.semgrep/rules/security/idor-team-scoped-models.yaml
@@ -278,6 +278,7 @@ rules:
|SharingConfiguration
|SignalEmissionRecord
|SignalReport
+ |SignalReportAction
|SignalReportArtefact
|SignalReportRefund
|SignalReportTask
@@ -617,6 +618,7 @@ rules:
|SharingConfiguration
|SignalEmissionRecord
|SignalReport
+ |SignalReportAction
|SignalReportArtefact
|SignalReportRefund
|SignalReportTask
diff --git a/frontend/src/lib/readOnlyGuard.test.ts b/frontend/src/lib/readOnlyGuard.test.ts
index ec94826d5553..b6e84900bb1f 100644
--- a/frontend/src/lib/readOnlyGuard.test.ts
+++ b/frontend/src/lib/readOnlyGuard.test.ts
@@ -100,6 +100,12 @@ describe('readOnlyGuard', () => {
['AI conversation queue clear', 'POST', '/api/environments/2/conversations/abc-123/queue/clear'],
['AI conversation append message', 'POST', '/api/environments/2/conversations/abc-123/append_message'],
['AI conversation cancel', 'PATCH', '/api/environments/2/conversations/abc-123/cancel/'],
+ ['signals report viewed', 'POST', '/api/projects/2/signals/reports/abc-123/viewed/'],
+ [
+ 'signals report viewed with query string',
+ 'POST',
+ '/api/projects/2/signals/reports/abc-123/viewed/?foo=bar',
+ ],
['session replay export create', 'POST', '/api/environments/2/exports/'],
['session replay export create (projects)', 'POST', '/api/projects/2/exports/'],
['export create with query string', 'POST', '/api/environments/2/exports/?export_format=video/mp4'],
@@ -128,6 +134,8 @@ describe('readOnlyGuard', () => {
['insight non-viewed sub-action blocked', 'POST', '/api/environments/2/insights/123/viewed_by'],
['insight non-timing sub-action blocked', 'POST', '/api/environments/2/insights/123/timing_breakdown'],
['metalytics-like prefix blocked', 'POST', '/api/projects/2/metalyticsfoo/'],
+ // Only the passive viewed telemetry passes; rating a report is an active write.
+ ['signals report feedback blocked', 'POST', '/api/projects/2/signals/reports/abc-123/feedback/'],
['ticket saved views write blocked', 'POST', '/api/environments/2/conversations/views/'],
[
'ticket saved views write blocked (no trailing slash)',
diff --git a/frontend/src/lib/readOnlyGuard.ts b/frontend/src/lib/readOnlyGuard.ts
index 4a739c75b063..0ec4c0cb1780 100644
--- a/frontend/src/lib/readOnlyGuard.ts
+++ b/frontend/src/lib/readOnlyGuard.ts
@@ -89,6 +89,7 @@ const READ_ONLY_ALLOWED_PATTERNS: ReadonlyArray<AllowedPattern> = [
/\/insights\/viewed(?:\/|$|\?)/, // /api/environments/:team_id/insights/viewed — passive "recently viewed" telemetry
/\/insights\/timing(?:\/|$|\?)/, // /api/projects/:team_id/insights/timing — time-to-see-data telemetry fired after every dashboard/insight load
/\/metalytics(?:\/|$|\?)/, // /api/projects/:team_id/metalytics — side-panel scene view tracking (only accepts metric_name=viewed)
+ /\/signals\/reports\/[^/]+\/viewed(?:\/|$|\?)/, // POST /api/projects/:team_id/signals/reports/:id/viewed — inbox report-open tracking; the consumption evidence keeping read scouts from auto-pausing
/\/conversations(?!\/(?:views|tickets))(?:\/|$|\?)/, // /api/.../conversations[/:id[/queue|/append_message|/cancel|...]] — PostHog AI (Max), excluding /conversations/views and /conversations/tickets
/\/exports\/?(?:\?|$)/, // /api/.../exports[/] — create export jobs only; detail paths like /exports/:id/ stay blocked
{ pattern: /\/session_recordings\/[^/]+(?:\/|$|\?)/, methods: ['PATCH'] }, // PATCH /api/.../session_recordings/:id — markViewed view-tracking ({viewed: true, ...} then {analyzed: true, ...}). DELETE on the same path stays blocked.
diff --git a/products/signals/backend/migrations/0089_signalreportaction.py b/products/signals/backend/migrations/0089_signalreportaction.py
new file mode 100644
index 000000000000..405d8a61dbe7
--- /dev/null
+++ b/products/signals/backend/migrations/0089_signalreportaction.py
@@ -0,0 +1,83 @@
+# Generated by Django 5.2.17 on 2026-08-06 14:55
+
+import django.db.models.manager
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+import posthog.uuidt
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("posthog", "1292_oauthaccesstoken_sandbox_task_id"),
+ ("signals", "0088_signalscoutconfig_model"),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="SignalReportAction",
+ fields=[
+ (
+ "id",
+ models.UUIDField(
+ default=posthog.uuidt.uuid7,
+ editable=False,
+ primary_key=True,
+ serialize=False,
+ ),
+ ),
+ (
+ "type",
+ models.CharField(
+ choices=[("view", "View"), ("feedback", "Feedback")],
+ max_length=20,
+ ),
+ ),
+ ("metadata", models.JSONField(blank=True, default=dict)),
+ ("count", models.PositiveIntegerField(default=1)),
+ ("first_at", models.DateTimeField(auto_now_add=True)),
+ ("last_at", models.DateTimeField()),
+ (
+ "report",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="actions",
+ to="signals.signalreport",
+ ),
+ ),
+ (
+ "team",
+ models.ForeignKey(
+ db_constraint=False,
+ on_delete=django.db.models.deletion.CASCADE,
+ to="posthog.team",
+ ),
+ ),
+ (
+ "user",
+ models.ForeignKey(
+ db_constraint=False,
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ],
+ options={
+ "verbose_name": "Signal report action",
+ "verbose_name_plural": "Signal report actions",
+ "default_manager_name": "all_teams",
+ "constraints": [
+ models.UniqueConstraint(
+ fields=("report", "user", "type"),
+ name="signals_report_action_identity",
+ )
+ ],
+ },
+ managers=[
+ ("all_teams", django.db.models.manager.Manager()),
+ ],
+ ),
+ ]
diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txt
index 2a37309c9693..e981c43e7591 100644
--- a/products/signals/backend/migrations/max_migration.txt
+++ b/products/signals/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0088_signalscoutconfig_model
+0089_signalreportaction
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index 0016471c7a7e..81c589879fd4 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -6,7 +6,7 @@ from typing import Any, cast
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.indexes import GinIndex
from django.core.validators import MaxValueValidator, MinValueValidator
-from django.db import models, transaction
+from django.db import IntegrityError, models, transaction
from django.utils import timezone
from asgiref.sync import async_to_sync
@@ -1081,6 +1081,104 @@ class SignalReportRefund(TeamScopedRootMixin, UUIDModel):
]
+class SignalReportAction(TeamScopedRootMixin, UUIDModel):
+ """One row per (report, user, action type): a person's lightweight interaction with a report.
+
+ Heavier work on a report already leaves person-attributed `SignalReportArtefact` rows (notes,
+ dismissals, commits); this table records the interactions too light to be artefacts — opening
+ a report, rating it with the thumbs — which otherwise exist only as client-side analytics
+ events the backend can never read. The scout inactivity sweep
+ (`scout_harness/inactivity.py`) reads both feeds when judging whether a scout's output is
+ consumed, and the rows are a durable per-person consumption record future ranking/learning
+ can build on.
+
+ Upsert semantics, not a log: one row per (report, user, type), with `count` and `last_at`
+ advancing on repeats. The high-volume raw stream (every open, dwell time, rank) stays in
+ analytics events; this row is the queryable server-side fact that the interaction happened,
+ kept one-row-per-person so it can sit on the sweep's hot path.
+ """
+
+ class ActionType(models.TextChoices):
+ # A person opened the report's detail view in the inbox UI.
+ VIEW = "view"
+ # The thumbs rating at the end of the report body ("Was this report useful?").
+ FEEDBACK = "feedback"
+
+ # See SignalReportRefund.all_teams for rationale.
+ all_teams = models.Manager() # noqa: DJ012
+
+ # FKs to the hot posthog_team / posthog_user tables use db_constraint=False so creating this
+ # table takes no lock on those parents (app-level enforcement only).
+ team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE, db_constraint=False)
+ report = models.ForeignKey(SignalReport, on_delete=models.CASCADE, related_name="actions")
+ # CASCADE, unlike the artefact log's SET_NULL: a row here is evidence that a specific person
+ # interacted, so with the person gone it proves nothing and can go with them.
+ user = models.ForeignKey("posthog.User", on_delete=models.CASCADE, db_constraint=False, related_name="+")
+ type = models.CharField(max_length=20, choices=ActionType)
+ # Latest-wins detail about the interaction (e.g. the feedback row keeps the most recent
+ # sentiment). Never required by readers — the row's existence is the fact that matters.
+ metadata = models.JSONField(default=dict, blank=True)
+ # Coarse repeat signal, not an exact ledger: bundled rating+note submissions and reordered
+ # fire-and-forget requests can move it by one either way. Readers get "roughly how often",
+ # never billing-grade counts.
+ count = models.PositiveIntegerField(default=1)
+ first_at = models.DateTimeField(auto_now_add=True)
+ last_at = models.DateTimeField()
+
+ class Meta:
+ verbose_name = "Signal report action"
+ verbose_name_plural = "Signal report actions"
+ default_manager_name = "all_teams"
+ constraints = [
+ # Also the only index: the sweep's "which of these reports did a person touch since
+ # <ts>?" resolves as per-report probes on this, and keeping `last_at` out of any index
+ # leaves the hot repeat-view UPDATE eligible for HOT.
+ models.UniqueConstraint(fields=["report", "user", "type"], name="signals_report_action_identity"),
+ ]
+
+ @classmethod
+ def record(
+ cls,
+ *,
+ team_id: int,
+ report_id: str,
+ user_id: int,
+ action_type: "SignalReportAction.ActionType",
+ metadata: dict[str, Any] | None = None,
+ bump_count: bool = True,
+ ) -> None:
+ """Upsert one interaction: bump the existing row or create it.
+
+ Update-then-create rather than get_or_create so the common case (a repeat view) is one
+ UPDATE; the create's unique-constraint race falls back to the update path.
+
+ ``bump_count=False`` refreshes an existing row (metadata, ``last_at``) without counting
+ it as a new interaction — for follow-up requests that amend one the row already counted,
+ like the note trailing a thumbs rating. A create still starts at 1.
+ """
+ now = timezone.now()
+ updates: dict[str, Any] = {"last_at": now}
+ if bump_count:
+ updates["count"] = models.F("count") + 1
+ if metadata is not None:
+ updates["metadata"] = metadata
+ row = cls.objects.for_team(team_id).filter(report_id=report_id, user_id=user_id, type=action_type)
+ if row.update(**updates):
+ return
+ try:
+ with transaction.atomic():
+ cls.objects.for_team(team_id).create(
+ team_id=team_id,
+ report_id=report_id,
+ user_id=user_id,
+ type=action_type,
+ metadata=metadata or {},
+ last_at=now,
+ )
+ except IntegrityError:
+ row.update(**updates)
+
+
# ── Signals scout (headless cross-source explorer) ──────────────────────────────
#
# Core tables backing the Signals scout:
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.md
index f678f4aa595e..e13725dc9af9 100644
--- a/products/signals/backend/scout_harness/AGENTS.md
+++ b/products/signals/backend/scout_harness/AGENTS.md
@@ -38,7 +38,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick e
Per-entity sections are deliberately light (counts + 5 most-recent items with name, status, timestamp); deep drilldowns go via the per-entity MCP list tools.
See the module docstring at `profile/builders.py` for the authoritative section list — when adding or renaming a section, bump `INVENTORY_SOURCE_VERSION` so the cache invalidates cleanly.
- `inactivity.py`
- The stop switch on the waste axis (the failure breaker below covers the failure axis). `sweep_inactive_scouts()` judges **consumption, not emission**: a scout counts as consumed only when a **person** acted on a report it wrote or edited in the `TOUCHED_REPORT_LOOKBACK` — a log artefact attributed to a user (pipeline writers append log artefacts of their own, so unattributed ones don't count), or the report recently reaching `resolved`/`deleted` (`resolved` deliberately includes the GitHub webhook's resolve-on-merge, so a PR merged on GitHub with no in-app action still counts; `suppressed` is deliberately excluded because the same webhook suppresses on close-unmerged with no human involved).
+ The stop switch on the waste axis (the failure breaker below covers the failure axis). `sweep_inactive_scouts()` judges **consumption, not emission**: a scout counts as consumed only when a **person** acted on a report it wrote or edited in the `TOUCHED_REPORT_LOOKBACK` — a log artefact attributed to a user (pipeline writers append log artefacts of their own, so unattributed ones don't count), a `SignalReportAction` row (the light interactions the inbox UI records server-side: opening a report's detail view via the `viewed` endpoint, rating it with the thumbs via `feedback` — reading counts on purpose, since that is how digest-style reports are consumed), or the report recently reaching `resolved`/`deleted` (`resolved` deliberately includes the GitHub webhook's resolve-on-merge, so a PR merged on GitHub with no in-app action still counts; `suppressed` is deliberately excluded because the same webhook suppresses on close-unmerged with no human involved).
The two `pause_reason`s behave differently: `ignored` (the scout holds at least one report older than `ESTABLISHED_REPORT_AGE` and none of its reports show consumption) warns and then pauses after `WARNING_GRACE`; `no_output` (silent, with no judgeable report evidence) only ever warns, because a watch scout's silence can be its job. A scout with output but nothing judgeable on the report side — findings-only, Slack-routed (consumption happens in Slack where no evidence flows back), or every report younger than `ESTABLISHED_REPORT_AGE` — is left alone.
It speaks the scout lifecycle vocabulary rather than keeping fields of its own: the warning is `status=pending_pause` (still scheduled), the pause is `status=paused_by_system` (syncing `enabled=False`), both through `transition_status_by_system`. The helper's ownership rule is writer-scoped: the sweep owns both of its reasons (so it can reclassify its own warning in either direction — `no_output` becomes `ignored` when report evidence establishes, restarting the grace clock, and `ignored` downgrades to `no_output` when its evidence ages out of the lookback, so a pause never lands on stale grounds), and neither the sweep nor the failure breaker can touch the other's pauses.
Driven by the daily `pause_inactive_signal_scouts` Celery task rather than the coordinator tick, which stays short-lived and bounded. A dry-run scout, one inside `in_cold_start_grace()`, one that has barely run (`MIN_RUNS_IN_WINDOW`), and one flagged `auto_pause_exempt` (watchdogs whose value is staying quiet) are all left alone; new warnings are capped per sweep (`MAX_WARNS_PER_SWEEP`), which also bounds later pauses, since a pause only ever follows a warning by `WARNING_GRACE`.
diff --git a/products/signals/backend/scout_harness/inactivity.py b/products/signals/backend/scout_harness/inactivity.py
index a47bea932c15..5a36d9f99a29 100644
--- a/products/signals/backend/scout_harness/inactivity.py
+++ b/products/signals/backend/scout_harness/inactivity.py
@@ -19,18 +19,20 @@ differently:
A scout counts as **consumed** when a person acted on any report it wrote or edited inside the
`TOUCHED_REPORT_LOOKBACK`: they left a log artefact on it (a note, a dismissal, a code
-reference…) inside the window, or the report recently reached a state only a deliberate action
-produces (`_ENGAGED_REPORT_STATUSES`). `resolved` is deliberately in that set even though the
-GitHub webhook sets it without an in-app action, because the webhook resolves on PR *merge*: a
-human merging the report's PR on GitHub is real consumption that leaves no other server-side
-trace. `suppressed` is deliberately NOT in the set, because the same webhook suppresses a report
-when its PR closes unmerged, which a stale-bot can do with no human anywhere in the loop; a
-human archiving a report leaves a `DISMISSAL` artefact and is counted there instead. Client-side
-opens aren't persisted server-side, so a report someone read but never acted on still counts as
-unconsumed; a rescue feed of richer evidence (frontend opens, indirect report attribution) is a
-planned follow-up, and its absence fails toward this rule's plain evidence, never toward extra
-pauses. Report status changes carry no actor today, so a status flipped by another agent can
-still read as consumption; tightening that needs actor attribution on status transitions.
+reference…) inside the window, left a `SignalReportAction` row on it (opened its detail view,
+rated it with the thumbs — the light interactions the inbox UI records server-side), or the
+report recently reached a state only a deliberate action produces (`_ENGAGED_REPORT_STATUSES`).
+`resolved` is deliberately in that set even though the GitHub webhook sets it without an in-app
+action, because the webhook resolves on PR *merge*: a human merging the report's PR on GitHub is
+real consumption that leaves no other server-side trace. `suppressed` is deliberately NOT in the
+set, because the same webhook suppresses a report when its PR closes unmerged, which a stale-bot
+can do with no human anywhere in the loop; a human archiving a report leaves a `DISMISSAL`
+artefact and is counted there instead. A view counts as consumption on purpose: reading is how
+digest-style reports are used, and pausing a scout someone reads every week is the costlier
+error. The action feed only accumulates from when it shipped, so a report last read before then
+still looks unconsumed until it is opened again. Report status changes carry no actor today, so
+a status flipped by another agent can still read as consumption; tightening that needs actor
+attribution on status transitions.
The `ignored` verdict only applies when there is fair evidence to judge: the scout must hold at
least one touched report older than `ESTABLISHED_REPORT_AGE` (a report nobody has seen yet is
@@ -63,7 +65,13 @@ import structlog
from posthog.models.activity_logging.activity_log import Trigger
from posthog.models.activity_logging.model_activity import ActivityTriggerContext
-from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalScoutConfig, SignalScoutRun
+from products.signals.backend.models import (
+ SignalReport,
+ SignalReportAction,
+ SignalReportArtefact,
+ SignalScoutConfig,
+ SignalScoutRun,
+)
from products.signals.backend.scout_harness.slack_delivery import get_scout_slack_destination
logger = structlog.get_logger(__name__)
@@ -396,6 +404,19 @@ def _engaged_report_ids(team_id: int, report_ids: set[str], window_start: dateti
updated_at__gte=window_start,
).values_list("id", flat=True)
}
+ # The light-interaction feed (`viewed` endpoint, thumbs rating): every row is a person by
+ # construction, and every action type counts — reading is how digest-style reports are
+ # consumed, so a recent open is as much a rescue as a note.
+ engaged |= {
+ str(report_id)
+ for report_id in SignalReportAction.objects.for_team(team_id)
+ .filter(
+ report_id__in=report_ids,
+ last_at__gte=window_start,
+ )
+ .values_list("report_id", flat=True)
+ .distinct()
+ }
return engaged
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index d266fbd7001b..e5eb5a263695 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -2147,9 +2147,9 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
allow_null=True,
help_text=(
"Why the system paused (or warned) this scout: `no_output` (it emitted nothing over the "
- "evaluation window), `ignored` (its output received no human engagement), or "
- "`repeated_failures` (consecutive failed runs). Null unless `status` is `pending_pause` "
- "or `paused_by_system`."
+ "evaluation window), `ignored` (no person engaged with its reports — no view, rating, "
+ "note, dismissal, or resolution), or `repeated_failures` (consecutive failed runs). Null "
+ "unless `status` is `pending_pause` or `paused_by_system`."
),
)
emit = serializers.BooleanField(
@@ -2213,9 +2213,9 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
allow_null=True,
help_text=(
"When `status` last changed. For `pending_pause` this is when the warning was issued "
- "(an `ignored` warning pauses about a week later unless someone acts on the scout's "
- "reports; a `no_output` warning only flags the scout); for the paused statuses it is "
- "when the scout was paused. Null if the status never changed."
+ "(an `ignored` warning pauses about a week later unless someone engages with the scout's "
+ "reports — opening one counts; a `no_output` warning only flags the scout); for the "
+ "paused statuses it is when the scout was paused. Null if the status never changed."
),
)
auto_pause_exempt = serializers.BooleanField(
diff --git a/products/signals/backend/test/test_feedback_scout_notes.py b/products/signals/backend/test/test_feedback_scout_notes.py
index 0281255fc5ee..969d2aac1aaa 100644
--- a/products/signals/backend/test/test_feedback_scout_notes.py
+++ b/products/signals/backend/test/test_feedback_scout_notes.py
@@ -18,7 +18,13 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from posthog.rbac.user_access_control import AccessControlLevel, UserAccessControl
from posthog.scopes import APIScopeObject
-from products.signals.backend.models import SignalReport, SignalScoutConfig, SignalScoutNote, SignalScoutRun
+from products.signals.backend.models import (
+ SignalReport,
+ SignalReportAction,
+ SignalScoutConfig,
+ SignalScoutNote,
+ SignalScoutRun,
+)
from products.skills.backend.models.skills import LLMSkill
SCOUT_SKILL = "signals-scout-error-tracking"
@@ -144,21 +150,61 @@ class TestFeedbackScoutNotes(APIBaseTest):
assert self._notes() == []
@parameterized.expand([("blank", " "), ("missing", None)])
- def test_a_note_is_required(self, _name: str, note: str | None) -> None:
- # The bare thumb never calls this endpoint — only a rating carrying a note does — so a blank
- # or absent note is a bad request rather than a silent no-op.
+ def test_a_bare_rating_records_the_action_without_forwarding(self, _name: str, note: str | None) -> None:
+ # The bare thumb carries no note to forward, but the rating itself is consumption
+ # evidence the inactivity sweep reads — it must persist as a report action, not 400.
+ self._create_scout_skill()
report = self._create_report()
- body = {"sentiment": "positive"}
+ self._create_run(emitted_report_ids=[str(report.id)])
+
if note is not None:
- body["note"] = note
+ body = self._feedback(report, sentiment="positive", note=note)
+ else:
+ body = self._feedback(report, sentiment="positive")
+ assert body["forwarded"] is False
- response = self.client.post(
- self._feedback_url(str(report.id)),
- data=json.dumps(body),
- content_type="application/json",
- )
+ assert self._notes() == []
+ action = SignalReportAction.objects.get(report=report, user=self.user)
+ assert action.type == SignalReportAction.ActionType.FEEDBACK
+ assert action.metadata == {"sentiment": "positive"}
+
+ def test_repeat_ratings_collapse_to_one_action_with_the_latest_sentiment(self) -> None:
+ # One row per person per report: a changed mind bumps the row and rewrites the sentiment
+ # rather than accumulating contradictory evidence rows.
+ report = self._create_report()
+
+ self._feedback(report, sentiment="positive")
+ self._feedback(report, sentiment="negative")
+
+ action = SignalReportAction.objects.get(report=report, user=self.user)
+ assert action.count == 2
+ assert action.metadata == {"sentiment": "negative"}
+
+ def test_a_note_following_a_rating_counts_as_one_interaction(self) -> None:
+ # The inbox posts the bare rating on click and the optional note afterwards — one thumb
+ # choice. The note request must amend the action row, not count a second interaction.
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ self._feedback(report, sentiment="positive")
+ self._feedback(report, sentiment="positive", note="the staging spike is a known issue")
+
+ action = SignalReportAction.objects.get(report=report, user=self.user)
+ assert action.count == 1
+ assert action.metadata == {"sentiment": "positive"}
+ assert len(self._notes()) == 1
+
+ def test_a_note_carrying_rating_with_no_prior_row_still_records_the_action(self) -> None:
+ # A client may send rating and note in one request; skipping the count bump must not
+ # skip creating the consumption record itself.
+ report = self._create_report()
+
+ self._feedback(report, sentiment="negative", note="not useful")
- assert response.status_code == status.HTTP_400_BAD_REQUEST
+ action = SignalReportAction.objects.get(report=report, user=self.user)
+ assert action.count == 1
+ assert action.metadata == {"sentiment": "negative"}
def test_feedback_still_succeeds_when_the_note_cannot_be_written(self) -> None:
self._create_scout_skill()
diff --git a/products/signals/backend/test/test_scout_inactivity.py b/products/signals/backend/test/test_scout_inactivity.py
index 4748ec482812..5b270bab6fd9 100644
--- a/products/signals/backend/test/test_scout_inactivity.py
+++ b/products/signals/backend/test/test_scout_inactivity.py
@@ -11,7 +11,13 @@ from parameterized import parameterized
from posthog.models.activity_logging.activity_log import ActivityLog
-from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalScoutConfig, SignalScoutRun
+from products.signals.backend.models import (
+ SignalReport,
+ SignalReportAction,
+ SignalReportArtefact,
+ SignalScoutConfig,
+ SignalScoutRun,
+)
from products.signals.backend.scout_harness.config_registry import register_missing_configs
from products.signals.backend.scout_harness.inactivity import (
ESTABLISHED_REPORT_AGE,
@@ -189,15 +195,23 @@ class TestScoutInactivitySweep(BaseTest):
@parameterized.expand(
[
- ("log_artefact", SignalReportArtefact.ArtefactType.NOTE, None),
- ("dismissal_artefact", SignalReportArtefact.ArtefactType.DISMISSAL, None),
+ ("log_artefact", SignalReportArtefact.ArtefactType.NOTE, None, None),
+ ("dismissal_artefact", SignalReportArtefact.ArtefactType.DISMISSAL, None, None),
# `resolved` includes the GitHub webhook's resolve-on-merge, which is how a merged PR
# counts as consumption even when the merge never touched the app.
- ("resolved_status", None, SignalReport.Status.RESOLVED),
+ ("resolved_status", None, SignalReport.Status.RESOLVED, None),
+ # Reading is consumption: a report someone opens (or rates) is not a report nobody
+ # wanted, even when they never resolve or dismiss it.
+ ("view_action", None, None, SignalReportAction.ActionType.VIEW),
+ ("feedback_action", None, None, SignalReportAction.ActionType.FEEDBACK),
]
)
def test_engagement_with_a_report_keeps_a_scout_running(
- self, _name: str, artefact_type: str | None, report_status: str | None
+ self,
+ _name: str,
+ artefact_type: str | None,
+ report_status: str | None,
+ action_type: SignalReportAction.ActionType | None,
) -> None:
report = self._report()
self._emitting_runs(report)
@@ -209,12 +223,34 @@ class TestScoutInactivitySweep(BaseTest):
SignalReport.objects.filter(pk=report.pk).update(
status=report_status, updated_at=self.now - timedelta(days=1)
)
+ if action_type is not None:
+ SignalReportAction.record(
+ team_id=self.team.pk, report_id=str(report.pk), user_id=self.user.pk, action_type=action_type
+ )
outcome = sweep_inactive_scouts(now=self.now)
assert outcome.warned == []
assert self._reload().status == SignalScoutConfig.Status.ACTIVE
+ def test_a_view_older_than_the_window_is_not_engagement(self) -> None:
+ # The action feed is judged on recency like every other evidence stream: a report read
+ # once months ago must not keep a since-abandoned scout alive forever.
+ report = self._report()
+ self._emitting_runs(report)
+ SignalReportAction.record(
+ team_id=self.team.pk,
+ report_id=str(report.pk),
+ user_id=self.user.pk,
+ action_type=SignalReportAction.ActionType.VIEW,
+ )
+ SignalReportAction.all_teams.filter(report=report).update(
+ last_at=self.now - INACTIVITY_WINDOW - timedelta(days=1)
+ )
+
+ assert [c.pk for c in sweep_inactive_scouts(now=self.now).warned] == [self.config.pk]
+ assert self._reload().pause_reason == SignalScoutConfig.PauseReason.IGNORED
+
def test_a_webhook_suppressed_report_is_not_engagement(self) -> None:
# The GitHub webhook suppresses a report whose PR closed unmerged, which a stale-bot can
# do with no human in the loop; counting it would keep zombie scouts alive. A human
diff --git a/products/signals/backend/test/test_signal_report_actions.py b/products/signals/backend/test/test_signal_report_actions.py
new file mode 100644
index 000000000000..991307d6c233
--- /dev/null
+++ b/products/signals/backend/test/test_signal_report_actions.py
@@ -0,0 +1,102 @@
+from posthog.test.base import APIBaseTest
+from unittest.mock import MagicMock, patch
+
+from parameterized import parameterized
+from rest_framework import status
+
+from posthog.models.personal_api_key import PersonalAPIKey, hash_key_value
+from posthog.models.utils import generate_random_token_personal
+
+from products.signals.backend.models import SignalReport, SignalReportAction
+
+
+class TestSignalReportViewedEndpoint(APIBaseTest):
+ def _viewed_url(self, report_id: str) -> str:
+ return f"/api/projects/{self.team.pk}/signals/reports/{report_id}/viewed/"
+
+ def _create_report(self, **overrides) -> SignalReport:
+ return SignalReport.objects.create(
+ team=self.team,
+ status=overrides.pop("status", SignalReport.Status.READY),
+ title="Checkout errors spiked",
+ summary="Test summary",
+ **overrides,
+ )
+
+ def test_a_view_is_recorded_once_per_person_and_repeats_bump_the_row(self) -> None:
+ report = self._create_report()
+
+ first = self.client.post(self._viewed_url(str(report.pk)))
+ assert first.status_code == status.HTTP_204_NO_CONTENT
+ action = SignalReportAction.objects.get(report=report, user=self.user)
+ assert action.type == SignalReportAction.ActionType.VIEW
+ assert action.count == 1
+ first_seen = action.last_at
+
+ assert self.client.post(self._viewed_url(str(report.pk))).status_code == status.HTTP_204_NO_CONTENT
+ action.refresh_from_db()
+ assert action.count == 2
+ assert action.last_at > first_seen
+
+ @parameterized.expand(
+ [
+ ("viewed", None, status.HTTP_204_NO_CONTENT),
+ ("feedback", {"sentiment": "positive"}, status.HTTP_200_OK),
+ ]
+ )
+ def test_non_session_credentials_record_no_action(
+ self, action_path: str, body: dict | None, expected_status: int
+ ) -> None:
+ # A personal API key (like a sandbox agent's OAuth token) authenticates *as* its owning
+ # user, so a request.user check alone would count automated traffic as a person reading —
+ # letting a scout manufacture the consumption evidence that keeps it from being paused.
+ report = self._create_report()
+ token = generate_random_token_personal()
+ PersonalAPIKey.objects.create(
+ user=self.user, label="test", secure_value=hash_key_value(token), scopes=["task:write"]
+ )
+ self.client.logout()
+
+ response = self.client.post(
+ f"/api/projects/{self.team.pk}/signals/reports/{report.pk}/{action_path}/",
+ body,
+ format="json",
+ headers={"authorization": f"Bearer {token}"},
+ )
+
+ assert response.status_code == expected_status
+ assert not SignalReportAction.objects.filter(report=report).exists()
+
+ @parameterized.expand(
+ [
+ ("viewed", None, status.HTTP_204_NO_CONTENT),
+ ("feedback", {"sentiment": "positive"}, status.HTTP_200_OK),
+ ]
+ )
+ @patch("products.signals.backend.views.is_impersonated_session", return_value=True)
+ def test_an_impersonated_session_records_no_action(
+ self, action_path: str, body: dict | None, expected_status: int, _mock_impersonated: MagicMock
+ ) -> None:
+ # Staff impersonation passes the session check while request.user is the customer, so
+ # without the impersonation guard a support investigation would write consumption evidence
+ # in that customer's name and rescue a scout nobody on their team read.
+ report = self._create_report()
+
+ response = self.client.post(
+ f"/api/projects/{self.team.pk}/signals/reports/{report.pk}/{action_path}/",
+ body,
+ format="json",
+ )
+
+ assert response.status_code == expected_status
+ assert not SignalReportAction.objects.filter(report=report).exists()
+
+ def test_a_suppressed_report_still_records_its_view(self) -> None:
+ # The Dismissed tab renders the same detail view, so its opens must count too instead of
+ # 404ing like mutating-by-ID actions on suppressed reports do.
+ report = self._create_report(status=SignalReport.Status.SUPPRESSED)
+
+ response = self.client.post(self._viewed_url(str(report.pk)))
+
+ assert response.status_code == status.HTTP_204_NO_CONTENT
+ assert SignalReportAction.objects.filter(report=report, user=self.user).exists()
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index a390938c284a..2fd9920ad9af 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -98,6 +98,7 @@ from products.signals.backend.models import (
AutonomyPriority,
InvalidStatusTransition,
SignalReport,
+ SignalReportAction,
SignalReportArtefact,
SignalReportRefund,
SignalSourceConfig,
@@ -598,11 +599,14 @@ class SignalReportFeedbackRequestSerializer(serializers.Serializer):
)
note = serializers.CharField(
max_length=SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH,
+ required=False,
+ allow_blank=True,
+ default="",
help_text=(
"Free-form note explaining the rating. Capped at "
- f"{SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH} characters. Only submitted alongside a note — a "
- "bare thumb carries none — and, for a report authored by a scout, forwarded to that scout "
- "as a steering note."
+ f"{SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH} characters. Optional — a bare thumb carries "
+ "none. When present and the report was authored by a scout, the note is forwarded to that "
+ "scout as a steering note."
),
)
@@ -734,6 +738,28 @@ class SignalReportContentUpdateSerializer(serializers.Serializer):
return attrs
+def _is_person_at_the_ui(request: Request) -> bool:
+ """Whether the caller is a signed-in person in a browser, not an automated credential.
+
+ Consumption evidence (`SignalReportAction`) must prove a person read the report, but every
+ credential this API accepts authenticates *as* a user: through ``request.user`` alone, a
+ personal API key or a sandbox agent's OAuth token is indistinguishable from the person it
+ belongs to. Admitting only a browser session keeps automation — including a scout calling
+ the API on its own reports — from manufacturing the engagement that exempts it from the
+ inactivity sweep.
+
+ Staff impersonation is excluded for the same reason: it is a browser session, but
+ ``request.user`` is the impersonated customer, so a support investigation would otherwise
+ write consumption evidence in that customer's name and rescue a scout nobody on their team
+ read. (Read-only impersonation can't reach these POSTs at all; read-write can.)
+ """
+ return (
+ isinstance(request.successful_authenticator, SessionAuthentication)
+ and isinstance(request.user, User)
+ and not is_impersonated_session(request)
+ )
+
+
@extend_schema_view(
destroy=extend_schema(exclude=True),
)
@@ -765,6 +791,13 @@ class SignalReportViewSet(
}
def safely_get_queryset(self, queryset):
+ if self.action == "viewed":
+ # Passive telemetry fired right after the detail request that already rendered the
+ # report: only visibility matters here, so skip the rendering annotations and
+ # prefetches every other action's serializer needs.
+ qs = queryset.filter(team=self.team)
+ qs = self._exclude_deleted_signal_reports(qs)
+ return self._apply_signal_report_status_filter(qs)
qs = queryset
qs = self._scope_signal_report_queryset(qs)
qs = self._exclude_deleted_signal_reports(qs)
@@ -827,7 +860,11 @@ class SignalReportViewSet(
# note for the report it is displayed on. 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", "refund", "feedback"})
+ # `viewed` follows `retrieve` for the same reason: the Dismissed tab's detail view records its
+ # open like any other.
+ _SUPPRESSED_VISIBLE_ACTIONS = frozenset(
+ {"state", "bulk_state", "retrieve", "signals", "refund", "feedback", "viewed"}
+ )
# Human-readable explanation per bulk outcome, surfaced in each result's `detail` field
# (transitioned needs none — its `status` already says where the report landed).
@@ -1237,6 +1274,10 @@ class SignalReportViewSet(
def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
+ if self.action == "viewed":
+ # The lightweight viewed queryset skips the annotations the default ordering sorts
+ # by, and a by-ID lookup has nothing to order anyway.
+ return queryset
return self._apply_signal_report_ordering(queryset)
def _parse_ordering_string(self, raw: str) -> list[str]:
@@ -1746,22 +1787,24 @@ class SignalReportViewSet(
@extend_schema(
summary="Leave feedback on a report",
description=(
- "Record a note left with the thumbs rating at the end of a report. The rating itself is a "
- "product-analytics event; this endpoint exists to carry the note into the scout steering "
- "channel. For a report authored by a scout, the note is forwarded to that scout as a "
- "steering note it reads on its next run; for any other report there is nothing to steer and "
- "the call is a no-op success. The report's state is never changed."
+ "Record the thumbs rating at the end of a report, with an optional note. For "
+ "browser-session requests the rating is persisted as a per-person report action, which "
+ "counts as consumption evidence for the scout that authored the report (scouts whose "
+ "output nobody consumes are eventually paused); requests authenticated any other way "
+ "record no action. When a note is present and the report was authored by a scout, the note is also "
+ "forwarded to that scout as a steering note it reads on its next run; for any other report "
+ "there is nothing to steer. The report's state is never changed."
),
request=SignalReportFeedbackRequestSerializer,
responses={200: SignalReportFeedbackResponseSerializer},
)
@action(detail=True, methods=["post"], url_path="feedback", required_scopes=["task:write"])
def feedback(self, request, pk=None, **kwargs):
- """Forward a report's feedback note to the scout that authored it.
+ """Persist a report's thumbs rating and forward its note to the authoring scout.
- Feedback-only: unlike `state`, this never transitions the report. The note is a derived
- convenience — the durable record of the rating is the analytics event the client fires —
- so forwarding is best-effort and never fails the request.
+ Feedback-only: unlike `state`, this never transitions the report. Note forwarding is
+ best-effort and never fails the request; the action row is what the scout inactivity
+ sweep reads as consumption evidence.
"""
report = cast(SignalReport, self.get_object())
@@ -1769,17 +1812,69 @@ class SignalReportViewSet(
serializer.is_valid(raise_exception=True)
data = serializer.validated_data
+ note = data["note"].strip()
+
+ if _is_person_at_the_ui(request):
+ # The inbox posts the bare rating on click and the optional note afterwards, so a
+ # note-carrying request amends a rating the row already counted — bumping again
+ # would record one thumb choice as two interactions.
+ SignalReportAction.record(
+ team_id=self.team.id,
+ report_id=str(report.id),
+ user_id=request.user.id,
+ action_type=SignalReportAction.ActionType.FEEDBACK,
+ metadata={"sentiment": data["sentiment"]},
+ bump_count=not note,
+ )
+
+ if not note:
+ return Response(SignalReportFeedbackResponseSerializer({"forwarded": False}).data)
+
note_id = forward_feedback_note(
team=self.team,
report_id=str(report.id),
sentiment=data["sentiment"],
- note=data["note"],
+ note=note,
user_id=request.user.id if isinstance(request.user, User) else None,
scoped_team_ids=get_authenticator_scoped_team_ids(request.successful_authenticator),
api_scopes=get_authenticator_scopes(request.successful_authenticator),
)
return Response(SignalReportFeedbackResponseSerializer({"forwarded": note_id is not None}).data)
+ @extend_schema(
+ summary="Record that a person viewed a report",
+ description=(
+ "Record that the caller opened this report's detail view. One row per person per report is "
+ "kept (repeat views bump a counter), and the record counts as consumption evidence for the "
+ "scout that authored the report — scouts whose reports nobody consumes are eventually "
+ "paused. Intended as fire-and-forget from the inbox UI when a person opens a report. Only "
+ "browser-session requests leave a record; a call with any other credential (personal API "
+ "key, OAuth token) returns 204 but records nothing."
+ ),
+ request=None,
+ responses={204: None},
+ )
+ # task:read, not task:write: recording that someone read a report is part of reading it.
+ # Under resource-level RBAC a `:write` scope demands editor access, which would 403 the
+ # viewer-level members whose reads this endpoint exists to capture. Token automation is
+ # already excluded by the session-authentication gate, not by scope.
+ @action(detail=True, methods=["post"], url_path="viewed", required_scopes=["task:read"])
+ def viewed(self, request, pk=None, **kwargs):
+ """Upsert a per-person view record for the report.
+
+ Only session-authenticated callers leave a record; any other credential is a silent
+ no-op (204, nothing written), since the row exists to prove a person looked.
+ """
+ report = cast(SignalReport, self.get_object())
+ if _is_person_at_the_ui(request):
+ SignalReportAction.record(
+ team_id=self.team.id,
+ report_id=str(report.id),
+ user_id=request.user.id,
+ action_type=SignalReportAction.ActionType.VIEW,
+ )
+ return Response(status=status.HTTP_204_NO_CONTENT)
+
def _forward_dismissal_note(
self,
*,
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index b6fe1a35d54a..609af29e5f98 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -304,10 +304,10 @@ export interface SignalReportFeedbackRequestApi {
* * `negative` - negative */
sentiment: SentimentEnumApi
/**
- * Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.
+ * Free-form note explaining the rating. Capped at 4000 characters. Optional — a bare thumb carries none. When present and the report was authored by a scout, the note is forwarded to that scout as a steering note.
* @maxLength 4000
*/
- note: string
+ note?: string
}
export interface SignalReportFeedbackResponseApi {
@@ -2002,7 +2002,7 @@ export interface SignalScoutConfigApi {
* * `paused_by_system` - Paused by system
* * `paused_by_user` - Paused by user */
readonly status: ScoutConfigStatusEnumApi
- /** Why the system paused (or warned) this scout: `no_output` (it emitted nothing over the evaluation window), `ignored` (its output received no human engagement), or `repeated_failures` (consecutive failed runs). Null unless `status` is `pending_pause` or `paused_by_system`.
+ /** Why the system paused (or warned) this scout: `no_output` (it emitted nothing over the evaluation window), `ignored` (no person engaged with its reports — no view, rating, note, dismissal, or resolution), or `repeated_failures` (consecutive failed runs). Null unless `status` is `pending_pause` or `paused_by_system`.
*
* * `no_output` - No output
* * `ignored` - Ignored
@@ -2046,7 +2046,7 @@ export interface SignalScoutConfigApi {
/** How many of this scout's runs have failed in a row. Back to 0 after a successful run or any config edit. At the failure limit the scout pauses itself (`status` becomes `paused_by_system` with `pause_reason` `repeated_failures`) and retries about once a day; a successful retry resumes it, and so does setting `enabled=true`. */
readonly consecutive_failure_count: number
/**
- * When `status` last changed. For `pending_pause` this is when the warning was issued (an `ignored` warning pauses about a week later unless someone acts on the scout's reports; a `no_output` warning only flags the scout); for the paused statuses it is when the scout was paused. Null if the status never changed.
+ * When `status` last changed. For `pending_pause` this is when the warning was issued (an `ignored` warning pauses about a week later unless someone engages with the scout's reports — opening one counts; a `no_output` warning only flags the scout); for the paused statuses it is when the scout was paused. Null if the status never changed.
* @nullable
*/
readonly status_changed_at: string | null
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 1eeda82d2c6b..1787b5538c8c 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -237,7 +237,7 @@ export const getSignalsReportsFeedbackCreateUrl = (projectId: string, id: string
}
/**
- * Record a note left with the thumbs rating at the end of a report. The rating itself is a product-analytics event; this endpoint exists to carry the note into the scout steering channel. For a report authored by a scout, the note is forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer and the call is a no-op success. The report's state is never changed.
+ * Record the thumbs rating at the end of a report, with an optional note. For browser-session requests the rating is persisted as a per-person report action, which counts as consumption evidence for the scout that authored the report (scouts whose output nobody consumes are eventually paused); requests authenticated any other way record no action. When a note is present and the report was authored by a scout, the note is also forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer. The report's state is never changed.
* @summary Leave feedback on a report
*/
export const signalsReportsFeedbackCreate = async (
@@ -487,6 +487,25 @@ export const signalsReportsStateCreate = async (
})
}
+export const getSignalsReportsViewedCreateUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/signals/reports/${id}/viewed/`
+}
+
+/**
+ * Record that the caller opened this report's detail view. One row per person per report is kept (repeat views bump a counter), and the record counts as consumption evidence for the scout that authored the report — scouts whose reports nobody consumes are eventually paused. Intended as fire-and-forget from the inbox UI when a person opens a report. Only browser-session requests leave a record; a call with any other credential (personal API key, OAuth token) returns 204 but records nothing.
+ * @summary Record that a person viewed a report
+ */
+export const signalsReportsViewedCreate = async (
+ projectId: string,
+ id: string,
+ options?: RequestInit
+): Promise<void> => {
+ return apiMutator<void>(getSignalsReportsViewedCreateUrl(projectId, id), {
+ ...options,
+ method: 'POST',
+ })
+}
+
export const getSignalsReportArtefactsListUrl = (
projectId: string,
reportId: string,
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 8343216fc6b8..e91ea8a11967 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -48,9 +48,10 @@ export const SignalsReportsPartialUpdateBody = /* @__PURE__ */ zod
)
/**
- * Record a note left with the thumbs rating at the end of a report. The rating itself is a product-analytics event; this endpoint exists to carry the note into the scout steering channel. For a report authored by a scout, the note is forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer and the call is a no-op success. The report's state is never changed.
+ * Record the thumbs rating at the end of a report, with an optional note. For browser-session requests the rating is persisted as a per-person report action, which counts as consumption evidence for the scout that authored the report (scouts whose output nobody consumes are eventually paused); requests authenticated any other way record no action. When a note is present and the report was authored by a scout, the note is also forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer. The report's state is never changed.
* @summary Leave feedback on a report
*/
+export const signalsReportsFeedbackCreateBodyNoteDefault = ``
export const signalsReportsFeedbackCreateBodyNoteMax = 4000
export const SignalsReportsFeedbackCreateBody = /* @__PURE__ */ zod.object({
@@ -63,8 +64,9 @@ export const SignalsReportsFeedbackCreateBody = /* @__PURE__ */ zod.object({
note: zod
.string()
.max(signalsReportsFeedbackCreateBodyNoteMax)
+ .default(signalsReportsFeedbackCreateBodyNoteDefault)
.describe(
- 'Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.'
+ 'Free-form note explaining the rating. Capped at 4000 characters. Optional — a bare thumb carries none. When present and the report was authored by a scout, the note is forwarded to that scout as a steering note.'
),
})
diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.ts
index 99c642d01d1f..6e3cb4190591 100644
--- a/products/signals/frontend/inbox/inboxSceneLogic.ts
+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts
@@ -7,6 +7,7 @@ import { lemonToast } from '@posthog/lemon-ui'
import api from 'lib/api'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
+import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -14,6 +15,7 @@ import { Breadcrumb } from '~/types'
import type { UserType } from '~/types'
import { OriginProduct, Task, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'
+import { signalsReportsViewedCreate } from 'products/signals/frontend/generated/api'
import {
captureInboxReportClosed,
@@ -556,6 +558,10 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
})
cache.openTracking = { report, openedAt: Date.now() }
cache.pendingOpenMethod = undefined
+ // Best-effort server-side view record: consumption evidence that keeps the authoring
+ // scout from being auto-paused as ignored. The analytics event above stays the rich
+ // record (rank, open method, dwell), so a failure here is swallowed.
+ void signalsReportsViewedCreate(String(teamLogic.values.currentTeamId), report.id).catch(() => {})
},
setSelectedScoutSkillName: ({ skillName }) => {
if (skillName !== null) {
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
index f7afe3ecd3d7..bb4b294753c3 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
@@ -10,10 +10,12 @@ const REPORT = { id: 'report-1', status: 'ready', title: 'Checkout errors spiked
describe('inboxReportDetailLogic feedback note submission', () => {
let logic: ReturnType<typeof inboxReportDetailLogic.build>
- let feedbackPosts: number
+ let notePosts: number
+ let bareRatingPosts: number
beforeEach(() => {
- feedbackPosts = 0
+ notePosts = 0
+ bareRatingPosts = 0
useMocks({
get: {
'/api/projects/:team_id/signals/reports/:id/artefacts/': { results: [] },
@@ -21,9 +23,14 @@ describe('inboxReportDetailLogic feedback note submission', () => {
'/api/projects/:team_id/signals/reports/available_reviewers/': [],
},
post: {
- '/api/projects/:team_id/signals/reports/:id/feedback/': () => {
- feedbackPosts += 1
- return [200, { forwarded: true }]
+ '/api/projects/:team_id/signals/reports/:id/feedback/': async ({ request }) => {
+ const body = (await request.json()) as { note?: string }
+ if (body.note) {
+ notePosts += 1
+ } else {
+ bareRatingPosts += 1
+ }
+ return [200, { forwarded: Boolean(body.note) }]
},
},
})
@@ -43,7 +50,9 @@ describe('inboxReportDetailLogic feedback note submission', () => {
logic.actions.submitFeedbackNote('the repro steps were right')
await expectLogic(logic).toFinishAllListeners()
- expect(feedbackPosts).toBe(1)
+ // The rating itself posts once (consumption evidence), the note once despite the double-click.
+ expect(bareRatingPosts).toBe(1)
+ expect(notePosts).toBe(1)
expect(logic.values.feedbackNoteSubmitting).toBe(false)
// Re-rating reopens the note flow; the guard must have reset or this submit is silently dropped.
@@ -51,6 +60,7 @@ describe('inboxReportDetailLogic feedback note submission', () => {
logic.actions.submitFeedbackNote('actually this was stale')
await expectLogic(logic).toFinishAllListeners()
- expect(feedbackPosts).toBe(2)
+ expect(bareRatingPosts).toBe(2)
+ expect(notePosts).toBe(2)
})
})
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
index 43e5706c4a22..77bca0ddf168 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
@@ -549,7 +549,8 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
setSelectedTaskId: (taskId: string | null) => ({ taskId }),
// Inline-expand a linked task's run log within the report detail's Runs section.
toggleExpandedTask: (taskId: string) => ({ taskId }),
- // Thumbs feedback at the end of the report body. Analytics-only – nothing about the report changes.
+ // Thumbs feedback at the end of the report body. Recorded server-side as a report action
+ // (consumption evidence) – nothing about the report's state changes.
rateReport: (sentiment: InboxReportFeedbackSentiment) => ({ sentiment }),
// Optional note, offered only after a rating is in. The rating is never held up waiting for it.
openFeedbackNote: true,
@@ -1083,6 +1084,12 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
return
}
captureInboxReportFeedback({ report: values.report, sentiment, surface: 'detail_footer' })
+ // Best-effort server-side record of the bare rating: consumption evidence the scout
+ // inactivity sweep reads, so rating a report keeps its scout from being auto-paused.
+ // The analytics event above stays the durable record of the rating itself.
+ void signalsReportsFeedbackCreate(String(teamLogic.values.currentTeamId), values.report.id, {
+ sentiment,
+ }).catch(() => {})
},
// Fires on its own event so the rating stays exactly one `Inbox report feedback` per click.
submitFeedbackNote: async ({ note }) => {
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index 3c225ed60d37..0503f2670f2b 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -870,6 +870,9 @@ tools:
signals-reports-signals-retrieve:
operation: signals_reports_signals_retrieve
enabled: false
+ signals-reports-viewed-create:
+ operation: signals_reports_viewed_create
+ enabled: false
signals-scout-config-create:
operation: signals_scout_config_create
enabled: true
diff --git a/products/signals/skills/authoring-scouts/SKILL.md b/products/signals/skills/authoring-scouts/SKILL.md
index a18ef0ff0a14..4017e0ce587d 100644
--- a/products/signals/skills/authoring-scouts/SKILL.md
+++ b/products/signals/skills/authoring-scouts/SKILL.md
@@ -121,7 +121,7 @@ For an **existing scout**, tune with `posthog:scout-config-update` (find the `id
Set **`full`** for a scout whose skill needs to read arbitrary external sites, e.g. documentation, papers on arxiv.org, or a vendor status page.
Applies from the scout's next run, and changes are activity-logged.
- `auto_pause_exempt` — defaults to `false`.
- A scout whose reports nobody acts on is warned and then paused automatically (`pause_reason=ignored`) — every run costs a sandbox agent, so a scout producing output no human consumes shouldn't keep running forever. A scout that is merely quiet is only flagged (`pause_reason=no_output`, a warning that never advances to a pause), since a watch scout's silence can be its job.
+ A scout whose reports nobody engages with (no open, rating, or action — the cloud web inbox records reads; other clients don't yet) is warned and then paused automatically (`pause_reason=ignored`) — every run costs a sandbox agent, so a scout producing output no human consumes shouldn't keep running forever. A scout that is merely quiet is only flagged (`pause_reason=no_output`, a warning that never advances to a pause), since a watch scout's silence can be its job.
`-config-list` shows the warning as `status=pending_pause` and the pause as `status=paused_by_system`; setting `enabled=true` again resumes the scout, and marks it exempt so the sweep never overrules a person twice.
Set `auto_pause_exempt=true` up front for a watchdog scout whose whole job is to stay quiet, so it never even picks up the quiet flag.
- `tags` — free-form labels grouping the fleet, e.g. `["revenue", "on-call"]`. Up to 10 per scout, normalized to lowercase kebab-case (`On Call` → `on-call`) and deduped.
diff --git a/products/signals/skills/working-with-scouts/SKILL.md b/products/signals/skills/working-with-scouts/SKILL.md
index 8f7e0bcf5c94..48b367e5a139 100644
--- a/products/signals/skills/working-with-scouts/SKILL.md
+++ b/products/signals/skills/working-with-scouts/SKILL.md
@@ -125,7 +125,7 @@ Some feedback loops run on their own — knowing they exist changes how you work
- **Scratchpad memory.** Scouts write durable per-team memory (baselines, noise patterns, dedupe gates, allowlists) and get quieter and sharper across runs.
When a scout stops flagging something, check the scratchpad (`posthog:scout-scratchpad-search` for `noise:` / `addressed:` / `dedupe:` / `allowlist:` entries) before assuming it's broken — it may have deliberately learned to suppress it.
-- **Auto-pause.** A scout whose reports nobody acts on is warned (`status=pending_pause`) and then paused (`paused_by_system`, `pause_reason=ignored`).
+- **Auto-pause.** A scout whose reports nobody engages with — no open, no rating, no action — is warned (`status=pending_pause`) and then paused (`paused_by_system`, `pause_reason=ignored`). Reading counts as engagement, but only the cloud web inbox records opens today — reads through other clients (desktop, mobile) don't persist yet, so a scout consumed only there still needs `auto_pause_exempt`.
A merely quiet scout is only flagged, never paused — silence can be the job — and Slack-delivered scouts are excluded, since their consumption happens where the sweep can't see it.
Re-enabling a scout this sweep paused marks it `auto_pause_exempt`, so the sweep never overrules a person twice (resuming a `repeated_failures` pause or a user pause grants no such exemption).
- **Self-improvement suggestions.** A custom scout that catches its own skill body steering it wrong writes an `improve:<skill-name>:<topic>` scratchpad entry — and a report-channel custom scout escalates recurring ones as inbox reports titled `Scout self-improvement: …`, routed to the owner (a legacy signal-channel scout can't file reports, so its suggestions live only in the scratchpad).
diff --git a/products/signals/skills/working-with-scouts/references/delegation-recipes.md b/products/signals/skills/working-with-scouts/references/delegation-recipes.md
index a78662b309e8..ccb0c7c03476 100644
--- a/products/signals/skills/working-with-scouts/references/delegation-recipes.md
+++ b/products/signals/skills/working-with-scouts/references/delegation-recipes.md
@@ -46,7 +46,8 @@ Two options, cheapest first:
1. Most scouts already run daily (default `run_interval_minutes: 1440`) and write only when something clears the bar — so the inbox _is_ the digest.
Check the user isn't actually asking for a triage habit (`inbox-exploration` each morning).
2. If they genuinely want a roll-up report every day regardless of anomalies, that's the **daily digest / roll-up pattern** in `authoring-scouts`' `references/scout-patterns.md` — a custom scout that summarizes rather than detects.
- Set `auto_pause_exempt` thoughtfully: a digest people read but never "act on" in the inbox sense can look ignored to the auto-pause sweep.
+ Reading counts to the auto-pause sweep: opening a report in the inbox (or rating it) is recorded as consumption, so a digest people actually read won't look ignored.
+ Reserve `auto_pause_exempt` for a digest consumed somewhere the inbox can't see (forwarded, read via a client that doesn't record opens).
## "Watch something outside PostHog" (vendor status page, docs, a competitor)
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0c134cd534c7..b5dd6664c5a9 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -67306,10 +67306,10 @@ export namespace Schemas {
* * `negative` - negative */
sentiment: SentimentEnum;
/**
- * Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.
+ * Free-form note explaining the rating. Capped at 4000 characters. Optional — a bare thumb carries none. When present and the report was authored by a scout, the note is forwarded to that scout as a steering note.
* @maxLength 4000
*/
- note: string;
+ note?: string;
}
export interface SignalReportFeedbackResponse {
@@ -67437,7 +67437,7 @@ export namespace Schemas {
* * `paused_by_system` - Paused by system
* * `paused_by_user` - Paused by user */
readonly status: ScoutConfigStatusEnum;
- /** Why the system paused (or warned) this scout: `no_output` (it emitted nothing over the evaluation window), `ignored` (its output received no human engagement), or `repeated_failures` (consecutive failed runs). Null unless `status` is `pending_pause` or `paused_by_system`.
+ /** Why the system paused (or warned) this scout: `no_output` (it emitted nothing over the evaluation window), `ignored` (no person engaged with its reports — no view, rating, note, dismissal, or resolution), or `repeated_failures` (consecutive failed runs). Null unless `status` is `pending_pause` or `paused_by_system`.
*
* * `no_output` - No output
* * `ignored` - Ignored
@@ -67481,7 +67481,7 @@ export namespace Schemas {
/** How many of this scout's runs have failed in a row. Back to 0 after a successful run or any config edit. At the failure limit the scout pauses itself (`status` becomes `paused_by_system` with `pause_reason` `repeated_failures`) and retries about once a day; a successful retry resumes it, and so does setting `enabled=true`. */
readonly consecutive_failure_count: number;
/**
- * When `status` last changed. For `pending_pause` this is when the warning was issued (an `ignored` warning pauses about a week later unless someone acts on the scout's reports; a `no_output` warning only flags the scout); for the paused statuses it is when the scout was paused. Null if the status never changed.
+ * When `status` last changed. For `pending_pause` this is when the warning was issued (an `ignored` warning pauses about a week later unless someone engages with the scout's reports — opening one counts; a `no_output` warning only flags the scout); for the paused statuses it is when the scout was paused. Null if the status never changed.
* @nullable
*/
readonly status_changed_at: string | null;