: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): default new scout configs to emit-on (#61989)
Andrew Maguire9fb163da9ee8
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.mdindex bc655ece558a..0840f3595b0e 100644--- a/products/signals/ARCHITECTURE.md+++ b/products/signals/ARCHITECTURE.md@@ -492,16 +492,16 @@ Per-team configuration for which signal sources are enabled.Per-scout binding for the headless **Signals agent**: one row per `(team, skill_name)`. The coordinator auto-creates a row when it discovers a `signals-scout-*` skill on a participating team. Changes are activity-logged (they drive spend); team-level participation is gated by the `signals-scout` flag at the coordinator, not here. See `backend/scout_harness/AGENTS.md` for the harness internals.-| Field | Type | Description |-| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| `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. |-| `emit` | Boolean | Dry-run vs emit. Defaults `False`: the scout runs and logs but `emit_finding` writes nothing — lets a scout be validated on a team before its findings reach the inbox. |-| `run_interval_minutes` | PositiveSmallInt | Minutes between runs. The coordinator dispatches when `last_run_at is None or now - last_run_at >= run_interval_minutes`. Default `60` (hourly). Validated `10 <= N <= 43200`. |-| `last_run_at` | DateTime (nullable) | Stamped after each dispatch; drives the due-check. Excluded from activity logging (written every run). |-| `created_by` | FK → User (nullable) | Audit pointer |-| `enabled_by` | FK → User (nullable) | Who last flipped `enabled` — tracked because enablement drives spend. |+| Field | Type | Description |+| ---------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `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. |+| `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` | PositiveSmallInt | Minutes between runs. The coordinator dispatches when `last_run_at is None or now - last_run_at >= run_interval_minutes`. Default `60` (hourly). Validated `10 <= N <= 43200`. |+| `last_run_at` | DateTime (nullable) | Stamped after each dispatch; drives the due-check. Excluded from activity logging (written every run). |+| `created_by` | FK → User (nullable) | Audit pointer |+| `enabled_by` | FK → User (nullable) | Who last flipped `enabled` — tracked because enablement drives spend. |### `SignalScoutRun`@@ -1052,20 +1052,20 @@ Signal {index}:## Key Configuration-| Setting | Default | Description |-| ---------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------ |-| `SIGNAL_WEIGHT_THRESHOLD` | `1.0` | Total weight needed to promote a report to candidate |-| `SIGNAL_MATCHING_LLM_MODEL` | `claude-sonnet-4-5` | LLM model for all signal operations |-| `MAX_RESPONSE_TOKENS` | `4096` | Base max tokens for LLM responses (thinking uses 3× for max_tokens, 2× for budget) |-| Embedding model | `text-embedding-3-small-1536` | OpenAI embedding model used for signal content |-| Task queue | `VIDEO_EXPORT_TASK_QUEUE` | Temporal task queue for all workflows |-| `BUFFER_MAX_SIZE` | `20` | Max signals buffered in memory before flush to S3 |-| `BUFFER_FLUSH_TIMEOUT_SECONDS` | `5` | Max seconds to wait for buffer to fill before flushing |-| S3 prefix | `signals/signal_batches/` | Object storage path for signal batch files (cleaned up by S3 lifecycle policies) |-| `COORDINATOR_INTERVAL_MINUTES` | `30` | Signals agent coordinator poll cadence (Temporal schedule, `SKIP` overlap policy) |-| `MAX_RUNS_PER_TICK` | `50` | Hard cap on planned runs per coordinator tick (most-overdue-first, truncated after sort) |-| `SignalScoutConfig.run_interval_minutes` | `60` | Per-scout default schedule in minutes (hourly); due-check, no sampling (`10`–`43200`) |-| `SignalScoutConfig.emit` | `False` | Per-scout dry-run gate — scout runs and logs, but `emit_finding` writes nothing until flipped on |+| Setting | Default | Description |+| ---------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |+| `SIGNAL_WEIGHT_THRESHOLD` | `1.0` | Total weight needed to promote a report to candidate |+| `SIGNAL_MATCHING_LLM_MODEL` | `claude-sonnet-4-5` | LLM model for all signal operations |+| `MAX_RESPONSE_TOKENS` | `4096` | Base max tokens for LLM responses (thinking uses 3× for max_tokens, 2× for budget) |+| Embedding model | `text-embedding-3-small-1536` | OpenAI embedding model used for signal content |+| Task queue | `VIDEO_EXPORT_TASK_QUEUE` | Temporal task queue for all workflows |+| `BUFFER_MAX_SIZE` | `20` | Max signals buffered in memory before flush to S3 |+| `BUFFER_FLUSH_TIMEOUT_SECONDS` | `5` | Max seconds to wait for buffer to fill before flushing |+| S3 prefix | `signals/signal_batches/` | Object storage path for signal batch files (cleaned up by S3 lifecycle policies) |+| `COORDINATOR_INTERVAL_MINUTES` | `30` | Signals agent coordinator poll cadence (Temporal schedule, `SKIP` overlap policy) |+| `MAX_RUNS_PER_TICK` | `50` | Hard cap on planned runs per coordinator tick (most-overdue-first, truncated after sort) |+| `SignalScoutConfig.run_interval_minutes` | `60` | Per-scout default schedule in minutes (hourly); due-check, no sampling (`10`–`43200`) |+| `SignalScoutConfig.emit` | `True` | Per-scout emit gate — defaults emit-on; flip to `False` for dry-run (scout runs and logs, but `emit_finding` writes nothing) |---diff --git a/products/signals/backend/migrations/0031_alter_signalscoutconfig_emit.py b/products/signals/backend/migrations/0031_alter_signalscoutconfig_emit.pynew file mode 100644index 000000000000..0058bc25b6cb--- /dev/null+++ b/products/signals/backend/migrations/0031_alter_signalscoutconfig_emit.py@@ -0,0 +1,17 @@+# Generated by Django 5.2.14 on 2026-06-06 17:22++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0030_alter_signalscoutconfig_run_interval_minutes"),+ ]++ operations = [+ migrations.AlterField(+ model_name="signalscoutconfig",+ name="emit",+ field=models.BooleanField(db_default=True, default=True),+ ),+ ]diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txtindex 14dead227195..31cb7802993c 100644--- a/products/signals/backend/migrations/max_migration.txt+++ b/products/signals/backend/migrations/max_migration.txt@@ -1 +1 @@-0030_alter_signalscoutconfig_run_interval_minutes+0031_alter_signalscoutconfig_emitdiff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex 46d3f0ede633..dfe66ab2d41f 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -418,9 +418,10 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):# `signals-scout-foo` gets a row (on the default schedule) on the next tick.skill_name = models.CharField(max_length=200)enabled = models.BooleanField(default=True, db_default=True)- # Dry-run vs emit. When False the scout runs and logs but `emit_finding` writes- # nothing — lets a scout be validated on a team before its findings reach the inbox.- emit = models.BooleanField(default=False, db_default=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.+ emit = models.BooleanField(default=True, db_default=True)# Minutes between runs. The coordinator dispatches this scout when# `last_run_at is None or now - last_run_at >= run_interval_minutes`. Deterministic —# no sampling. Floor of 10 keeps one scout from monopolising the worker pool; defaultdiff --git a/products/signals/backend/scout_harness/tools/emit.py b/products/signals/backend/scout_harness/tools/emit.pyindex c1e41a68ca54..66b867c2a16e 100644--- a/products/signals/backend/scout_harness/tools/emit.py+++ b/products/signals/backend/scout_harness/tools/emit.py@@ -64,7 +64,7 @@ class EmitResult:Possible `skipped_reason` values:- None: emit fired- - "scout_config_missing": no SignalScoutConfig row for this (team, skill) — fail closed+ - "scout_config_missing": the run's dispatch-time config FK is null/gone — fail closed- "scout_emit_disabled": the scout's config has emit=False (dry-run)- "ai_processing_not_approved": team's organization has not approved AI processing- "source_disabled": SignalSourceConfig disables the signals_scout source for this team@@ -347,11 +347,20 @@ def _preflight_emit_gates(team: Team, run: SignalScoutRun) -> str | None:instead of "emitted" for an emit the pipeline silently dropped. The per-scout`emit` toggle is checked first: a dry-run scout runs and logs but emits nothing.- Fails closed when no config row exists: `SignalScoutRun.scout_config` is nullable and a- config can be deleted mid-run, but a recreated config defaults to dry-run (`emit=False`),- so a missing config must not be treated as "emit allowed".+ Anchored on the run's own config FK, re-read live from the DB (not the in-memory `run`,+ which may be stale, and not re-resolved by `skill_name`). `scout_config` is `SET_NULL`,+ so if the config the run was dispatched with is deleted mid-run the FK goes NULL and we+ fail closed — even if a same-`(team, skill_name)` config was recreated in the meantime. A+ stale run must emit only against the config it was dispatched with. This keeps the gate+ fail-closed independent of the `emit` default (now `True`); re-reading the row by pk still+ honors a mid-run `emit` flip on that same config."""- config = SignalScoutConfig.all_teams.filter(team_id=team.id, skill_name=run.skill_name).first()+ config_id = (+ SignalScoutRun.all_teams.filter(pk=run.pk, team_id=team.id).values_list("scout_config_id", flat=True).first()+ )+ if config_id is None:+ return "scout_config_missing"+ config = SignalScoutConfig.all_teams.filter(pk=config_id).first()if config is None:return "scout_config_missing"if not config.emit:diff --git a/products/signals/backend/test/test_scout_coordinator.py b/products/signals/backend/test/test_scout_coordinator.pyindex 91b1877fbf2e..fa59fbf3638f 100644--- a/products/signals/backend/test/test_scout_coordinator.py+++ b/products/signals/backend/test/test_scout_coordinator.py@@ -236,7 +236,7 @@ async def test_authoring_skill_auto_registers_enabled_config_and_runs(ateam):config = await database_sync_to_async(SignalScoutConfig.all_teams.get)(team=ateam, skill_name="signals-scout-foo")assert config.enabled is Trueassert config.run_interval_minutes == 60- assert config.emit is False+ assert config.emit is True# Never-run row is immediately due, so it's dispatched this tick.assert [(p.team_id, p.skill_name) for p in planned] == [(ateam.id, "signals-scout-foo")]diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 778b786be888..72b8f81d992b 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -484,7 +484,7 @@ class TestScoutHarnessConfigAPI(APIBaseTest):body = response.json()assert [c["skill_name"] for c in body] == ["signals-scout-alpha", "signals-scout-beta"]assert body[0]["enabled"] is True- assert body[0]["emit"] is False+ assert body[0]["emit"] is Trueassert body[0]["run_interval_minutes"] == 60def test_partial_update_changes_schedule_emit_and_records_enabled_by(self) -> None:diff --git a/products/signals/backend/test/test_scout_harness_tools.py b/products/signals/backend/test/test_scout_harness_tools.pyindex 45e228dadbd1..8f2733fce53c 100644--- a/products/signals/backend/test/test_scout_harness_tools.py+++ b/products/signals/backend/test/test_scout_harness_tools.py@@ -636,8 +636,8 @@ async def test_emit_finding_returns_skipped_when_scout_emit_disabled(arun_emit,@pytest.mark.asyncio@pytest.mark.django_dbasync def test_emit_finding_fails_closed_when_config_missing(arun_emit, ateam_emit):- # scout_config is nullable and a config can be deleted mid-run; a missing config must- # NOT emit (a recreated config defaults to dry-run), so it fails closed.+ # scout_config is SET_NULL: deleting the config mid-run nulls the run's FK, so the gate+ # has no live config to emit against and fails closed.await database_sync_to_async(SignalScoutConfig.all_teams.filter(team=ateam_emit, skill_name=arun_emit.skill_name).delete)()@@ -658,6 +658,36 @@ async def test_emit_finding_fails_closed_when_config_missing(arun_emit, ateam_emmock_emit.assert_not_called()+async def test_emit_finding_fails_closed_when_config_deleted_then_recreated(arun_emit, ateam_emit):+ # The config the run was dispatched with is deleted (SET_NULL nulls the run's FK) and a+ # fresh emit-on config for the same (team, skill) is recreated before emit. The gate is+ # anchored on the run's own (now-null) FK, not re-resolved by skill_name, so the stale run+ # still fails closed — independent of the emit default now being True.+ await database_sync_to_async(+ SignalScoutConfig.all_teams.filter(team=ateam_emit, skill_name=arun_emit.skill_name).delete+ )()+ await database_sync_to_async(SignalScoutConfig.all_teams.create)(+ team=ateam_emit, skill_name=arun_emit.skill_name, emit=True+ )++ with patch("products.signals.backend.facade.api.emit_signal", new=AsyncMock()) as mock_emit:+ result = await emit_finding(+ team=ateam_emit,+ run=arun_emit,+ description="d",+ weight=0.5,+ confidence=0.5,+ evidence=[EvidenceEntry(source_product="logs", summary="x")],+ finding_id="f-recreated-config",+ )++ assert result.emitted is False+ assert result.skipped_reason == "scout_config_missing"+ mock_emit.assert_not_called()++# --- emit_finding (team, run) ownership guard tests ---diff --git a/products/signals/backend/test/test_signal_scout_models.py b/products/signals/backend/test/test_signal_scout_models.pyindex 8371449fab68..afe181e08156 100644--- a/products/signals/backend/test/test_signal_scout_models.py+++ b/products/signals/backend/test/test_signal_scout_models.py@@ -59,9 +59,9 @@ class TestSignalScoutModels(_ScoutTeamScopedTestMixin, BaseTest):def test_signal_scout_config_defaults(self) -> None:config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")loaded = SignalScoutConfig.objects.get(pk=config.pk)- # Auto-created scouts run on an hourly cadence but stay in dry-run until emit is flipped.+ # Auto-created scouts run on an hourly cadence and emit on by default (live from the first tick).assert loaded.enabled is True- assert loaded.emit is False+ assert loaded.emit is Trueassert loaded.run_interval_minutes == 60assert loaded.last_run_at is None