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): skip idle scheduled inbox-validation scout runs (#115788)

posthog[bot]5fd7ee444fc1
diff --git a/products/signals/backend/test/test_scout_precheck.py b/products/signals/backend/test/test_scout_precheck.py
index f9e759fc3994..10d1bfe64de1 100644
--- a/products/signals/backend/test/test_scout_precheck.py
+++ b/products/signals/backend/test/test_scout_precheck.py
@@ -21,7 +21,7 @@ from posthog.models import OrganizationMembership, Team, User
from posthog.models.scoping import team_scope
from products.customer_analytics.backend.facade.testing import create_account
-from products.signals.backend.models import SignalScoutConfig, SignalScoutRun
+from products.signals.backend.models import SignalReport, SignalScoutConfig, SignalScoutRun
from products.signals.backend.scout_harness.lazy_seed import HARNESS_SEEDED_BY
from products.signals.backend.scout_harness.precheck import (
PRECHECK_MAX_ROWS,
@@ -285,6 +285,10 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
)
Experiment.objects.filter(pk=experiment.pk).update(updated_at=NOW - timedelta(days=days_since_update))
+ def _seed_report(self, status: str, *, days_since_update: int) -> None:
+ report = SignalReport.objects.create(team=self.team, status=status, title="r")
+ SignalReport.objects.filter(pk=report.pk).update(updated_at=NOW - timedelta(days=days_since_update))
+
@parameterized.expand(
[
("customer_analytics_no_accounts", "signals-scout-customer-analytics", None, "skip"),
@@ -299,6 +303,10 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
("tasks_absent", "signals-scout-tasks", None, "skip"),
("tasks_scout_runs_only", "signals-scout-tasks", "scout_run", "skip"),
("tasks_user_runs", "signals-scout-tasks", "user_run", "run"),
+ ("inbox_validation_absent", "signals-scout-inbox-validation", None, "skip"),
+ ("inbox_validation_old_resolution", "signals-scout-inbox-validation", "resolved_15d", "skip"),
+ ("inbox_validation_recent_unresolved", "signals-scout-inbox-validation", "ready_1d", "skip"),
+ ("inbox_validation_recent_resolution", "signals-scout-inbox-validation", "resolved_13d", "run"),
]
)
def test_system_table_defaults_skip_only_on_absence(self, _name, skill, seed, outcome) -> None:
@@ -325,6 +333,12 @@ class TestSystemTableSkillDefaults(ClickhouseTestMixin, NonAtomicBaseTest):
self._seed_task_run("signals_scout")
elif seed == "user_run":
self._seed_task_run("user_created")
+ elif seed == "resolved_15d":
+ self._seed_report(SignalReport.Status.RESOLVED, days_since_update=15)
+ elif seed == "ready_1d":
+ self._seed_report(SignalReport.Status.READY, days_since_update=1)
+ elif seed == "resolved_13d":
+ self._seed_report(SignalReport.Status.RESOLVED, days_since_update=13)
with (
patch(ROLLOUT_PERCENT, return_value=100),
diff --git a/products/signals/skills/signals-scout-inbox-validation/SKILL.md b/products/signals/skills/signals-scout-inbox-validation/SKILL.md
index 2770ef7beef5..85199f4b9cc6 100644
--- a/products/signals/skills/signals-scout-inbox-validation/SKILL.md
+++ b/products/signals/skills/signals-scout-inbox-validation/SKILL.md
@@ -20,6 +20,13 @@ scout-role: operational
metadata:
owner_team: signals
scope: inbox_validation
+scout-precheck-query: |
+ SELECT id, title, updated_at
+ FROM system.inbox_reports
+ WHERE status = 'resolved'
+ AND updated_at > {now} - INTERVAL 14 DAY
+ ORDER BY updated_at DESC
+ LIMIT 20
---
# Signals scout: inbox validation
@@ -53,6 +60,8 @@ Two cheap reads decide whether this run does any work:
- `inbox-reports-list {"status": "resolved", "ordering": "-updated_at", "limit": 20}` — recently resolved reports.
- `scout-report-check-list` on the ones you do not recognize — a report that already carries an active check is covered, whoever attached it.
+A scheduled run can start with a `<precheck_result>` block. Each row is a resolved report whose `updated_at` falls in the last 14 days, newest first, the same as the first page of the `inbox-reports-list` read above. When the block is present, use it in place of that read for the quick close-out, and still page past it when all 20 rows are covered.
+
If no report's `updated_at` falls in the last 14 days, there is nothing to do. If the project has no resolved reports at all, write `not-in-use:inbox_validation:team{team_id}` ("checked at {timestamp}, no resolved reports yet — nothing to follow up"). Close out empty. Don't sweep cold history: a report resolved more than 14 days before you first saw it is backlog, not a follow-up — leave it alone.
## How a run works