:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): add scout lifecycle status with reason-scoped pauses (#75349)
Andrew Maguired84d21eecdd5
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsxindex 3b813ba9a7d3..0dbf9126a357 100644--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx@@ -13,6 +13,8 @@ const config: SignalScoutConfigApi = {description: 'General scout',scout_origin: 'canonical',enabled: true,+ status: 'active',+ pause_reason: null,emit: true,run_interval_minutes: 1440,run_cron_schedule: '0 9 * * *',diff --git a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.tsindex 70aef9c13b52..7537bab63d72 100644--- a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts+++ b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts@@ -33,6 +33,8 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {description: 'Investigates recurring checkout failures.',scout_origin: 'custom',enabled: false,+ status: 'paused_by_user',+ pause_reason: null,emit: false,run_interval_minutes: 60,run_cron_schedule: null,diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.tsindex e43993f5b291..8d35bc5fb29f 100644--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts@@ -38,6 +38,8 @@ const BASE_CONFIG: SignalScoutConfigApi = {description: 'Finds error trends.',scout_origin: 'canonical',enabled: true,+ status: 'active',+ pause_reason: null,emit: true,run_interval_minutes: 1440,run_cron_schedule: null,diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.pyindex f166ab1d4a97..6c3a1f4906f6 100644--- a/posthog/models/activity_logging/activity_log.py+++ b/posthog/models/activity_logging/activity_log.py@@ -335,6 +335,7 @@ field_name_overrides: dict[AuditableScope, dict[str, str]] = {"SignalScoutConfig": {"run_interval_minutes": "run interval (minutes)","emit": "emit findings",+ "pause_reason": "pause reason",},"OAuthApplication": {"_provisioning_config": "provisioning config",@@ -759,6 +760,10 @@ field_exclusions: dict[AuditableScope, list[str]] = {# Run bookkeeping, not user intent — keep it out of change detection even when it# rides along with a real change (belt-and-suspenders with signal_exclusions above)."last_run_at",+ # Companion bookkeeping that rides along with every logged `status` change; the+ # activity log entry itself already carries who and when.+ "status_changed_at",+ "status_changed_by",# Reverse relations auto-managed by FK creates, not user-initiated config changes."runs",],diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 3762a31e1edb..2922af29a266 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -549,6 +549,8 @@ SPECTACULAR_SETTINGS = {# path (drf-spectacular generates the x-spec-enum-id from the same tuples).# --- Model class paths (ChoiceField x-spec-enum-id hashes) ---"SignalReportRefundReasonEnum": "products.signals.backend.models.SignalReportRefund.Reason",+ "ScoutConfigStatusEnum": "products.signals.backend.models.SignalScoutConfig.Status",+ "ScoutConfigPauseReasonEnum": "products.signals.backend.models.SignalScoutConfig.PauseReason","EngineeringAnalyticsPRStateEnum": "products.engineering_analytics.backend.facade.contracts.PRState","QuarantineModeEnum": "products.engineering_analytics.backend.facade.contracts.QuarantineMode","CITestRunnerEnum": "products.engineering_analytics.backend.facade.contracts.CITestRunner",diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.mdindex 9ce45c8d12ec..163c08196798 100644--- a/products/signals/ARCHITECTURE.md+++ b/products/signals/ARCHITECTURE.md@@ -542,7 +542,11 @@ Per-scout binding for the headless **Signals agent**: one row per `(team, skill_| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ || `team` | FK → Team | Owning team (`related_name="signal_scout_configs"`). `unique_together(team, skill_name)`. || `skill_name` | CharField | The `signals-scout-*` skill this row controls. Auto-registered by the coordinator when it finds the skill on a participating team. |-| `enabled` | Boolean | Per-scout switch; defaults `True`. `False` pauses just this scout. |+| `enabled` | Boolean | Per-scout switch; defaults `True`. Derived from `status` (`enabled = status in (active, pending_pause)`) but kept as a real column for SQL filtering and the warehouse mirror; `save()` reconciles the pair for writers that set only one side. |+| `status` | Char (choices) | Lifecycle source of truth: `active` / `pending_pause` / `paused_by_system` / `paused_by_user`. Who paused is the state itself: the system may resume its own pauses but must never touch a human's. `pending_pause` still runs (a warning, not a pause) and is cleared by any human config edit. |+| `pause_reason` | Char (nullable) | Why the system paused or warned: `no_output` / `ignored` / `repeated_failures`. Also names the writer that owns the pause: a system writer may only clear or overwrite a pause carrying its own reason (`transition_status_by_system()`). Null outside `pending_pause` / `paused_by_system`. |+| `status_changed_at` | DateTime (nullable) | When `status` last changed. Anchors the cold-start grace window (`in_cold_start_grace()`): any move back to `active` re-anchors it, deliberately independent of the actor so the window survives account deletion. |+| `status_changed_by` | FK → User (nullable) | The human behind the last status change; null on system transitions, so a human re-enable and a system resume are distinguishable and a system pause never reads as a person's action. || `emit` | Boolean | Dry-run vs emit. Defaults `True`: a freshly authored scout is live from its first tick. Flip to `False` for dry-run — the scout runs and logs but `emit_finding` writes nothing — to validate it on a team before its findings reach the inbox. || `run_interval_minutes` | PositiveInteger | Minutes between runs. The coordinator dispatches rolling schedules when `last_run_at is None or now - last_run_at >= run_interval_minutes`. Default `1440` (daily). Validated `30 <= N <= 43200`. || `run_cron_schedule` | Char (nullable) | Optional five-field cron expression anchoring runs to wall-clock slots; takes precedence over `run_interval_minutes` when set. Interpreted in the project's timezone so daylight-saving changes are applied automatically. Occurrences must be ≥ 30 minutes apart. Null keeps the rolling interval behavior. |diff --git a/products/signals/backend/admin.py b/products/signals/backend/admin.pyindex 85e1a3d19a11..8300a4d69073 100644--- a/products/signals/backend/admin.py+++ b/products/signals/backend/admin.py@@ -91,6 +91,7 @@ class SignalScoutConfigAdmin(admin.ModelAdmin):"team_link","skill_name","enabled",+ "status","emit","run_interval_minutes","run_cron_schedule",@@ -98,10 +99,24 @@ class SignalScoutConfigAdmin(admin.ModelAdmin):"updated_at",)list_display_links = ("id",)- list_filter = ("enabled", "emit")+ list_filter = ("enabled", "status", "emit")search_fields = ("id", "skill_name", "team__name", "team__organization__name")raw_id_fields = ("team", "created_by", "enabled_by")- readonly_fields = ("id", "created_at", "updated_at", "last_run_at")+ # The status cluster is read-only here: admin's lifecycle control stays the `enabled`+ # checkbox (the model's save() derives the status pair from it), and a hand-edited status+ # or attribution stamp would bypass the transition rules the API and system writers+ # enforce. Read-only also keeps `status_changed_by` off the default user `<select>`,+ # which would load the whole user table.+ readonly_fields = (+ "id",+ "created_at",+ "updated_at",+ "last_run_at",+ "status",+ "pause_reason",+ "status_changed_at",+ "status_changed_by",+ )list_select_related = ("team", "team__organization")show_full_result_count = Falsediff --git a/products/signals/backend/migrations/0077_signalscoutconfig_status.py b/products/signals/backend/migrations/0077_signalscoutconfig_status.pynew file mode 100644index 000000000000..f1bc5e4dfe67--- /dev/null+++ b/products/signals/backend/migrations/0077_signalscoutconfig_status.py@@ -0,0 +1,59 @@+import django.db.models.deletion+from django.conf import settings+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0076_signalscoutnote_discussion_origin"),+ ]++ operations = [+ migrations.AddField(+ model_name="signalscoutconfig",+ name="status",+ field=models.CharField(+ choices=[+ ("active", "Active"),+ ("pending_pause", "Pending pause"),+ ("paused_by_system", "Paused by system"),+ ("paused_by_user", "Paused by user"),+ ],+ db_default="active",+ default="active",+ max_length=20,+ ),+ ),+ migrations.AddField(+ model_name="signalscoutconfig",+ name="pause_reason",+ field=models.CharField(+ blank=True,+ choices=[+ ("no_output", "No output"),+ ("ignored", "Ignored"),+ ("repeated_failures", "Repeated failures"),+ ],+ max_length=20,+ null=True,+ ),+ ),+ migrations.AddField(+ model_name="signalscoutconfig",+ name="status_changed_at",+ field=models.DateTimeField(blank=True, null=True),+ ),+ migrations.AddField(+ model_name="signalscoutconfig",+ name="status_changed_by",+ field=models.ForeignKey(+ blank=True,+ db_constraint=False,+ db_index=False,+ null=True,+ on_delete=django.db.models.deletion.SET_NULL,+ related_name="+",+ to=settings.AUTH_USER_MODEL,+ ),+ ),+ ]diff --git a/products/signals/backend/migrations/0078_backfill_scout_status.py b/products/signals/backend/migrations/0078_backfill_scout_status.pynew file mode 100644index 000000000000..c8793d3a6e5b--- /dev/null+++ b/products/signals/backend/migrations/0078_backfill_scout_status.py@@ -0,0 +1,22 @@+from django.db import migrations+++def backfill_paused_by_user(apps, schema_editor):+ # Rows disabled before `status` existed can only have been switched off by a human:+ # nothing system-driven ever wrote `enabled` until this field shipped. One UPDATE over a+ # small table (scout configs, not events); kept separate from 0077's AddFields so the+ # data write never shares a transaction with schema locks.+ SignalScoutConfig = apps.get_model("signals", "SignalScoutConfig")+ # `_default_manager`, not `objects`: the model's Meta routes the default manager to the+ # unscoped `all_teams`, so the historical model carries no `objects` attribute.+ SignalScoutConfig._default_manager.filter(enabled=False).update(status="paused_by_user")+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0077_signalscoutconfig_status"),+ ]++ operations = [+ migrations.RunPython(backfill_paused_by_user, reverse_code=migrations.RunPython.noop),+ ]diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txtindex 440e27a30f12..0d601943f305 100644--- a/products/signals/backend/migrations/max_migration.txt+++ b/products/signals/backend/migrations/max_migration.txt@@ -1 +1 @@-0076_signalscoutnote_discussion_origin+0078_backfill_scout_statusdiff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex 862144098e7f..15b50904f47a 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -1,6 +1,6 @@import loggingfrom collections import defaultdict-from datetime import datetime+from datetime import datetime, timedeltafrom typing import Any, castfrom django.contrib.postgres.fields import ArrayField@@ -1096,6 +1096,43 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):# ModelActivityMixin only logs deletes when this is set.activity_logging_on_delete = True+ class Status(models.TextChoices):+ """Lifecycle states a writer deliberately moves a scout between.++ Deliberately small: only states that change what the scheduler does belong here.+ Windowed assessments (engagement, cold-start newness, a failing-but-not-tripped+ streak) are derived at read time, never persisted as a status.+ """++ ACTIVE = "active", "Active"+ # Warned by a system writer: will be paused on a set date unless something changes.+ # Still scheduled. A state rather than a notification so the sweep that sets it is+ # idempotent and any human touch has something concrete to clear.+ PENDING_PAUSE = "pending_pause", "Pending pause"+ PAUSED_BY_SYSTEM = "paused_by_system", "Paused by system"+ # A human switched the scout off. No system writer may resume or re-pause it.+ PAUSED_BY_USER = "paused_by_user", "Paused by user"++ class PauseReason(models.TextChoices):+ """Why a system writer paused (or warned) a scout.++ Each value also identifies the writer that owns the pause: a system writer may only+ clear or overwrite a pause carrying its own reason (`transition_status_by_system`),+ which is what keeps independent pause mechanisms from undoing each other.+ """++ NO_OUTPUT = "no_output", "No output"+ IGNORED = "ignored", "Ignored"+ REPEATED_FAILURES = "repeated_failures", "Repeated failures"++ # The `status` side of the `enabled` dual-write: a scout in one of these statuses is+ # scheduled by the coordinator. `pending_pause` still runs; the warning is not a pause.+ RUNNABLE_STATUSES = (Status.ACTIVE, Status.PENDING_PAUSE)++ # How long a scout is treated as provisional after creation or a human re-enable, during+ # which system writers should leave it alone (`in_cold_start_grace`).+ COLD_START_GRACE = timedelta(days=14)+# `objects` (TeamScopedManager) inherited from TeamScopedRootMixin stays fail-closed for# explicit user code. `all_teams` is the unscoped sibling for Django framework internals# (admin changelist queryset, related-object access, prefetch_related) that must not@@ -1114,7 +1151,51 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):# row when it discovers a scout skill on a participating team, so a user authoring# `signals-scout-foo` gets a row (on the default schedule) on the next tick.skill_name = models.CharField(max_length=200)+ # Derived from `status` (`enabled = status in RUNNABLE_STATUSES`), but kept as a real+ # column because the coordinator filters on it at SQL level and the warehouse mirrors it.+ # `save` reconciles the pair for writers that only set one side; a DB constraint backstop+ # is deferred to a follow-up migration (see Meta.constraints) so rolling deploys with+ # enabled-only writers still in flight don't break.enabled = models.BooleanField(default=True, db_default=True)+ # Source of truth for the scout's lifecycle. Two of the four states pause scheduling; who+ # set the pause is the state itself (`paused_by_user` vs `paused_by_system`), not a+ # side-channel field, because the two must behave differently: the system may resume its+ # own pauses but must never touch a human's.+ status = models.CharField(+ max_length=20,+ choices=Status.choices,+ default=Status.ACTIVE,+ db_default=Status.ACTIVE,+ )+ # Set only alongside `pending_pause` / `paused_by_system`; see `PauseReason`.+ pause_reason = models.CharField(+ max_length=20,+ choices=PauseReason.choices,+ null=True,+ blank=True,+ )+ # When `status` last changed. Bookkeeping that rides along with the logged status change+ # itself, so it is excluded from activity logging. Null until the first transition;+ # `created_at` anchors the cold-start grace window for rows that never transitioned.+ status_changed_at = models.DateTimeField(null=True, blank=True)+ # Who last moved `status`, when a human did (through the config API). Null for system+ # transitions, unattributed writes, and rows whose status never changed. The enum already+ # says whether a pause is human or system; this adds WHO for human actions and tells a+ # human re-enable apart from a system resume. Who last edited anything else on the row+ # stays the activity log's job. `db_constraint=False` because posthog_user is a hot table+ # and adding the FK constraint would lock it; integrity is app-level only, like the+ # constraint-free path recommended for hot-table FKs. `db_index=False` because nothing+ # queries by attribution (it is read per-row) and the FK's default index would otherwise+ # be built non-concurrently inside the migration.+ status_changed_by = models.ForeignKey(+ "posthog.User",+ on_delete=models.SET_NULL,+ null=True,+ blank=True,+ related_name="+",+ db_constraint=False,+ db_index=False,+ )# Dry-run vs emit. Defaults emit-on so a freshly authored scout is live from its first# tick. Flip to False for dry-run — the scout runs and logs but `emit_finding` writes# nothing — to validate it on a team before its findings reach the inbox.@@ -1180,8 +1261,137 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):default_manager_name = "all_teams"constraints = [models.UniqueConstraint(fields=["team", "skill_name"], name="unique_scout_config_per_team_skill"),+ # A CHECK constraint tying `enabled` to `status` is deliberately deferred to a+ # follow-up migration: enforcing it in the same deploy that introduces the+ # dual-write breaks rolling deploys, because not-yet-replaced instances still+ # write `enabled` alone and a NOT VALID constraint already checks new writes.+ # That follow-up must first re-run the enabled-wins reconciliation over drifted+ # rows (enabled-only writes from old instances during the rollout window land+ # after the 0075 backfill), then add and validate the constraint.]+ def save(self, *args: Any, **kwargs: Any) -> None:+ """Keep the `enabled` / `status` pair consistent for writers that only set one side.++ `status` is the source of truth, but callers that predate it (fixtures, ad-hoc+ scripts, the config API's `enabled` field) still write `enabled` alone. When the pair+ disagrees at save time, resolve toward whichever side the caller touched: `status`+ wins when `update_fields` names it without `enabled`, or on a create where a+ non-default status was passed explicitly; otherwise the `enabled` value is taken as+ the intent (True resumes any pause, False records a user pause).+ """+ update_fields = kwargs.get("update_fields")+ if self.enabled != (self.status in self.RUNNABLE_STATUSES):+ fields = set(update_fields) if update_fields is not None else None+ status_is_intent = (+ ("status" in fields and "enabled" not in fields)+ if fields is not None+ else (self._state.adding and self.status != self.Status.ACTIVE)+ )+ if status_is_intent:+ self.enabled = self.status in self.RUNNABLE_STATUSES+ touched = {"enabled"}+ else:+ self.status = self.Status.ACTIVE if self.enabled else self.Status.PAUSED_BY_USER+ self.pause_reason = None+ # An enabled-only write carries no actor, so the attribution stamp is cleared+ # rather than left pointing at whoever made the previous transition.+ self.status_changed_by = None+ touched = {"status", "pause_reason", "status_changed_by"}+ if not self._state.adding:+ self.status_changed_at = timezone.now()+ touched.add("status_changed_at")+ if fields is not None:+ kwargs["update_fields"] = fields | touched+ super().save(*args, **kwargs)++ def transition_status_by_system(+ self,+ new_status: "SignalScoutConfig.Status",+ *,+ pause_reason: "SignalScoutConfig.PauseReason",+ evaluated_at: datetime | None = None,+ ) -> bool:+ """Apply a system-driven status transition under the reason-scoped ownership rule.++ `pause_reason` names the calling writer (an inactivity sweep passes `no_output`, a+ failure breaker `repeated_failures`) as well as the reason recorded on a pause. The+ rule: a system writer may never touch `paused_by_user`, and may only move a scout+ whose current pause carries its own reason, so independent pause mechanisms cannot+ clear or overwrite each other's state. The checks run against a freshly locked row,+ not the caller's instance, so a human pause or another writer's claim that landed+ after the caller read the row cannot be overwritten. Pass `evaluated_at` (when the+ caller read the state its decision is based on) to also refuse the transition if the+ status moved after that moment, e.g. a human re-enable racing a sweep's pause.+ Saves and returns True when the transition applies; returns False without writing+ when it is refused or a no-op.+ """+ if new_status == self.Status.PAUSED_BY_USER:+ raise ValueError("Only a user write may set paused_by_user.")+ with transaction.atomic():+ locked = type(self).all_teams.select_for_update().get(pk=self.pk)+ if locked.status == self.Status.PAUSED_BY_USER:+ return False+ if locked.status != self.Status.ACTIVE and locked.pause_reason != pause_reason:+ return False+ # A warning is weaker than a pause: a delayed or retried warn must not reopen a+ # scout its own writer already paused (pending_pause is runnable).+ if new_status == self.Status.PENDING_PAUSE and locked.status == self.Status.PAUSED_BY_SYSTEM:+ return False+ if (+ evaluated_at is not None+ and locked.status_changed_at is not None+ and locked.status_changed_at > evaluated_at+ ):+ return False+ # A resume must not carry the team past the enabled-scout cap: the pause freed a+ # slot the config API may have legitimately given to another scout since.+ from products.signals.backend.scout_harness.limits import ( # noqa: PLC0415 — importing via the scout_harness package init would put lazy_seed/skill_loader on the django.setup() path that loads this module+ MAX_ENABLED_SCOUTS_PER_TEAM,+ )++ if new_status in self.RUNNABLE_STATUSES and locked.status not in self.RUNNABLE_STATUSES:+ peers = type(self).all_teams.filter(team_id=locked.team_id, enabled=True).exclude(pk=locked.pk).count()+ if peers >= MAX_ENABLED_SCOUTS_PER_TEAM:+ return False+ recorded_reason = None if new_status == self.Status.ACTIVE else pause_reason+ if new_status == locked.status and recorded_reason == locked.pause_reason:+ return False+ locked.status = new_status+ locked.pause_reason = recorded_reason+ locked.status_changed_at = timezone.now()+ locked.status_changed_by = None+ locked.enabled = new_status in self.RUNNABLE_STATUSES+ locked.save(+ update_fields=[+ "status",+ "pause_reason",+ "status_changed_at",+ "status_changed_by",+ "enabled",+ "updated_at",+ ]+ )+ for field in ("status", "pause_reason", "status_changed_at", "status_changed_by", "enabled"):+ setattr(self, field, getattr(locked, field))+ return True++ def in_cold_start_grace(self) -> bool:+ """True while the scout is provisional and system writers should not evaluate it.++ Anchored on `created_at`, re-anchored by any move back to `active`: a re-enable or a+ system resume grants a fresh window before the next evaluation. Deliberately not+ keyed on `status_changed_by` so the window survives the actor's account being+ deleted (`SET_NULL`). A `pending_pause` warning never re-anchors (status is not+ `active`), so a sweep cannot put its own candidates back into grace. Time-based+ only; a consumer that also wants a minimum-runs floor applies that on top, since the+ floor differs per writer.+ """+ anchor = self.created_at+ if self.status == self.Status.ACTIVE and self.status_changed_at is not None:+ anchor = max(anchor, self.status_changed_at)+ return timezone.now() < anchor + self.COLD_START_GRACE+def _get_before_update(self, **kwargs: Any) -> "SignalScoutConfig | None":# ModelActivityMixin's prior-state lookup goes through `objects` (the fail-closed# TeamScopedManager). Edits from Django admin / the coordinator / a shell run with nodiff --git a/products/signals/backend/scout_harness/profile/builders.py b/products/signals/backend/scout_harness/profile/builders.pyindex 90b496ec8f44..5783ae1c9a84 100644--- a/products/signals/backend/scout_harness/profile/builders.py+++ b/products/signals/backend/scout_harness/profile/builders.py@@ -73,7 +73,7 @@ logger = logging.getLogger(__name__)# rows whose `source_version` doesn't match the current build, so adding a new key here# (or restructuring an existing one) without bumping the version would silently mix old# and new shapes in the cache.-INVENTORY_SOURCE_VERSION = "v11"+INVENTORY_SOURCE_VERSION = "v12"# Top-events ClickHouse query bounds. 7d is short enough to spot recent bursts and long# enough to stabilize counts on low-traffic teams; 50 covers the long tail without@@ -357,11 +357,18 @@ def _scout_fleet(team: Team) -> dict[str, Any]:disabled: list[dict[str, Any]] = []for config in SignalScoutConfig.objects.for_team(team.id).exclude(skill_name__in=withheld).order_by("skill_name"):last_emitted_at = last_emitted_by_skill.get(config.skill_name)- # `enabled` is what an operator set, so it names the reason when it's off; a skill that- # can't dispatch is the residual case where the operator left the scout on.+ # `status` says who switched an off scout off: `turned_off` is a human's (or a seed+ # posture's) decision, `auto_paused` is the system's own verdict. Conflating them+ # would tell the fleet an operator chose something no operator chose. A skill that+ # can't dispatch is the residual case where the scout was left on.not_running_reason = None+ pause_reason = Noneif not config.enabled:- not_running_reason = "turned_off"+ if config.status == SignalScoutConfig.Status.PAUSED_BY_SYSTEM:+ not_running_reason = "auto_paused"+ pause_reason = config.pause_reason+ else:+ not_running_reason = "turned_off"elif config.skill_name not in live_skills:not_running_reason = "skill_unavailable"entry = {@@ -372,6 +379,7 @@ def _scout_fleet(team: Team) -> dict[str, Any]:"last_run_at": config.last_run_at.isoformat() if config.last_run_at else None,"last_emitted_at": last_emitted_at.isoformat() if last_emitted_at else None,"not_running_reason": not_running_reason,+ "pause_reason": pause_reason,}(disabled if not_running_reason else enabled).append(entry)return {diff --git a/products/signals/backend/scout_harness/profile/schema.py b/products/signals/backend/scout_harness/profile/schema.pyindex 1d987c617214..b6635f256987 100644--- a/products/signals/backend/scout_harness/profile/schema.py+++ b/products/signals/backend/scout_harness/profile/schema.py@@ -96,10 +96,14 @@ class ScoutFleetEntry(_Section):# authored/edited report), within the run-history window `_scout_fleet` scans. Null means# the scout has been quiet for at least that window, not that it has never emitted.last_emitted_at: str | None- # Why this scout is in the `disabled` bucket: `turned_off` (an operator set `enabled=False`)- # or `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so the+ # Why this scout is in the `disabled` bucket: `turned_off` (a human or seed posture set+ # `enabled=False`), `auto_paused` (the system paused it — no operator chose this), or+ # `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so the# coordinator never dispatches it). Null for scouts that actually run.not_running_reason: str | None+ # The cause behind an `auto_paused` entry (`no_output` / `ignored` / `repeated_failures`);+ # null for every other entry.+ pause_reason: str | Noneclass ScoutFleet(_Section):diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex bcf74d5eaf66..f68b45b1d051 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -1202,9 +1202,17 @@ class ScoutFleetEntrySerializer(serializers.Serializer):not_running_reason = serializers.CharField(allow_null=True,help_text=(- "Why this scout is in the `disabled` bucket: `turned_off` (an operator set it off) or "- "`skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so it "- "never dispatches). Null for scouts that actually run."+ "Why this scout is in the `disabled` bucket: `turned_off` (a person or seed posture set it "+ "off), `auto_paused` (the system paused it), or `skill_unavailable` (left on, but its skill "+ "was deleted, superseded, or withheld, so it never dispatches). Null for scouts that "+ "actually run."+ ),+ )+ pause_reason = serializers.CharField(+ allow_null=True,+ help_text=(+ "The cause behind an `auto_paused` entry: `no_output`, `ignored`, or `repeated_failures`. "+ "Null for every other entry."),)@@ -1888,7 +1896,31 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):)enabled = serializers.BooleanField(read_only=True,- help_text="Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",+ help_text=(+ "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. "+ "Derived from `status`: true for `active` and `pending_pause`, false for the paused statuses."+ ),+ )+ status = serializers.ChoiceField(+ choices=SignalScoutConfig.Status.choices,+ read_only=True,+ help_text=(+ "Lifecycle status. `active`: runs on its schedule. `pending_pause`: still running, but "+ "flagged by the system to pause soon unless something changes (any config edit clears it). "+ "`paused_by_system`: paused automatically, see `pause_reason`; set `enabled=true` to resume. "+ "`paused_by_user`: switched off by a person and never resumed automatically."+ ),+ )+ pause_reason = serializers.ChoiceField(+ choices=SignalScoutConfig.PauseReason.choices,+ read_only=True,+ 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`."+ ),)emit = serializers.BooleanField(read_only=True,@@ -1940,6 +1972,8 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):"description","scout_origin","enabled",+ "status",+ "pause_reason","emit","run_interval_minutes","run_cron_schedule",@@ -1980,7 +2014,13 @@ class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):enabled = serializers.BooleanField(required=False,- help_text="Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",+ help_text=(+ "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. "+ "Turning this off records a user pause (`status` becomes `paused_by_user`, which the system "+ "never overrides); turning it on resumes the scout from any pause. Only a change of value "+ "is a lifecycle action: re-sending the current value leaves the existing status and its "+ "ownership untouched."+ ),)emit = serializers.BooleanField(required=False,@@ -2022,6 +2062,30 @@ class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):field in validated_data and validated_data[field] != getattr(instance, field) for field in schedule_fields):validated_data["schedule_changed_at"] = timezone.now()+ # This serializer is the human write path, so it moves `status` through `enabled`:+ # false is a user pause the system must never override, true resumes from any pause.+ # Only a CHANGED `enabled` value is a lifecycle action — clients (MCP callers+ # especially) resend whole config objects, and a re-sent `enabled=false` on a+ # system-paused scout must not silently escalate it to a user pause the system may+ # never resume. Any other non-empty edit still clears a pending pause, since a human+ # tending the config is exactly the signal the warning exists to detect; an empty+ # PATCH is not an edit and must not count as human contact.+ if "enabled" in validated_data and validated_data["enabled"] != instance.enabled:+ target = (+ SignalScoutConfig.Status.ACTIVE+ if validated_data["enabled"]+ else SignalScoutConfig.Status.PAUSED_BY_USER+ )+ elif validated_data and instance.status == SignalScoutConfig.Status.PENDING_PAUSE:+ target = SignalScoutConfig.Status.ACTIVE+ else:+ target = None+ if target is not None and target != instance.status:+ request = self.context.get("request")+ validated_data["status"] = target+ validated_data["pause_reason"] = None+ validated_data["status_changed_at"] = timezone.now()+ validated_data["status_changed_by"] = getattr(request, "user", None)return super().update(instance, validated_data)class Meta:diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 9a2a380f8ff3..57b2dedb96cf 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -1355,6 +1355,88 @@ class TestScoutHarnessConfigAPI(APIBaseTest):assert config.run_interval_minutes == 60assert config.enabled_by_id == self.user.id+ def test_partial_update_disable_records_a_user_pause(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={"enabled": False}, format="json")++ assert response.status_code == status.HTTP_200_OK+ assert response.json()["status"] == "paused_by_user"+ config.refresh_from_db()+ assert config.status == SignalScoutConfig.Status.PAUSED_BY_USER+ assert config.status_changed_by_id == self.user.id++ def test_partial_update_enable_resumes_a_system_pause_and_clears_the_reason(self) -> None:+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ enabled=False,+ status=SignalScoutConfig.Status.PAUSED_BY_SYSTEM,+ pause_reason=SignalScoutConfig.PauseReason.NO_OUTPUT,+ )++ response = self.client.patch(self._detail_url(str(config.id)), data={"enabled": True}, format="json")++ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert body["status"] == "active"+ assert body["pause_reason"] is None+ config.refresh_from_db()+ assert config.status == SignalScoutConfig.Status.ACTIVE+ assert config.pause_reason is None+ assert config.enabled is True++ def test_partial_update_without_enabled_clears_a_pending_pause(self) -> None:+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ status=SignalScoutConfig.Status.PENDING_PAUSE,+ pause_reason=SignalScoutConfig.PauseReason.NO_OUTPUT,+ )++ response = self.client.patch(self._detail_url(str(config.id)), data={"run_interval_minutes": 60}, format="json")++ assert response.status_code == status.HTTP_200_OK+ config.refresh_from_db()+ assert config.status == SignalScoutConfig.Status.ACTIVE+ assert config.pause_reason is None++ def test_resending_enabled_false_does_not_escalate_a_system_pause(self) -> None:+ # Clients resend whole config objects; an unchanged `enabled=false` must not convert+ # a system pause into a user pause the system may never resume.+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ enabled=False,+ status=SignalScoutConfig.Status.PAUSED_BY_SYSTEM,+ pause_reason=SignalScoutConfig.PauseReason.NO_OUTPUT,+ )++ response = self.client.patch(+ self._detail_url(str(config.id)), data={"enabled": False, "run_interval_minutes": 120}, format="json"+ )++ assert response.status_code == status.HTTP_200_OK+ config.refresh_from_db()+ assert config.status == SignalScoutConfig.Status.PAUSED_BY_SYSTEM+ assert config.pause_reason == SignalScoutConfig.PauseReason.NO_OUTPUT+ assert config.run_interval_minutes == 120++ def test_empty_partial_update_does_not_clear_a_pending_pause(self) -> None:+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ status=SignalScoutConfig.Status.PENDING_PAUSE,+ pause_reason=SignalScoutConfig.PauseReason.NO_OUTPUT,+ )++ response = self.client.patch(self._detail_url(str(config.id)), data={}, format="json")++ assert response.status_code == status.HTTP_200_OK+ config.refresh_from_db()+ assert config.status == SignalScoutConfig.Status.PENDING_PAUSE+ assert config.pause_reason == SignalScoutConfig.PauseReason.NO_OUTPUT+def test_partial_update_slack_destination_is_project_scoped_and_round_trips(self) -> None:config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")other_team = Team.objects.create(organization=self.organization, name="other")@@ -1702,6 +1784,7 @@ class TestScoutHarnessConfigAPI(APIBaseTest):config = SignalScoutConfig.objects.get(team=self.team, skill_name="signals-scout-fresh")assert config.enabled is Falseassert config.enabled_by_id is None+ assert config.status == SignalScoutConfig.Status.PAUSED_BY_USERdef test_create_upserts_existing_config(self) -> None:self._make_skill("signals-scout-fresh")diff --git a/products/signals/backend/test/test_scout_harness_profile.py b/products/signals/backend/test/test_scout_harness_profile.pyindex a02ccfb0020b..9d60627b535a 100644--- a/products/signals/backend/test/test_scout_harness_profile.py+++ b/products/signals/backend/test/test_scout_harness_profile.py@@ -73,6 +73,7 @@ from products.signals.backend.scout_harness.profile.builders import (_signal_source_configs,_top_events,)+from products.signals.backend.scout_harness.profile.schema import ScoutFleetEntryfrom products.signals.backend.scout_harness.tools.profile import (PROFILE_TTL,compute_project_profile,@@ -337,6 +338,20 @@ class TestScoutFleet(BaseTest):assert entry["not_running_reason"] == "turned_off"+ def test_system_paused_scout_is_not_reported_as_operator_intent(self) -> None:+ config = self._config("signals-scout-logs", enabled=False)+ config.status = SignalScoutConfig.Status.PAUSED_BY_SYSTEM+ config.pause_reason = SignalScoutConfig.PauseReason.NO_OUTPUT+ config.save(update_fields=["status", "pause_reason"])++ entry = _scout_fleet(self.team)["disabled"][0]++ assert entry["not_running_reason"] == "auto_paused"+ assert entry["pause_reason"] == "no_output"+ # The entry must survive the forbid-extra inventory schema, or `build_inventory()`+ # raises and no profile on the team can refresh.+ ScoutFleetEntry.model_validate(entry)+@parameterized.expand([("signal_channel_finding", {"emitted_count": 2}, True),diff --git a/products/signals/backend/test/test_scout_status.py b/products/signals/backend/test/test_scout_status.pynew file mode 100644index 000000000000..8f3d55e04055--- /dev/null+++ b/products/signals/backend/test/test_scout_status.py@@ -0,0 +1,276 @@+from freezegun import freeze_time+from posthog.test.base import BaseTest+from unittest.mock import patch++from django.utils import timezone++from parameterized import parameterized++from products.signals.backend.models import SignalScoutConfig+from products.signals.backend.scout_harness.serializers import SignalScoutConfigUpdateSerializer++Status = SignalScoutConfig.Status+Reason = SignalScoutConfig.PauseReason+++class TestScoutStatusTransitions(BaseTest):+ def _config(+ self,+ status: SignalScoutConfig.Status = Status.ACTIVE,+ pause_reason: SignalScoutConfig.PauseReason | None = None,+ ) -> SignalScoutConfig:+ return SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ enabled=status in SignalScoutConfig.RUNNABLE_STATUSES,+ status=status,+ pause_reason=pause_reason,+ )++ @parameterized.expand(+ [+ ("warn_active_scout", Status.ACTIVE, None, Status.PENDING_PAUSE, Reason.NO_OUTPUT, True),+ ("pause_active_scout", Status.ACTIVE, None, Status.PAUSED_BY_SYSTEM, Reason.NO_OUTPUT, True),+ (+ "owner_escalates_warning",+ Status.PENDING_PAUSE,+ Reason.NO_OUTPUT,+ Status.PAUSED_BY_SYSTEM,+ Reason.NO_OUTPUT,+ True,+ ),+ (+ "owner_resumes_own_pause",+ Status.PAUSED_BY_SYSTEM,+ Reason.REPEATED_FAILURES,+ Status.ACTIVE,+ Reason.REPEATED_FAILURES,+ True,+ ),+ (+ "other_writer_cannot_escalate",+ Status.PENDING_PAUSE,+ Reason.NO_OUTPUT,+ Status.PAUSED_BY_SYSTEM,+ Reason.REPEATED_FAILURES,+ False,+ ),+ (+ "other_writer_cannot_overwrite_pause",+ Status.PAUSED_BY_SYSTEM,+ Reason.NO_OUTPUT,+ Status.PAUSED_BY_SYSTEM,+ Reason.IGNORED,+ False,+ ),+ (+ "other_writer_cannot_resume",+ Status.PAUSED_BY_SYSTEM,+ Reason.NO_OUTPUT,+ Status.ACTIVE,+ Reason.REPEATED_FAILURES,+ False,+ ),+ (+ "user_pause_blocks_system_pause",+ Status.PAUSED_BY_USER,+ None,+ Status.PAUSED_BY_SYSTEM,+ Reason.NO_OUTPUT,+ False,+ ),+ ("user_pause_blocks_system_resume", Status.PAUSED_BY_USER, None, Status.ACTIVE, Reason.NO_OUTPUT, False),+ (+ "pause_not_downgraded_to_warning",+ Status.PAUSED_BY_SYSTEM,+ Reason.NO_OUTPUT,+ Status.PENDING_PAUSE,+ Reason.NO_OUTPUT,+ False,+ ),+ (+ "same_state_is_a_noop",+ Status.PENDING_PAUSE,+ Reason.NO_OUTPUT,+ Status.PENDING_PAUSE,+ Reason.NO_OUTPUT,+ False,+ ),+ ]+ )+ def test_system_transition_ownership_rule(+ self,+ _name: str,+ start_status: SignalScoutConfig.Status,+ start_reason: SignalScoutConfig.PauseReason | None,+ new_status: SignalScoutConfig.Status,+ writer_reason: SignalScoutConfig.PauseReason,+ expect_applied: bool,+ ) -> None:+ config = self._config(status=start_status, pause_reason=start_reason)++ applied = config.transition_status_by_system(new_status, pause_reason=writer_reason)++ assert applied is expect_applied+ config.refresh_from_db()+ if expect_applied:+ assert config.status == new_status+ assert config.pause_reason == (None if new_status == Status.ACTIVE else writer_reason)+ assert config.enabled is (new_status in SignalScoutConfig.RUNNABLE_STATUSES)+ assert config.status_changed_at is not None+ else:+ assert config.status == start_status+ assert config.pause_reason == start_reason+ assert config.status_changed_at is None++ def test_system_writer_may_never_set_paused_by_user(self) -> None:+ config = self._config()+ with self.assertRaises(ValueError):+ config.transition_status_by_system(Status.PAUSED_BY_USER, pause_reason=Reason.NO_OUTPUT)++ def test_stale_system_decision_refused_after_a_newer_status_change(self) -> None:+ # A sweep evaluates, then a human moves the status before the sweep's write lands:+ # the write carries the evaluation time and must lose to the newer human change.+ config = self._config(status=Status.PENDING_PAUSE, pause_reason=Reason.NO_OUTPUT)+ evaluation_time = timezone.now()+ config.status = Status.ACTIVE+ config.pause_reason = None+ config.status_changed_at = timezone.now()+ config.status_changed_by = self.user+ config.save()++ applied = config.transition_status_by_system(+ Status.PAUSED_BY_SYSTEM, pause_reason=Reason.NO_OUTPUT, evaluated_at=evaluation_time+ )++ assert applied is False+ config.refresh_from_db()+ assert config.status == Status.ACTIVE++ def test_system_resume_refused_when_team_is_at_the_enabled_cap(self) -> None:+ paused = self._config(status=Status.PAUSED_BY_SYSTEM, pause_reason=Reason.REPEATED_FAILURES)+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-other")++ with patch("products.signals.backend.scout_harness.limits.MAX_ENABLED_SCOUTS_PER_TEAM", 1):+ applied = paused.transition_status_by_system(Status.ACTIVE, pause_reason=Reason.REPEATED_FAILURES)++ assert applied is False+ paused.refresh_from_db()+ assert paused.enabled is False++ def test_system_transition_clears_the_human_attribution_stamp(self) -> None:+ # Without the clear, a system pause would keep pointing at whichever human made the+ # previous transition and read as their action.+ config = self._config()+ config.status_changed_by = self.user+ config.save(update_fields=["status_changed_by"])++ config.transition_status_by_system(Status.PAUSED_BY_SYSTEM, pause_reason=Reason.NO_OUTPUT)++ config.refresh_from_db()+ assert config.status_changed_by is None+++class TestScoutStatusEnabledReconciliation(BaseTest):+ def test_create_with_enabled_false_records_a_user_pause(self) -> None:+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", enabled=False)++ assert config.status == Status.PAUSED_BY_USER+ assert config.status_changed_at is None++ def test_enabled_only_save_derives_status(self) -> None:+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")++ config.enabled = False+ config.save(update_fields=["enabled"])++ config.refresh_from_db()+ assert config.status == Status.PAUSED_BY_USER+ assert config.status_changed_at is not None++ def test_enabled_only_save_resumes_a_system_pause(self) -> None:+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ enabled=False,+ status=Status.PAUSED_BY_SYSTEM,+ pause_reason=Reason.NO_OUTPUT,+ )++ config.enabled = True+ config.save(update_fields=["enabled"])++ config.refresh_from_db()+ assert config.status == Status.ACTIVE+ assert config.pause_reason is None++ def test_create_with_explicit_status_derives_enabled(self) -> None:+ config = SignalScoutConfig.objects.create(+ team=self.team,+ skill_name="signals-scout-foo",+ status=Status.PAUSED_BY_SYSTEM,+ pause_reason=Reason.NO_OUTPUT,+ )++ assert config.enabled is False+ assert config.status == Status.PAUSED_BY_SYSTEM++ def test_status_named_alone_in_update_fields_derives_enabled(self) -> None:+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")++ config.status = Status.PAUSED_BY_SYSTEM+ config.pause_reason = Reason.NO_OUTPUT+ config.save(update_fields=["status", "pause_reason"])++ config.refresh_from_db()+ assert config.enabled is False+++class TestScoutColdStartGrace(BaseTest):+ def test_grace_follows_creation_then_expires(self) -> None:+ with freeze_time("2026-07-01T00:00:00Z"):+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")+ with freeze_time("2026-07-10T00:00:00Z"):+ assert config.in_cold_start_grace() is True+ with freeze_time("2026-07-16T00:00:00Z"):+ assert config.in_cold_start_grace() is False++ def test_human_reactivation_grants_a_fresh_window(self) -> None:+ with freeze_time("2026-06-01T00:00:00Z"):+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", enabled=False)+ with freeze_time("2026-07-15T00:00:00Z"):+ serializer = SignalScoutConfigUpdateSerializer(+ config, data={"enabled": True}, partial=True, context={"request": self._request_stub()}+ )+ assert serializer.is_valid()+ config = serializer.save()+ with freeze_time("2026-07-20T00:00:00Z"):+ assert config.in_cold_start_grace() is True++ def test_any_reactivation_grants_a_fresh_window(self) -> None:+ # Deliberately independent of attribution, so the window survives the re-enabling+ # user's account being deleted (the FK is SET_NULL).+ with freeze_time("2026-06-01T00:00:00Z"):+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", enabled=False)+ with freeze_time("2026-07-15T00:00:00Z"):+ config.enabled = True+ config.save(update_fields=["enabled"])+ with freeze_time("2026-07-20T00:00:00Z"):+ assert config.in_cold_start_grace() is True++ def test_a_system_transition_does_not_re_anchor(self) -> None:+ # A sweep's own pending_pause warning re-anchoring grace would put the scout back+ # under protection and the sweep could never pause anything.+ with freeze_time("2026-06-01T00:00:00Z"):+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")+ with freeze_time("2026-07-15T00:00:00Z"):+ config.transition_status_by_system(Status.PENDING_PAUSE, pause_reason=Reason.NO_OUTPUT)+ with freeze_time("2026-07-20T00:00:00Z"):+ assert config.in_cold_start_grace() is False++ def _request_stub(self):+ class _Request:+ def __init__(self, user):+ self.user = user++ return _Request(self.user)diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex c69090b34b0c..1bfd4f6b6439 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -1754,6 +1754,35 @@ export const ScoutOriginEnumApi = {Custom: 'custom',} as const+/**+ * * `active` - Active+ * * `pending_pause` - Pending pause+ * * `paused_by_system` - Paused by system+ * * `paused_by_user` - Paused by user+ */+export type ScoutConfigStatusEnumApi = (typeof ScoutConfigStatusEnumApi)[keyof typeof ScoutConfigStatusEnumApi]++export const ScoutConfigStatusEnumApi = {+ Active: 'active',+ PendingPause: 'pending_pause',+ PausedBySystem: 'paused_by_system',+ PausedByUser: 'paused_by_user',+} as const++/**+ * * `no_output` - No output+ * * `ignored` - Ignored+ * * `repeated_failures` - Repeated failures+ */+export type ScoutConfigPauseReasonEnumApi =+ (typeof ScoutConfigPauseReasonEnumApi)[keyof typeof ScoutConfigPauseReasonEnumApi]++export const ScoutConfigPauseReasonEnumApi = {+ NoOutput: 'no_output',+ Ignored: 'ignored',+ RepeatedFailures: 'repeated_failures',+} as const+/*** Read shape for a per-(team, skill) scout config.*@@ -1768,8 +1797,21 @@ export interface SignalScoutConfigApi {readonly description: string/** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */readonly scout_origin: ScoutOriginEnumApi- /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */+ /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Derived from `status`: true for `active` and `pending_pause`, false for the paused statuses. */readonly enabled: boolean+ /** Lifecycle status. `active`: runs on its schedule. `pending_pause`: still running, but flagged by the system to pause soon unless something changes (any config edit clears it). `paused_by_system`: paused automatically, see `pause_reason`; set `enabled=true` to resume. `paused_by_user`: switched off by a person and never resumed automatically.+ *+ * * `active` - Active+ * * `pending_pause` - Pending pause+ * * `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`.+ *+ * * `no_output` - No output+ * * `ignored` - Ignored+ * * `repeated_failures` - Repeated failures */+ readonly pause_reason: ScoutConfigPauseReasonEnumApi | null/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */readonly emit: boolean/**@@ -1836,7 +1878,7 @@ export interface SignalScoutConfigCreateApi {* Editable schedule, enablement, and emit posture for one scout config.*/export interface PatchedSignalScoutConfigUpdateApi {- /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */+ /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched. */enabled?: boolean/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */emit?: boolean@@ -2116,10 +2158,15 @@ export interface ScoutFleetEntryApi {*/last_emitted_at: string | null/**- * Why this scout is in the `disabled` bucket: `turned_off` (an operator set it off) or `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so it never dispatches). Null for scouts that actually run.+ * Why this scout is in the `disabled` bucket: `turned_off` (a person or seed posture set it off), `auto_paused` (the system paused it), or `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so it never dispatches). Null for scouts that actually run.* @nullable*/not_running_reason: string | null+ /**+ * The cause behind an `auto_paused` entry: `no_output`, `ignored`, or `repeated_failures`. Null for every other entry.+ * @nullable+ */+ pause_reason: string | null}/**diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 1f3c9e81f4d6..b44a2ca12613 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -433,7 +433,9 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zodenabled: zod.boolean().optional()- .describe('Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.'),+ .describe(+ 'Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched.'+ ),emit: zod.boolean().optional()diff --git a/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md b/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.mdindex fbb82a1cee6f..f2d48adc3c82 100644--- a/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md+++ b/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md@@ -21,6 +21,8 @@ How scouts get discovered, scheduled, and dispatched; the two distribution pathsThe body is the system prompt; the agent orients, explores, files reports or remembers, and writes a one-paragraph summary to the run row.Pausing a scout = `enabled=false`.+That records `status=paused_by_user`, which automatic lifecycle sweeps never resume or re-pause; `enabled=true` resumes from any pause, including a system-applied one (`status=paused_by_system`, cause in the read-only `pause_reason`).+Config responses expose `status` and `pause_reason` read-only; writes flow through `enabled`.Slowing it = a larger `run_interval_minutes`.Dry-running it = `emit=false`.All three via `posthog:scout-config-update` (get the `id` from `-config-list`), or set at creation time in the nested `config` object passed to `posthog:scout-create-prepare`.diff --git a/products/signals/skills/exploring-scouts/SKILL.md b/products/signals/skills/exploring-scouts/SKILL.mdindex ebf038d82fe3..c4c3506aac51 100644--- a/products/signals/skills/exploring-scouts/SKILL.md+++ b/products/signals/skills/exploring-scouts/SKILL.md@@ -35,14 +35,14 @@ For "what kind of run was this?" questions — did it author a self-improvementThere are six things you can observe about the fleet, each with its own tool:-| What you want to know | Tool | What it tells you |-| -------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------- |-| Which scouts run, how often, in what posture | `scout-config-list` | One row per scout: schedule, `enabled`, `emit`, `last_run_at`, `description` |-| What the scouts actually did, run by run | `scout-runs-list` / `-retrieve` | Per-run status, timing, end-of-run summary, `emitted_report_ids` / `edited_report_ids`, deep-link |-| What the fleet has learned across runs | `scout-scratchpad-search` | Durable per-team memory (baselines, noise, allowlists) |-| What the team has told the fleet | `scout-notes-list` | Steering notes humans/agents left for scouts (per-scout or fleet-wide, newest first) |-| Which reports a run wrote or edited | the run row itself | `emitted_report_ids` / `edited_report_ids` — resolve each id via `inbox-reports-retrieve` |-| What the scouts surfaced to the user | `inbox-reports-list` | The scout-written reports, as the user sees them (filter `source_product: "signals_scout"`) |+| What you want to know | Tool | What it tells you |+| -------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------- |+| Which scouts run, how often, in what posture | `scout-config-list` | One row per scout: schedule, `enabled`, `status` / `pause_reason`, `emit`, `last_run_at`, `description` |+| What the scouts actually did, run by run | `scout-runs-list` / `-retrieve` | Per-run status, timing, end-of-run summary, `emitted_report_ids` / `edited_report_ids`, deep-link |+| What the fleet has learned across runs | `scout-scratchpad-search` | Durable per-team memory (baselines, noise, allowlists) |+| What the team has told the fleet | `scout-notes-list` | Steering notes humans/agents left for scouts (per-scout or fleet-wide, newest first) |+| Which reports a run wrote or edited | the run row itself | `emitted_report_ids` / `edited_report_ids` — resolve each id via `inbox-reports-retrieve` |+| What the scouts surfaced to the user | `inbox-reports-list` | The scout-written reports, as the user sees them (filter `source_product: "signals_scout"`) |The orienting tool is `scout-project-profile-get` — the deterministic snapshot of "what's true about this project" that every scout cold-starts from.When a scout found nothing, this is usually why.@@ -80,9 +80,11 @@ Read the result against three cases:Point the user at the Signals scout settings / PostHog Desktop onboarding rather than inventing activity.- **Configs exist but all `enabled: false`** — the fleet is registered but paused.Nothing is running.- Tell the user which scouts exist and that they're all off.+ Tell the user which scouts exist and that they're all off — and say who switched each one off, which `status` carries: `paused_by_user` means a person (or a launch seed posture) turned it off, `paused_by_system` means an automatic pause with its cause in `pause_reason` (`no_output` / `ignored` / `repeated_failures`).+ Either kind resumes with `enabled: true` via `scout-config-update`.- **At least one `enabled: true`** — the fleet is registered and that scout is allowed to run.For each enabled scout note its `run_interval_minutes` (cadence), `emit` (false = **dry-run**, runs but writes nothing to the inbox), and `last_run_at`.+ A `status` of `pending_pause` means the scout still runs but the system has flagged it to pause soon (cause in `pause_reason`); any config edit clears the warning.One caveat before reporting "it's live": runs are gated by the `signals-scout` feature flag, not by `enabled`.A project that was enrolled and later drained from the flag keeps its `enabled: true` rows, but the coordinator no longer plans runs for it — so a stale or `null` `last_run_at` on an enabled scout usually means the project is no longer enrolled, not that the scout is idle.diff --git a/products/signals/skills/exploring-scouts/references/scout-data-model.md b/products/signals/skills/exploring-scouts/references/scout-data-model.mdindex dc31d4e80a5b..1ec9010f3f84 100644--- a/products/signals/skills/exploring-scouts/references/scout-data-model.md+++ b/products/signals/skills/exploring-scouts/references/scout-data-model.md@@ -9,14 +9,16 @@ One row per `(team, skill_name)`.Returned by `scout-config-list`.This is the scout's control surface, separate from its instruction body (the `LLMSkill`).-| Field | Meaning |-| ---------------------- | --------------------------------------------------------------------------------------------- |-| `id` | Config id — the handle `scout-config-update` takes to tune it. |-| `skill_name` | The `signals-scout-*` skill this config controls. Fixed; one config per skill per team. |-| `enabled` | `false` = paused. The coordinator skips disabled scouts entirely. |-| `emit` | `false` = **dry-run**: the scout runs and reasons every tick but writes nothing to the inbox. |-| `run_interval_minutes` | Cadence, 30–43200. Default 1440 (daily). The coordinator dispatches when due. |-| `last_run_at` | When it last fired. `null` = never run. Drives the due-check. |+| Field | Meaning |+| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `id` | Config id — the handle `scout-config-update` takes to tune it. |+| `skill_name` | The `signals-scout-*` skill this config controls. Fixed; one config per skill per team. |+| `enabled` | `false` = paused. The coordinator skips disabled scouts entirely. Derived from `status`. |+| `status` | Who owns the pause: `active`, `pending_pause` (still runs, flagged to pause soon; any config edit clears it), `paused_by_system` (automatic — resumable with `enabled: true`), `paused_by_user` (a person switched it off; the system never overrides it). |+| `pause_reason` | Why the system paused or warned: `no_output`, `ignored`, or `repeated_failures`. Null outside `pending_pause` / `paused_by_system`. |+| `emit` | `false` = **dry-run**: the scout runs and reasons every tick but writes nothing to the inbox. |+| `run_interval_minutes` | Cadence, 30–43200. Default 1440 (daily). The coordinator dispatches when due. |+| `last_run_at` | When it last fired. `null` = never run. Drives the due-check. |A scout that is `enabled: true, emit: false` is alive and working — it just can't post reports.This is the intended posture for a new or freshly-edited scout, and the most common cause of "my scout does nothing" reports.diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex fe9d3caa340f..5f014d444122 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -53276,7 +53276,7 @@ export namespace Schemas {* Editable schedule, enablement, and emit posture for one scout config.*/export interface PatchedSignalScoutConfigUpdate {- /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */+ /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched. */enabled?: boolean;/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */emit?: boolean;@@ -56664,10 +56664,15 @@ export namespace Schemas {*/last_emitted_at: string | null;/**- * Why this scout is in the `disabled` bucket: `turned_off` (an operator set it off) or `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so it never dispatches). Null for scouts that actually run.+ * Why this scout is in the `disabled` bucket: `turned_off` (a person or seed posture set it off), `auto_paused` (the system paused it), or `skill_unavailable` (left on, but its skill was deleted, superseded, or withheld, so it never dispatches). Null for scouts that actually run.* @nullable*/not_running_reason: string | null;+ /**+ * The cause behind an `auto_paused` entry: `no_output`, `ignored`, or `repeated_failures`. Null for every other entry.+ * @nullable+ */+ pause_reason: string | null;}/**@@ -62054,6 +62059,36 @@ export namespace Schemas {base_version?: number;}+ /**+ * * `no_output` - No output+ * * `ignored` - Ignored+ * * `repeated_failures` - Repeated failures+ */+ export type ScoutConfigPauseReasonEnum = typeof ScoutConfigPauseReasonEnum[keyof typeof ScoutConfigPauseReasonEnum];+++ export const ScoutConfigPauseReasonEnum = {+ NoOutput: 'no_output',+ Ignored: 'ignored',+ RepeatedFailures: 'repeated_failures',+ } as const;++ /**+ * * `active` - Active+ * * `pending_pause` - Pending pause+ * * `paused_by_system` - Paused by system+ * * `paused_by_user` - Paused by user+ */+ export type ScoutConfigStatusEnum = typeof ScoutConfigStatusEnum[keyof typeof ScoutConfigStatusEnum];+++ export const ScoutConfigStatusEnum = {+ Active: 'active',+ PendingPause: 'pending_pause',+ PausedBySystem: 'paused_by_system',+ PausedByUser: 'paused_by_user',+ } as const;+/*** One finding the run emitted, paired with the inbox report (if any) its signal grouped into.*@@ -62768,8 +62803,21 @@ export namespace Schemas {readonly description: string;/** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */readonly scout_origin: ScoutOriginEnum;- /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */+ /** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Derived from `status`: true for `active` and `pending_pause`, false for the paused statuses. */readonly enabled: boolean;+ /** Lifecycle status. `active`: runs on its schedule. `pending_pause`: still running, but flagged by the system to pause soon unless something changes (any config edit clears it). `paused_by_system`: paused automatically, see `pause_reason`; set `enabled=true` to resume. `paused_by_user`: switched off by a person and never resumed automatically.+ *+ * * `active` - Active+ * * `pending_pause` - Pending pause+ * * `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`.+ *+ * * `no_output` - No output+ * * `ignored` - Ignored+ * * `repeated_failures` - Repeated failures */+ readonly pause_reason: ScoutConfigPauseReasonEnum | null;/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */readonly emit: boolean;/**diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex f00eb5e65218..fb20eec4b4a9 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -637,7 +637,9 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zodenabled: zod.boolean().optional()- .describe('Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.'),+ .describe(+ 'Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched.'+ ),emit: zod.boolean().optional()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 d6d2ff4512ad..ebd5fc3eadfd 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@@ -6,7 +6,7 @@"type": "boolean"},"enabled": {- "description": "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",+ "description": "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched.","type": "boolean"},"id": {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 d6d2ff4512ad..ebd5fc3eadfd 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@@ -6,7 +6,7 @@"type": "boolean"},"enabled": {- "description": "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",+ "description": "Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. Turning this off records a user pause (`status` becomes `paused_by_user`, which the system never overrides); turning it on resumes the scout from any pause. Only a change of value is a lifecycle action: re-sending the current value leaves the existing status and its ownership untouched.","type": "boolean"},"id": {