: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
fix(signals): cover paused scouts in the per-scout runs read (#103829)
posthog[bot]9bd3e6208804
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex 1c3a1a5f98ec..c154595bd943 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -2080,6 +2080,8 @@ export interface SignalScoutConfigApi {* @nullable*/readonly status_changed_at: string | null+ /** Who last moved `status`, when a person did it through this API. Null for a system transition such as an automatic pause, for a row whose status never changed, and for a caller that may not read member identities. Pair it with `status` to say who turned a scout off, instead of only when it went off. */+ readonly status_changed_by: UserBasicApi | null/** Whether this scout is exempt from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. Only ever set explicitly: re-enabling a swept scout instead grants a fresh grace window before the sweep may judge it again. */readonly auto_pause_exempt: boolean/** Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter. */diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex 200ebdeff070..02ecfd431173 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -3296,6 +3296,14 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):"about once a day; a successful retry resumes it, and so does setting `enabled=true`."),)+ status_changed_by = serializers.SerializerMethodField(+ help_text=(+ "Who last moved `status`, when a person did it through this API. Null for a system "+ "transition such as an automatic pause, for a row whose status never changed, and for "+ "a caller that may not read member identities. Pair it with `status` to say who turned "+ "a scout off, instead of only when it went off."+ ),+ )status_changed_at = serializers.DateTimeField(read_only=True,allow_null=True,@@ -3363,6 +3371,15 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):info = (self.context.get("skill_info") or {}).get(obj.skill_name)return info.role if info else "specialist"+ @extend_schema_field(UserBasicSerializer(allow_null=True))+ def get_status_changed_by(self, obj: SignalScoutConfig) -> dict[str, Any] | None:+ # Member PII, so it rides the same gate `owners` does: a scout sandbox token reads the+ # roster through `scout-members-list`, and never learns who switched a scout off here.+ if not self.context.get("may_read_member_identities", False):+ return None+ actor = obj.status_changed_by+ return dict(UserBasicSerializer(actor).data) if actor else None+@extend_schema_field(UserBasicSerializer(many=True))def get_owners(self, obj: SignalScoutConfig) -> list[dict[str, Any]]:# A scout joins to its skill by name, which is also the key `LLMSkillOwner` uses, so the@@ -3398,6 +3415,7 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):"last_run_at","consecutive_failure_count","status_changed_at",+ "status_changed_by","auto_pause_exempt","tags","source_product",diff --git a/products/signals/backend/scout_harness/tools/runs.py b/products/signals/backend/scout_harness/tools/runs.pyindex f498e3461695..55bf0b3e7e24 100644--- a/products/signals/backend/scout_harness/tools/runs.py+++ b/products/signals/backend/scout_harness/tools/runs.py@@ -60,10 +60,21 @@ STALENESS_INTERVAL_MULTIPLE = 3# monthly cron reads as ~31 days, a weekday-only one as the weekend gap.CRON_GAP_SAMPLES = 4-# Bounds the fan-out of the per-scout probe. Deliberately a limit on *scouts* rather than on rows:-# capping rows after the per-scout ranking would drop the slowest scouts' history, which is the-# exact crowd-out this query exists to remove. A scout that makes the cut gets its full history.-MAX_SCOUTS_PER_RUNS_QUERY = MAX_ENABLED_SCOUTS_PER_TEAM+# Runaway guard on the fan-out of the per-scout probe. Deliberately a limit on *scouts* rather than+# on rows: capping rows after the per-scout ranking would drop the slowest scouts' history, which is+# the exact crowd-out this query exists to remove. A scout that makes the cut gets its full history.+#+# Sized well past `MAX_ENABLED_SCOUTS_PER_TEAM` rather than equal to it, because the probe covers+# paused configs too — the roster renders a paused scout's history like any other. An enabled-sized+# bound dropped a large project's paused scouts in alphabetical order, so their cards read "No runs+# yet" beside a cost line proving they had run. Rows stay bounded by the enabled cap in practice:+# only an enabled scout produces new runs, and a paused scout's last ones age out of the staleness+# guard.+MAX_SCOUTS_PER_RUNS_QUERY = 10 * MAX_ENABLED_SCOUTS_PER_TEAM++# How many scouts one probe statement covers. A large fleet costs more statements rather than one+# statement whose VALUES list and LATERAL fan-out grow with the bound above.+SCOUTS_PER_RUNS_PROBE = MAX_ENABLED_SCOUTS_PER_TEAM# The "Scout findings" callout summary tallies findings over a fixed lookback window. The default# window, the run cap, and the report cap mirror the cloud/desktop frontend@@ -254,6 +265,47 @@ def _staleness_cutoff(config: SignalScoutConfig, *, now: datetime, floor_days: ireturn now - timedelta(days=lookback_days)+def _probe_run_ids(+ configs: list[SignalScoutConfig],+ *,+ team_id: int,+ per_scout_limit: int,+ now: datetime,+ floor_days: int,+) -> list[Any]:+ """Ids of each given scout's most recent runs, one indexed top-N per scout.++ One probe per scout via LATERAL, each an indexed top-N over+ `(team_id, skill_name, created_at DESC)` — all three keys constrained, so a probe reads+ `per_scout_limit` index entries rather than walking the team's whole run history and+ filtering. The ORM has no LATERAL, and the alternatives are worse: a window function over the+ fleet can't bound its scan, and a query per scout is one round trip per scout on a 60s poll.+ Team scoping is explicit in the predicate, standing in for the fail-closed manager raw SQL+ bypasses; `skill_name` and the cutoffs are bound parameters, never interpolated.+ """+ probe_values = ", ".join(["(%s::text, %s::timestamptz)"] * len(configs))+ params: list[Any] = []+ for config in configs:+ params.extend([config.skill_name, _staleness_cutoff(config, now=now, floor_days=floor_days)])+ params.extend([team_id, per_scout_limit])+ sql = f"""+ SELECT probe.id+ FROM (VALUES {probe_values}) AS scout(skill_name, cutoff)+ CROSS JOIN LATERAL (+ SELECT run.id+ FROM {SignalScoutRun._meta.db_table} run+ WHERE run.team_id = %s+ AND run.skill_name = scout.skill_name+ AND run.created_at >= scout.cutoff+ ORDER BY run.created_at DESC+ LIMIT %s+ ) probe+ """+ with connection.cursor() as cursor:+ cursor.execute(sql, params)+ return [row[0] for row in cursor.fetchall()]++def recent_runs_per_scout(*,team_id: int,@@ -302,34 +354,17 @@ def recent_runs_per_scout(if not configs:return []- # One probe per scout via LATERAL, each an indexed top-N over- # `(team_id, skill_name, created_at DESC)` — all three keys constrained, so a probe reads- # `per_scout_limit` index entries rather than walking the team's whole run history and- # filtering. The ORM has no LATERAL, and the alternatives are worse: a window function over the- # fleet can't bound its scan, and a query per scout is one round trip per scout on a 60s poll.- # Team scoping is explicit in the predicate, standing in for the fail-closed manager raw SQL- # bypasses; `skill_name` and the cutoffs are bound parameters, never interpolated.- probe_values = ", ".join(["(%s::text, %s::timestamptz)"] * len(configs))- params: list[Any] = []- for config in configs:- params.extend([config.skill_name, _staleness_cutoff(config, now=now, floor_days=floor_days)])- params.extend([team_id, per_scout_limit])- sql = f"""- SELECT probe.id- FROM (VALUES {probe_values}) AS scout(skill_name, cutoff)- CROSS JOIN LATERAL (- SELECT run.id- FROM {SignalScoutRun._meta.db_table} run- WHERE run.team_id = %s- AND run.skill_name = scout.skill_name- AND run.created_at >= scout.cutoff- ORDER BY run.created_at DESC- LIMIT %s- ) probe- """- with connection.cursor() as cursor:- cursor.execute(sql, params)- run_ids = [row[0] for row in cursor.fetchall()]+ run_ids: list[Any] = []+ for start in range(0, len(configs), SCOUTS_PER_RUNS_PROBE):+ run_ids.extend(+ _probe_run_ids(+ configs[start : start + SCOUTS_PER_RUNS_PROBE],+ team_id=team_id,+ per_scout_limit=per_scout_limit,+ now=now,+ floor_days=floor_days,+ )+ )if not run_ids:return []diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex 1262ce9ea870..3186bb24350d 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -2801,12 +2801,15 @@ def scout_config_context(team: Team, skill_names: list[str], request: Request) -# `scout-config-list`. The skill API only hands a sandbox caller the owners of a skill that# opted into the report channel (`LLMSkillSerializer.get_owners`); a scout that needs owners# reads them there, and this field stays for the human UI.- if _caller_carries_scout_internal_scope(request):- owners_by_skill_name: dict[str, list[User]] = {}- else:- owners_by_skill_name = resolve_skill_owners_for_names(team, skill_names)+ may_read_member_identities = not _caller_carries_scout_internal_scope(request)+ owners_by_skill_name: dict[str, list[User]] = (+ resolve_skill_owners_for_names(team, skill_names) if may_read_member_identities else {}+ )return {"skill_info": _skill_info_for(team.id, skill_names),+ # Gates `status_changed_by` for the same reason: who turned a scout off is member PII, and+ # a sandbox caller holding `signal_scout:read` has no business reading it here.+ "may_read_member_identities": may_read_member_identities,# Owners are recorded on the scout's skill (`LLMSkillOwner`, keyed on the same# `skill_name`), so they hold across edits to the skill body. `created_by` / `enabled_by`# on the config row say who last flipped a switch, which is a different question.@@ -3028,7 +3031,14 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):# held-back team across the whole config API. Storage is untouched; the row reappears if# the team is later un-withheld.withheld = withheld_skills_for_team(team_id)- queryset = SignalScoutConfig.objects.unscoped().filter(team_id=team_id).exclude(skill_name__in=withheld)+ queryset = (+ SignalScoutConfig.objects.unscoped()+ .filter(team_id=team_id)+ .exclude(skill_name__in=withheld)+ # `status_changed_by` is serialized per row, so without the join the fleet read costs+ # one extra query per scout that a person ever turned on or off.+ .select_related("status_changed_by")+ )# Any-of, matching how the fleet UI's tag picker reads. `&&` over the array column rather# than a join table or a GIN index: the team filter already bounds this to the handful of# scouts an org is allowed to create, so there is nothing left for an index to save.diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 8aca2d055254..fb2bf474b32d 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -2737,6 +2737,33 @@ class TestScoutHarnessConfigAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert response.json()[0]["owners"] == []+ def test_list_says_who_turned_a_scout_off(self) -> None:+ # The roster could only say *when* a scout went off, so a reader had to open the activity+ # log to learn who did it, and a system pause looked like somebody's decision.+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-checkout")+ self.client.patch(+ self._detail_url(str(SignalScoutConfig.objects.get(skill_name="signals-scout-checkout").id)),+ data={"enabled": False},+ format="json",+ )++ response = self.client.get(self._list_url())++ assert response.status_code == status.HTTP_200_OK+ assert response.json()[0]["status_changed_by"]["email"] == self.user.email++ def test_list_hides_who_turned_a_scout_off_from_a_scout_sandbox_token(self) -> None:+ # Same rule as `owners`: the actor is member PII, and the sandbox token carries+ # `signal_scout:read`, so a run must not read it off the fleet's configs.+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-checkout")+ self.client.patch(self._detail_url(str(config.id)), data={"enabled": False}, format="json")+ _authenticate_as_scout(self)++ response = self.client.get(self._list_url())++ assert response.status_code == status.HTTP_200_OK+ assert response.json()[0]["status_changed_by"] is None+def test_list_origin_defaults_to_custom_when_skill_absent(self) -> None:# A config with no live skill row isn't a canonical scout.SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-errors")diff --git a/products/signals/backend/test/test_scout_harness_tools.py b/products/signals/backend/test/test_scout_harness_tools.pyindex b07ff5d6604d..77d9cbf97b04 100644--- a/products/signals/backend/test/test_scout_harness_tools.py+++ b/products/signals/backend/test/test_scout_harness_tools.py@@ -28,6 +28,7 @@ from products.signals.backend.enums import ReportLinkKindfrom products.signals.backend.models import SignalScoutConfig, SignalScoutEmission, SignalScoutRun, SignalScratchpadfrom products.signals.backend.report_charts import MAX_REPORT_CHARTS, ReportChartfrom products.signals.backend.report_prompts import MAX_SUGGESTED_PROMPT_LENGTH, MAX_SUGGESTED_PROMPTS+from products.signals.backend.scout_harness.limits import MAX_ENABLED_SCOUTS_PER_TEAMfrom products.signals.backend.scout_harness.note_targets import (PIPELINE_AUDIENCE_IMPLEMENTATION,PIPELINE_AUDIENCE_REPORT_RESEARCH,@@ -84,6 +85,7 @@ from products.signals.backend.scout_harness.tools.report import (from products.signals.backend.scout_harness.tools.runs import (MAX_FAILURE_REASON_LENGTH,MAX_RUN_SEARCH_LIMIT,+ MAX_SCOUTS_PER_RUNS_QUERY,recent_runs_per_scout,)from products.signals.backend.scout_harness.tools.scratchpad import (@@ -430,6 +432,26 @@ class TestRecentRunsPerScout(BaseTest):assert [hit.run_id for hit in hits] == [str(run.id)]+ def test_the_fleet_bound_is_not_the_enabled_scout_cap(self) -> None:+ # The bug: the bound reused `MAX_ENABLED_SCOUTS_PER_TEAM` while the probe covers every+ # config, paused ones included. Configs sort enabled-first, so a project with more configs+ # than the cap lost its paused scouts' history in alphabetical order — their cards then read+ # "No runs yet" beside a cost line proving they had run.+ assert MAX_SCOUTS_PER_RUNS_QUERY > MAX_ENABLED_SCOUTS_PER_TEAM++ def test_covers_every_scout_past_the_first_probe_statement(self) -> None:+ # The fleet spans several probe statements once it outgrows one, and a paused scout sits in+ # the last of them. Probing only the first would reinstate the same silent history loss.+ self._configure("signals-scout-errors")+ self._configure("signals-scout-surveys", enabled=False)+ enabled_run = self._run_at(skill_name="signals-scout-errors", hours_ago=1)+ paused_run = self._run_at(skill_name="signals-scout-surveys", hours_ago=2)++ with patch("products.signals.backend.scout_harness.tools.runs.SCOUTS_PER_RUNS_PROBE", 1):+ hits = recent_runs_per_scout(team_id=self.team.id)++ assert [hit.run_id for hit in hits] == [str(enabled_run.id), str(paused_run.id)]+def test_ignores_runs_left_behind_by_a_scout_with_no_config(self) -> None:# Runs outlive their config, and the fleet rollups derive success/emit rates from whatever# skill names come back — so a deleted or renamed scout would keep moving the live fleet'sdiff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex bb7f3cee6944..e7bd9bc15610 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3022,6 +3022,8 @@ export interface SignalScoutConfigApi {* @nullable*/readonly status_changed_at: string | null+ /** Who last moved `status`, when a person did it through this API. Null for a system transition such as an automatic pause, for a row whose status never changed, and for a caller that may not read member identities. Pair it with `status` to say who turned a scout off, instead of only when it went off. */+ readonly status_changed_by: UserBasicApi | null/** Whether this scout is exempt from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. Only ever set explicitly: re-enabling a swept scout instead grants a fresh grace window before the sweep may judge it again. */readonly auto_pause_exempt: boolean/** Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter. */diff --git a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts b/products/signals/frontend/inbox/__mocks__/scoutConfigs.tsindex dd8a367ab7b2..d13d83a3e7dc 100644--- a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts+++ b/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts@@ -48,6 +48,7 @@ function makeMockScout(overrides: MockScoutOverrides): SignalScoutConfigApi {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,tags: [],mcp_gateway_server_ids: [],diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsxindex 1c2ff3234c81..daa9adeeda4a 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx@@ -28,6 +28,7 @@ const config: SignalScoutConfigApi = {last_run_at: '2026-07-21T08:00:00Z',consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsxindex 26de5bcd7fb9..a949f78c2b3b 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx@@ -32,6 +32,7 @@ const config: SignalScoutConfigApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsxindex d1c43a1048b8..9f7e006e255d 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx@@ -1,4 +1,5 @@import { useActions, useValues } from 'kea'+import { combineUrl } from 'kea-router'import { useEffect, useRef, useState } from 'react'import { IconArrowLeft, IconExternal, IconRefresh } from '@posthog/icons'@@ -7,10 +8,13 @@ import { LemonButton, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'import { pluralize } from 'lib/utils/strings'import { urls } from 'scenes/urls'+import { ActivityScope } from '~/types'+import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'import { captureScoutAction } from '../../../inboxAnalytics'import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'+import { scoutPausedByLine } from '../../../utils/scoutGroups'import { scoutDisplayName, ScoutRollup } from '../../../utils/scoutRunsWindow'import { ScoutExemptionBadge } from './ScoutBadges'import { ScoutEnabledSwitch } from './ScoutConfigControls'@@ -61,6 +65,29 @@ function ScoutDescription({ text }: { text: string }): JSX.Element {)}+/**+ * Who stopped a scout that is off, and where the rest of the story is. The row records only the+ * last status change, so every earlier toggle is the activity log's to tell.+ */+function ScoutPausedBy({ config }: { config: SignalScoutConfig }): JSX.Element | null {+ const line = scoutPausedByLine(config)+ if (!line) {+ return null+ }+ const activityUrl = combineUrl(urls.advancedActivityLogs(), {+ scopes: ActivityScope.SIGNAL_SCOUT_CONFIG,+ item_ids: config.id,+ }).url+ return (+ <div className="flex flex-wrap items-center gap-1.5 text-xs text-secondary">+ <span>{line}</span>+ <Link to={activityUrl} className="text-xs">+ See every change+ </Link>+ </div>+ )+}+/*** The scout page header: what it is, the controls that act on it, and one health strip that says* whether it is worth keeping on.@@ -148,6 +175,8 @@ export function ScoutDetailHeader({{config.description && <ScoutDescription text={config.description} />}+ <ScoutPausedBy config={config} />+<ScoutHealthStrip config={config} rollup={rollup} noteCount={noteCount} learnedCount={learnedCount} /></div>)diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutHealthStrip.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutHealthStrip.tsxindex f99bb29c359b..349e4de5337d 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutHealthStrip.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutHealthStrip.tsx@@ -10,7 +10,12 @@ import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signalsimport { scoutFleetLogic } from '../../../logics/scoutFleetLogic'import { scoutCostLineParts, scoutCostWindowLabel } from '../../../utils/scoutCosts'import { nextRunAt, SCOUT_GROUP_LABEL, ScoutGroupKey, scoutGroup } from '../../../utils/scoutGroups'-import { filedOrAddedLabel, ScoutRollup, SCOUT_RUNS_PER_SCOUT_LABEL } from '../../../utils/scoutRunsWindow'+import {+ filedOrAddedLabel,+ runStripEmptyLabel,+ ScoutRollup,+ SCOUT_RUNS_PER_SCOUT_LABEL,+} from '../../../utils/scoutRunsWindow'import { ScoutStatusTag } from './ScoutBadges'import { ScoutCadenceLabel } from './ScoutCadenceLabel'import { ScoutNextRunLabel } from './ScoutNextRunLabel'@@ -54,7 +59,7 @@ export function ScoutHealthStrip({noteCount: numberlearnedCount: number}): JSX.Element {- const { scoutRunCosts, scoutCostRollups, expensiveRunCostThreshold, scoutRunsLoadedOnce } =+ const { scoutRunCosts, scoutCostRollups, expensiveRunCostThreshold, scoutRunsLoadedOnce, scoutRunsCoverFleet } =useValues(scoutFleetLogic)const { currentTeam } = useValues(teamLogic)const now = new Date()@@ -111,8 +116,14 @@ export function ScoutHealthStrip({</>) : (// Until the runs request has landed once, an empty rollup means "not loaded",- // not "never ran"; the poll retries a failed load on its own.- <span className="text-muted">{scoutRunsLoadedOnce ? 'No runs yet' : '…'}</span>+ // not "never ran"; the poll retries a failed load on its own. Past the fleet the+ // response covers it means neither, so the strip says so instead of guessing.+ <span className="text-muted">+ {runStripEmptyLabel({+ loadedOnce: scoutRunsLoadedOnce,+ coversFleet: scoutRunsCoverFleet,+ })}+ </span>)}</Segment>diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsxindex 466210da983b..630916292ffe 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx@@ -30,6 +30,7 @@ const config: SignalScoutConfigApi = {last_run_at: '2026-07-21T11:50:00Z',consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsxindex 3abe52e5a766..729979e83a01 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx@@ -9,7 +9,7 @@ import { urls } from 'scenes/urls'import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'import { nextRunAt, SCOUT_GROUP_LABEL, ScoutRosterRow, scoutSubtitle } from '../../../utils/scoutGroups'-import { scoutDisplayName } from '../../../utils/scoutRunsWindow'+import { runStripEmptyLabel, scoutDisplayName } from '../../../utils/scoutRunsWindow'import { inboxCardRowClassName } from '../../cards/inboxCardRowClassName'import { ScoutExemptionBadge, ScoutLifecycleBadge } from './ScoutBadges'import { ScoutCadenceLabel } from './ScoutCadenceLabel'@@ -45,6 +45,7 @@ export const ScoutRosterCard = memo(function ScoutRosterCard({ row }: { row: Scorollups,updatingScoutIds,scoutRunsLoadedOnce,+ scoutRunsCoverFleet,scoutRunCosts,scoutCostRollups,expensiveRunCostThreshold,@@ -112,8 +113,14 @@ export const ScoutRosterCard = memo(function ScoutRosterCard({ row }: { row: Sco<ScoutRunBoxes runs={runs} costs={scoutRunCosts} costThreshold={expensiveRunCostThreshold} />) : (// Until the runs request has landed once, an empty rollup means "not- // loaded", not "never ran"; the poll retries a failed load on its own.- <span className="text-xs text-muted">{scoutRunsLoadedOnce ? 'No runs yet' : '…'}</span>+ // loaded", not "never ran"; the poll retries a failed load on its own. Past+ // the fleet the response covers it means neither, so the card says so.+ <span className="text-xs text-muted">+ {runStripEmptyLabel({+ loadedOnce: scoutRunsLoadedOnce,+ coversFleet: scoutRunsCoverFleet,+ })}+ </span>)}</div><ScoutEnabledSwitchdiff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutRunHistorySection.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutRunHistorySection.tsxindex 1e6db98be652..3faf50d71442 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutRunHistorySection.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutRunHistorySection.tsx@@ -26,6 +26,7 @@ import {scoutRunGroupKey,scoutRunReportLabel,SCOUT_NO_RECENT_RUNS,+ SCOUT_RUN_HISTORY_UNAVAILABLE,SCOUT_RUNS_PER_SCOUT_LABEL,} from '../../../utils/scoutRunsWindow'import { ScoutTimestamp } from './ScoutTimestamp'@@ -425,7 +426,7 @@ export function ScoutRunHistorySection({skillName: stringfilter: ScoutRunFilter}): JSX.Element {- const { scoutRunsLoadedOnce } = useValues(scoutFleetLogic)+ const { scoutRunsLoadedOnce, scoutRunsCoverFleet } = useValues(scoutFleetLogic)const runs = useScoutRuns(skillName)const filteredRuns = useMemo(() => runs.filter((run) => runMatchesFilter(run, filter)), [runs, filter])@@ -446,7 +447,12 @@ export function ScoutRunHistorySection({<div className="rounded border border-dashed border-primary bg-surface-primary px-4 py-6 text-center text-sm text-muted">{runs.length > 0? `No runs match this filter in the ${SCOUT_RUNS_PER_SCOUT_LABEL}.`- : SCOUT_NO_RECENT_RUNS}+ : // Past the fleet the per-scout response covers, this scout was never read, so+ // reporting it as a scout with no recent runs would hide history rather than+ // report it.+ scoutRunsCoverFleet+ ? SCOUT_NO_RECENT_RUNS+ : SCOUT_RUN_HISTORY_UNAVAILABLE}</div>)}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsxindex d3d59536e6f3..c90c531efc3f 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx@@ -32,6 +32,7 @@ const config: SignalScoutConfigApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,tags: ['on-call', 'revenue'],source_product: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsxindex 57b06dc0b295..9fa088136b0d 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx@@ -28,6 +28,7 @@ const CONFIG: SignalScoutConfigApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsxindex 218077b9a6b8..5c6da4bdedb4 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterTable.tsx@@ -9,7 +9,7 @@ import { urls } from 'scenes/urls'import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'import { compareScoutsByName, SCOUT_GROUP_LABEL, SCOUT_GROUP_ORDER, ScoutRosterRow } from '../../../utils/scoutGroups'import { showsScoutOwnership } from '../../../utils/scoutOwners'-import { SCOUT_ROSTER_WINDOW_DAYS } from '../../../utils/scoutRunsWindow'+import { runStripEmptyLabel, SCOUT_ROSTER_WINDOW_DAYS } from '../../../utils/scoutRunsWindow'import { ScoutCadenceLabel } from './ScoutCadenceLabel'import { ScoutEnabledSwitch } from './ScoutConfigControls'import { scoutCostColumns } from './ScoutCostCell'@@ -37,6 +37,7 @@ export function ScoutsRosterTable({ compact }: { compact: boolean }): JSX.Elemenrollups,updatingScoutIds,scoutRunsLoadedOnce,+ scoutRunsCoverFleet,scoutRunCosts,scoutCostRollups,expensiveRunCostThreshold,@@ -165,11 +166,15 @@ export function ScoutsRosterTable({ compact }: { compact: boolean }): JSX.Elemen)}// Until the runs request has landed once, an empty rollup means "not- // loaded", not "never ran"; the poll retries a failed load on its own.- return scoutRunsLoadedOnce ? (- <span className="text-xs text-muted">No runs yet</span>- ) : (- <span className="text-xs text-muted">…</span>+ // loaded", not "never ran"; the poll retries a failed load on its own. Past+ // the fleet the response covers it means neither, so the row says so.+ return (+ <span className="text-xs text-muted">+ {runStripEmptyLabel({+ loadedOnce: scoutRunsLoadedOnce,+ coversFleet: scoutRunsCoverFleet,+ })}+ </span>)},},diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.tsindex d701f0a7ef13..503a8d3d7d1e 100644--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts@@ -55,6 +55,7 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.tsindex aa306e40bc8e..104aa40be6c4 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts@@ -74,6 +74,7 @@ const BASE_CONFIG: SignalScoutConfigApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.tsindex 124ff402bca0..1e1c7c0c02e8 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts@@ -74,6 +74,7 @@ import {FleetSummary,isSettledRun,rosterRunCosts,+ runResponseCoversFleet,scoutDisplayName,SCOUT_ROSTER_WINDOW_DAYS,SCOUT_ROSTER_WINDOW_HOURS,@@ -346,6 +347,7 @@ export interface scoutFleetLogicValues {scoutRunCosts: Map<string, number>scoutRunCostsLoading: booleanscoutRuns: SignalScoutRunSummary[]+ scoutRunsCoverFleet: booleanscoutRunsLoadedOnce: booleanscoutRunsLoading: booleanscoutSearch: string@@ -599,6 +601,7 @@ export interface scoutFleetLogicMeta {dataProcessingApprovalDisabledReason: string | null) => string | nullrollups: (scoutRuns: SignalScoutRunSummary[]) => Map<string, ScoutRollup>+ scoutRunsCoverFleet: (scoutConfigs: SignalScoutConfigApi[] | null) => booleanexpensiveRunCostThreshold: (scoutRuns: SignalScoutRunSummary[],scoutRunCosts: Map<string, number>@@ -1180,6 +1183,13 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([(s) => [s.scoutRuns],(scoutRuns: SignalScoutRunSummary[]): Map<string, ScoutRollup> => computeScoutRollups(scoutRuns),],+ // Whether `scoutRuns` speaks for the whole fleet. The endpoint probes a bounded number of+ // scouts, so past that bound an empty rollup means "not read", not "never ran" - and a+ // surface that cannot tell the two apart reports lost history as a scout that never worked.+ scoutRunsCoverFleet: [+ (s) => [s.scoutConfigs],+ (scoutConfigs: SignalScoutConfig[] | null): boolean => runResponseCoversFleet(scoutConfigs?.length ?? 0),+ ],expensiveRunCostThreshold: [(s) => [s.scoutRuns, s.scoutRunCosts],(scoutRuns: SignalScoutRunSummary[], scoutRunCosts: Map<string, number>): number | null =>diff --git a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.tsindex 763732d6b2f2..8e396bad6d30 100644--- a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts@@ -111,6 +111,7 @@ const CONFIG: SignalScoutConfigApi = {last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,+ status_changed_by: null,auto_pause_exempt: false,network_access: 'trusted',model: null,diff --git a/products/signals/frontend/inbox/utils/scoutGroups.test.ts b/products/signals/frontend/inbox/utils/scoutGroups.test.tsindex 24e55f8a26bb..c0bf2bb0f093 100644--- a/products/signals/frontend/inbox/utils/scoutGroups.test.ts+++ b/products/signals/frontend/inbox/utils/scoutGroups.test.ts@@ -134,6 +134,34 @@ describe('scoutGroups', () => {expect(scoutSubtitle(makeConfig(overrides), undefined, NOW)?.text).toEqual(expected)})+ // A card that only says when a scout went off sends the reader to the activity log to find+ // out who did it, which nobody looking at the roster knows to open.+ it.each<[string, Partial<SignalScoutConfig>, string]>([+ [+ 'a user pause names the person who did it',+ {+ enabled: false,+ status: 'paused_by_user',+ status_changed_at: '2026-06-24T00:00:00Z',+ status_changed_by: {+ id: 7,+ uuid: 'user-7',+ first_name: 'Ada',+ last_name: 'Byron',+ email: '[email protected]',+ } as SignalScoutConfig['status_changed_by'],+ },+ 'Turned off by Ada Byron · Jun 24, 2026',+ ],+ [+ 'an unattributed pause credits nobody',+ { enabled: false, status: 'paused_by_user', status_changed_at: '2026-06-24T00:00:00Z' },+ 'Turned off Jun 24, 2026',+ ],+ ])('%s', (_name, overrides, expected) => {+ expect(scoutSubtitle(makeConfig(overrides), undefined, NOW)?.text).toEqual(expected)+ })+it('prefers what the last run checked over the scout description', () => {const rollup = rollupFor([makeRun({ summary: 'Swept 40 event series against the 14-day baseline. All inside range.' }),diff --git a/products/signals/frontend/inbox/utils/scoutGroups.ts b/products/signals/frontend/inbox/utils/scoutGroups.tsindex 4b43839abfed..517ca10d411a 100644--- a/products/signals/frontend/inbox/utils/scoutGroups.ts+++ b/products/signals/frontend/inbox/utils/scoutGroups.ts@@ -1,5 +1,6 @@import { describeCron, nextCronOccurrence } from 'lib/cron'import { dayjs } from 'lib/dayjs'+import { fullName } from 'lib/utils/strings'import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'@@ -64,6 +65,27 @@ function isWithinColdStart(config: SignalScoutConfig, now: Date): boolean {return dayjs(now).diff(dayjs(anchor.at), 'day', true) < SCOUT_COLD_START_DAYS}+/**+ * Who stopped this scout and when, or null while it runs. `status_changed_by` is stamped only when+ * a person paused it through the config API, so a user pause with no actor is an older or+ * unattributed toggle: it says "Turned off" alone rather than crediting the system for it.+ */+export function scoutPausedByLine(config: SignalScoutConfig): string | null {+ const on = config.status_changed_at ? dayjs(config.status_changed_at).format('MMM D, YYYY') : null+ if (config.status === 'paused_by_system') {+ return on ? `Paused by PostHog · ${on}` : 'Paused by PostHog'+ }+ if (config.status === 'paused_by_user' || !config.enabled) {+ const actor = config.status_changed_by+ const name = actor ? fullName(actor) || actor.email : null+ if (name) {+ return on ? `Turned off by ${name} · ${on}` : `Turned off by ${name}`+ }+ return on ? `Turned off ${on}` : 'Turned off'+ }+ return null+}+export function scoutGroup(config: SignalScoutConfig, rollup: ScoutRollup | undefined, now: Date): ScoutGroupKey {// Status first: a system pause or warning outranks everything else the scout looks like, and a// human pause means "off" no matter what the scout was doing when it stopped.@@ -148,11 +170,9 @@ export function scoutSubtitle(}}if (config.status === 'paused_by_user' || !config.enabled) {- const changedAt = config.status_changed_at- return {- text: changedAt ? `Turned off ${dayjs(changedAt).format('MMM D, YYYY')}` : 'Turned off',- tone: 'muted',- }+ // Who turned it off, so the roster answers the question a reader asks next without them+ // having to know the activity log exists.+ return { text: scoutPausedByLine(config) ?? 'Turned off', tone: 'muted' }}if (!config.emit) {return { text: 'Runs and investigates, but files nothing', tone: 'muted' }diff --git a/products/signals/frontend/inbox/utils/scoutRunsWindow.test.ts b/products/signals/frontend/inbox/utils/scoutRunsWindow.test.tsindex 922549ef53e4..a548c1599184 100644--- a/products/signals/frontend/inbox/utils/scoutRunsWindow.test.ts+++ b/products/signals/frontend/inbox/utils/scoutRunsWindow.test.ts@@ -12,6 +12,9 @@ import {mostRecentEmittedRuns,rosterRunCosts,runMatchesFilter,+ runResponseCoversFleet,+ runStripEmptyLabel,+ SCOUT_RUNS_FLEET_COVERAGE_LIMIT,dayTimeToWeeklyCron,getScoutScheduleMode,SCOUT_CUSTOM_CRON_SCHEDULE_MODE,@@ -159,6 +162,23 @@ describe('scoutRunsWindow report channel', () => {})})+ describe('runStripEmptyLabel', () => {+ it.each([+ [{ loadedOnce: false, coversFleet: true }, '…'],+ [{ loadedOnce: true, coversFleet: true }, 'No runs yet'],+ // A fleet the response stops short of leaves this scout unread, so "No runs yet" would+ // report lost history as a scout that never worked.+ [{ loadedOnce: true, coversFleet: false }, 'History unavailable'],+ ])('reads %j as %s', (state, expected) => {+ expect(runStripEmptyLabel(state)).toBe(expected)+ })++ it('treats a fleet past the covered count as uncovered', () => {+ expect(runResponseCoversFleet(SCOUT_RUNS_FLEET_COVERAGE_LIMIT)).toBe(true)+ expect(runResponseCoversFleet(SCOUT_RUNS_FLEET_COVERAGE_LIMIT + 1)).toBe(false)+ })+ })+describe('runMatchesFilter', () => {it('keeps a report-authoring run out of Quiet and inside Emitted', () => {const run = makeRun({ emitted_report_ids: ['r-1'] })diff --git a/products/signals/frontend/inbox/utils/scoutRunsWindow.ts b/products/signals/frontend/inbox/utils/scoutRunsWindow.tsindex 7a47702b3967..cee5d0ea6e4a 100644--- a/products/signals/frontend/inbox/utils/scoutRunsWindow.ts+++ b/products/signals/frontend/inbox/utils/scoutRunsWindow.ts@@ -44,6 +44,34 @@ export const SCOUT_ROSTER_WINDOW_LABEL = `last ${SCOUT_ROSTER_WINDOW_DAYS} days`*/export const SCOUT_NO_RECENT_RUNS = 'No recent runs.'+/**+ * How many scouts one `recent-per-scout` response covers, mirroring the endpoint's+ * `MAX_SCOUTS_PER_RUNS_QUERY`. A fleet past this is probed in part, so a scout the response holds+ * no runs for may never have been read - which is not the same thing as never having run, and is+ * how a paused scout came to show "No runs yet" beside a cost line proving it had run.+ */+export const SCOUT_RUNS_FLEET_COVERAGE_LIMIT = 2500++/** Whether the per-scout run response can be read as every scout's history. */+export function runResponseCoversFleet(scoutCount: number): boolean {+ return scoutCount <= SCOUT_RUNS_FLEET_COVERAGE_LIMIT+}++/** Empty-state copy for a scout the run response could not speak for. */+export const SCOUT_RUN_HISTORY_UNAVAILABLE =+ "Run history isn't available for this scout right now. Refresh the page, and if it keeps happening contact support."++/**+ * What an empty run strip reads: still loading, genuinely empty, or empty only because the response+ * stopped short of this scout.+ */+export function runStripEmptyLabel({ loadedOnce, coversFleet }: { loadedOnce: boolean; coversFleet: boolean }): string {+ if (!loadedOnce) {+ return '…'+ }+ return coversFleet ? 'No runs yet' : 'History unavailable'+}+/*** The time window the fleet-wide findings feed describes. Unlike the per-scout stats, that feed* answers "what has the troop surfaced lately?", which is a recency question — so it stays on adiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 3e60b834d605..649aa6c303ea 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -85153,6 +85153,8 @@ export namespace Schemas {* @nullable*/readonly status_changed_at: string | null;+ /** Who last moved `status`, when a person did it through this API. Null for a system transition such as an automatic pause, for a row whose status never changed, and for a caller that may not read member identities. Pair it with `status` to say who turned a scout off, instead of only when it went off. */+ readonly status_changed_by: UserBasic | null;/** Whether this scout is exempt from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. Only ever set explicitly: re-enabling a swept scout instead grants a fresh grace window before the sweep may judge it again. */readonly auto_pause_exempt: boolean;/** Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter. */