: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(desktop): surface scout lifecycle status and auto-pause reasons (#76938)
posthog[bot]82018824d6cf
diff --git a/products/desktop/packages/api-client/src/posthog-client.ts b/products/desktop/packages/api-client/src/posthog-client.tsindex b6c3e7b68e7a..e427e84349a5 100644--- a/products/desktop/packages/api-client/src/posthog-client.ts+++ b/products/desktop/packages/api-client/src/posthog-client.ts@@ -351,12 +351,49 @@ export interface SignalSourceConfig {// Endpoints live under /api/projects/{id}/signals/scout/ and require the// `signal_scout:read` / `signal_scout:write` scopes.+/**+ * Lifecycle state the coordinator keeps alongside `enabled`:+ * - `active` – running on its schedule.+ * - `pending_pause` – still running, but flagged by the inactivity sweep and+ * due to be paused unless something changes.+ * - `paused_by_user` – a person switched it off; the system never overrides it.+ * - `paused_by_system` – the platform switched it off, see `pause_reason`.+ */+export type ScoutLifecycleStatus =+ | "active"+ | "pending_pause"+ | "paused_by_user"+ | "paused_by_system";++/**+ * Why the system warned or paused a scout: `ignored` (its findings went+ * unacted on), `no_output` (it stopped emitting anything), or+ * `repeated_failures` (its runs kept erroring).+ */+export type ScoutPauseReason = "ignored" | "no_output" | "repeated_failures";+export interface ScoutConfig {id: string;skill_name: string;enabled: boolean;/** False means dry-run: the scout runs but findings are not emitted. */emit: boolean;+ /**+ * Lifecycle state behind `enabled`. Absent on backends predating the+ * lifecycle fields, in which case `enabled` is all there is to go on.+ */+ status?: ScoutLifecycleStatus;+ /** Why the system warned or paused the scout; null while it is healthy. */+ pause_reason?: ScoutPauseReason | null;+ /** ISO timestamp of the last `status` transition; null if it never moved. */+ status_changed_at?: string | null;+ /** Runs that failed back to back; trips a `repeated_failures` pause. */+ consecutive_failure_count?: number;+ /**+ * Exempts the scout from the inactivity sweep — both the `ignored` pause and+ * the `no_output` warning. Set on watchdog scouts whose value is staying quiet.+ */+ auto_pause_exempt?: boolean;/*** Summary of what the scout investigates, from the skill's description* metadata. Empty string when the skill is absent or carries no description;@@ -1846,9 +1883,15 @@ export class PostHogAPIClient {projectId: number,configId: string,updates: {+ /**+ * Flipping this off records a user pause (`status` becomes+ * `paused_by_user`, which the system never overrides); flipping it on+ * resumes the scout from any pause, including a system one.+ */enabled?: boolean;emit?: boolean;run_interval_minutes?: number;+ auto_pause_exempt?: boolean;},): Promise<ScoutConfig> {const urlPath = `/api/projects/${projectId}/signals/scout/configs/${configId}/`;diff --git a/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts b/products/desktop/packages/core/src/scouts/scoutPresentation.test.tsindex 05cdada5690a..b5bb950e5eb0 100644--- a/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts+++ b/products/desktop/packages/core/src/scouts/scoutPresentation.test.ts@@ -6,6 +6,7 @@ import {computeScoutRollups,deriveRunFailureKind,deriveRunOutcome,+ deriveScoutLifecycle,formatRunDuration,formatRunInterval,formatRunIntervalShort,@@ -301,6 +302,47 @@ describe("rollups", () => {expect(summary.successRate).toBeNull();expect(summary.emitRate).toBeNull();});++ it("counts only the warnings that actually pause, plus system pauses", () => {+ const configs = [+ makeConfig({ status: "active" }),+ // Quiet: flagged, but the sweep never escalates it, so it must not be+ // counted as pausing soon.+ makeConfig({+ id: "config-2",+ skill_name: "signals-scout-logs",+ status: "pending_pause",+ pause_reason: "no_output",+ }),+ makeConfig({+ id: "config-3",+ skill_name: "signals-scout-quiet",+ status: "pending_pause",+ pause_reason: "ignored",+ }),+ makeConfig({+ id: "config-4",+ skill_name: "signals-scout-apm",+ enabled: false,+ status: "paused_by_system",+ pause_reason: "repeated_failures",+ }),+ makeConfig({+ id: "config-5",+ skill_name: "signals-scout-surveys",+ enabled: false,+ status: "paused_by_user",+ }),+ ];+ expect(computeFleetSummary(configs, computeScoutRollups([]))).toMatchObject(+ {+ totalCount: 5,+ enabledCount: 3,+ pausingSoonCount: 1,+ systemPausedCount: 1,+ },+ );+ });});describe("intervals and ordering", () => {@@ -333,6 +375,162 @@ describe("intervals and ordering", () => {"signals-scout-logs",]);});++ it("leads the off-block with system-paused scouts", () => {+ const configs = [+ makeConfig({ skill_name: "signals-scout-apm", enabled: false }),+ makeConfig({+ skill_name: "signals-scout-logs",+ enabled: false,+ status: "paused_by_system",+ pause_reason: "repeated_failures",+ }),+ makeConfig({ skill_name: "signals-scout-surveys" }),+ ];+ expect(+ sortConfigsForDisplay(configs).map((config) => config.skill_name),+ ).toEqual([+ "signals-scout-surveys",+ "signals-scout-logs",+ "signals-scout-apm",+ ]);+ });+});++describe("lifecycle", () => {+ it.each([+ ["ignored", "unacted on"],+ ["no_output", "stopped emitting"],+ ["repeated_failures", "3 runs in a row failed"],+ ] as const)("explains a %s system pause", (reason, fragment) => {+ const state = deriveScoutLifecycle(+ makeConfig({+ enabled: false,+ status: "paused_by_system",+ pause_reason: reason,+ consecutive_failure_count: 3,+ status_changed_at: "2026-06-09T00:00:00Z",+ }),+ );+ expect(state).toMatchObject({+ lifecycle: "paused_by_system",+ label: "Auto-paused",+ isSystemPaused: true,+ isWarned: false,+ changedAt: "2026-06-09T00:00:00Z",+ });+ expect(state.explanation).toContain(fragment);+ // Re-enabling is the recovery on every reason, so it always gets named.+ expect(state.explanation).toMatch(/switch it back on/i);+ });++ it("says an inactivity pause never lifts itself", () => {+ // The sweep has no probe: a human re-enable is the only exit, and that+ // re-enable also marks the scout exempt.+ const state = deriveScoutLifecycle(+ makeConfig({+ enabled: false,+ status: "paused_by_system",+ pause_reason: "ignored",+ }),+ );+ expect(state.explanation).toContain("exempts it from inactivity pauses");+ expect(state.explanation).not.toMatch(/retries|on its own/i);+ });++ it("says a failure pause retries on its own", () => {+ // The breaker keeps a half-open probe, so presenting a manual re-enable as+ // the only way back would be wrong.+ const state = deriveScoutLifecycle(+ makeConfig({+ enabled: false,+ status: "paused_by_system",+ pause_reason: "repeated_failures",+ consecutive_failure_count: 6,+ }),+ );+ expect(state.explanation).toContain("resumes on its own");+ });++ it("flags an ignored warning as heading for a pause", () => {+ const state = deriveScoutLifecycle(+ makeConfig({ status: "pending_pause", pause_reason: "ignored" }),+ );+ expect(state).toMatchObject({+ lifecycle: "warned",+ label: "Pausing soon",+ isWarned: true,+ isSystemPaused: false,+ willPause: true,+ });+ expect(state.explanation).toContain("exempt it from inactivity pauses");+ });++ it("does not promise a pause for a quiet scout", () => {+ // `no_output` is warning-only on the backend: silence alone never pauses a+ // scout, because a watchdog's silence is the job.+ const state = deriveScoutLifecycle(+ makeConfig({ status: "pending_pause", pause_reason: "no_output" }),+ );+ expect(state).toMatchObject({+ lifecycle: "warned",+ label: "Quiet",+ isWarned: true,+ willPause: false,+ });+ expect(state.explanation).not.toMatch(/will pause|pausing soon/i);+ });++ it.each([+ [true, "active"],+ [false, "paused_by_user"],+ ] as const)(+ "badges nothing for an enabled=%s scout with no system action",+ (enabled, lifecycle) => {+ expect(+ deriveScoutLifecycle(+ makeConfig({+ enabled,+ status: enabled ? "active" : "paused_by_user",+ }),+ ),+ ).toMatchObject({ lifecycle, label: null, explanation: null });+ },+ );++ it("clears the pause as soon as the scout is switched back on", () => {+ // The optimistic enable patches `enabled` alone; the server clears `status`+ // on the response, so the badge must not survive the round trip.+ expect(+ deriveScoutLifecycle(+ makeConfig({+ enabled: true,+ status: "paused_by_system",+ pause_reason: "repeated_failures",+ }),+ ),+ ).toMatchObject({ lifecycle: "active", label: null, explanation: null });+ });++ it("falls back to enabled on backends predating the lifecycle fields", () => {+ expect(deriveScoutLifecycle(makeConfig({ enabled: false }))).toMatchObject({+ lifecycle: "paused_by_user",+ label: null,+ // Null, not false: an absent field cannot be written back, so the UI has+ // to be able to tell "unsupported" from "off".+ autoPauseExempt: null,+ consecutiveFailureCount: 0,+ });+ });++ it.each([+ [true, true],+ [false, false],+ ])("reads auto_pause_exempt=%s as %s", (sent, expected) => {+ expect(+ deriveScoutLifecycle(makeConfig({ auto_pause_exempt: sent })),+ ).toMatchObject({ autoPauseExempt: expected });+ });});describe("creators", () => {diff --git a/products/desktop/packages/core/src/scouts/scoutPresentation.ts b/products/desktop/packages/core/src/scouts/scoutPresentation.tsindex fde98ab6cd94..4cf84ce5262d 100644--- a/products/desktop/packages/core/src/scouts/scoutPresentation.ts+++ b/products/desktop/packages/core/src/scouts/scoutPresentation.ts@@ -2,6 +2,7 @@ import type {LlmSkillCreatedBy,LlmSkillListItem,ScoutConfig,+ ScoutPauseReason,ScoutRun,} from "@posthog/api-client/posthog-client";@@ -22,6 +23,159 @@ export function getScoutOrigin(return config?.scout_origin === "canonical" ? "canonical" : "custom";}+/**+ * How a scout came to be in its current on/off state. `enabled` alone cannot+ * tell "someone switched this off" from "the platform switched it off", and it+ * says nothing at all about a scout that is still running but already flagged+ * for auto-pause.+ */+export type ScoutLifecycle =+ | "active"+ /** Still running, but the system has flagged it. See `willPause`. */+ | "warned"+ | "paused_by_user"+ | "paused_by_system";++export interface ScoutLifecycleState {+ lifecycle: ScoutLifecycle;+ reason: ScoutPauseReason | null;+ /** Badge text, or null when there is nothing worth flagging on the row. */+ label: string | null;+ /** What happened and how to get the scout running again; null when healthy. */+ explanation: string | null;+ /** The system stopped this scout — switching it back on resumes it. */+ isSystemPaused: boolean;+ /** The scout still runs, but the system has flagged it. */+ isWarned: boolean;+ /**+ * The warning actually advances to a pause. False for a `no_output` warning,+ * which the sweep raises for a look but never escalates: silence alone never+ * pauses a scout, because a watchdog's silence is the job.+ */+ willPause: boolean;+ /** ISO timestamp of the transition into this state, when the backend has one. */+ changedAt: string | null;+ consecutiveFailureCount: number;+ /**+ * Null when the backend never sent the field, which is not the same as false:+ * a PATCH it does not understand cannot persist, so the control has nothing to+ * write and should not be offered.+ */+ autoPauseExempt: boolean | null;+}++function failureCountClause(count: number): string {+ return count > 1 ? `${count} runs in a row failed` : "its runs kept failing";+}++function warnedCopy(+ reason: ScoutPauseReason | null,+ failureCount: number,+): { label: string; explanation: string; willPause: boolean } {+ switch (reason) {+ case "ignored":+ return {+ label: "Pausing soon",+ explanation:+ "Its findings have been going unacted on, so the inactivity sweep will pause this scout soon. Act on a finding, or exempt it from inactivity pauses, to keep it running.",+ willPause: true,+ };+ case "no_output":+ return {+ label: "Quiet",+ explanation:+ "This scout has surfaced nothing lately, so the inactivity sweep flagged it for a look. Staying quiet on its own never pauses a scout, so nothing happens unless someone acts.",+ willPause: false,+ };+ case "repeated_failures":+ return {+ label: "Pausing soon",+ explanation: `PostHog will pause this scout soon because ${failureCountClause(failureCount)}. Fix the skill to keep it running.`,+ willPause: true,+ };+ default:+ return {+ label: "Pausing soon",+ explanation:+ "PostHog is about to pause this scout. Exempt it from inactivity pauses to keep it running.",+ willPause: true,+ };+ }+}++function systemPausedExplanation(+ reason: ScoutPauseReason | null,+ failureCount: number,+): string {+ switch (reason) {+ case "ignored":+ return "PostHog paused this scout because its findings were going unacted on. Switch it back on to resume — that also exempts it from inactivity pauses, so it will not happen again.";+ case "no_output":+ return "PostHog paused this scout because it stopped emitting findings. Switch it back on to resume — that also exempts it from inactivity pauses, so it will not happen again.";+ case "repeated_failures":+ // The breaker keeps a half-open probe on this reason, so this one recovers+ // without anyone touching it. Say so, or the badge reads as terminal.+ return `PostHog paused this scout because ${failureCountClause(failureCount)}. It retries about once a day and resumes on its own once a run succeeds. Fix the skill, or switch it back on to retry right away.`;+ default:+ return "PostHog paused this scout. Switch it back on to resume.";+ }+}++/**+ * Read a scout's lifecycle out of the configs endpoint, with the copy that+ * explains it. Backends predating the lifecycle fields (and any status value we+ * do not recognise) fall back to `enabled`, which reads as a user pause — the+ * same thing the UI showed before these fields existed.+ */+export function deriveScoutLifecycle(config: ScoutConfig): ScoutLifecycleState {+ const reason = config.pause_reason ?? null;+ const failureCount = config.consecutive_failure_count ?? 0;+ const base = {+ reason,+ changedAt: config.status_changed_at ?? null,+ consecutiveFailureCount: failureCount,+ autoPauseExempt: config.auto_pause_exempt ?? null,+ };+ // A system pause always leaves the scout switched off and a warning always+ // leaves it switched on, so `enabled` breaks the tie where the two disagree.+ // That keeps an optimistically enabled scout from reading as "on, but+ // auto-paused" for the round trip it takes the server to clear the status.+ if (!config.enabled && config.status === "paused_by_system") {+ return {+ ...base,+ lifecycle: "paused_by_system",+ label: "Auto-paused",+ explanation: systemPausedExplanation(reason, failureCount),+ isSystemPaused: true,+ isWarned: false,+ willPause: false,+ };+ }+ if (config.enabled && config.status === "pending_pause") {+ const copy = warnedCopy(reason, failureCount);+ return {+ ...base,+ lifecycle: "warned",+ label: copy.label,+ explanation: copy.explanation,+ isSystemPaused: false,+ isWarned: true,+ willPause: copy.willPause,+ };+ }+ return {+ ...base,+ lifecycle: config.enabled ? "active" : "paused_by_user",+ // The switch and the dimmed row already say "off"; a badge would only+ // repeat them, and an active scout has nothing to explain.+ label: null,+ explanation: null,+ isSystemPaused: false,+ isWarned: false,+ willPause: false,+ };+}+/** "signals-scout-error-tracking" → "Error tracking" */export function prettifyScoutSkillName(skillName: string): string {const cleaned = skillName@@ -352,6 +506,14 @@ export function computeScoutRollups(export interface FleetSummary {totalCount: number;enabledCount: number;+ /**+ * Enabled scouts heading for a pause unless something changes. Excludes a+ * `no_output` warning, which never escalates — counting it here would promise+ * a pause that is not coming.+ */+ pausingSoonCount: number;+ /** Scouts the platform switched off; a user has to switch them back on. */+ systemPausedCount: number;runningCount: number;emittedCount: number;/** Completed / (completed + failed) over the visible window, or null when no finished runs. */@@ -380,10 +542,16 @@ export function computeFleetSummary(if ((run.emitted_count ?? 0) > 0) emittedRunCount += 1;}}+ const lifecycles = configs.map(deriveScoutLifecycle);const finished = completedCount + failedCount;return {totalCount: configs.length,enabledCount: configs.filter((config) => config.enabled).length,+ pausingSoonCount: lifecycles.filter((lifecycle) => lifecycle.willPause)+ .length,+ systemPausedCount: lifecycles.filter(+ (lifecycle) => lifecycle.isSystemPaused,+ ).length,runningCount,emittedCount,successRate: finished > 0 ? completedCount / finished : null,@@ -425,11 +593,24 @@ export function formatRunIntervalShort(minutes: number): string {return `every ${minutes}m`;}+/**+ * Enabled scouts first, then the ones the system switched off (they need a+ * human to switch them back on, so they lead the off-block), then the rest+ * alphabetically.+ */export function sortConfigsForDisplay(configs: ScoutConfig[]): ScoutConfig[] {- return [...configs].sort((a, b) => {- if (a.enabled !== b.enabled) return a.enabled ? -1 : 1;- return prettifyScoutSkillName(a.skill_name).localeCompare(- prettifyScoutSkillName(b.skill_name),- );- });+ return configs+ .map((config) => ({+ config,+ systemPaused: deriveScoutLifecycle(config).isSystemPaused,+ name: prettifyScoutSkillName(config.skill_name),+ }))+ .sort((a, b) => {+ if (a.config.enabled !== b.config.enabled) {+ return a.config.enabled ? -1 : 1;+ }+ if (a.systemPaused !== b.systemPaused) return a.systemPaused ? -1 : 1;+ return a.name.localeCompare(b.name);+ })+ .map((entry) => entry.config);}diff --git a/products/desktop/packages/shared/src/analytics-events.ts b/products/desktop/packages/shared/src/analytics-events.tsindex ae54144e48fe..3507efff5b59 100644--- a/products/desktop/packages/shared/src/analytics-events.ts+++ b/products/desktop/packages/shared/src/analytics-events.ts@@ -850,9 +850,10 @@ export interface ScoutDetailViewedProperties {export interface ScoutConfigChangedProperties {skill_name: string;scout_origin: "canonical" | "custom";- setting: "enabled" | "emit" | "run_interval_minutes";+ setting: "enabled" | "emit" | "run_interval_minutes" | "auto_pause_exempt";new_value: boolean | number;- old_value: boolean | number;+ /** Null when the backend predates the setting and never sent a value. */+ old_value: boolean | number | null;/** False when the server rejected the update and the change rolled back. */success: boolean;}diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutConfigControls.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutConfigControls.tsxindex 5947a7da1a4d..4df26db7824c 100644--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutConfigControls.tsx+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutConfigControls.tsx@@ -1,8 +1,10 @@import type { ScoutConfig } from "@posthog/api-client/posthog-client";import {+ deriveScoutLifecycle,formatRunInterval,RUN_INTERVAL_OPTIONS,} from "@posthog/core/scouts/scoutPresentation";+import { Switch as QuillSwitch, Text as QuillText } from "@posthog/quill";import { SettingsOptionSelect } from "@posthog/ui/features/settings/SettingsOptionSelect";import { Flex, Switch, Text, Tooltip } from "@radix-ui/themes";import { useMemo } from "react";@@ -42,8 +44,16 @@ export function ScoutEnabledSwitch({config,onUpdate,}: ScoutConfigControlsProps) {+ // Switching a system-paused scout back on is the documented recovery, so say+ // "resume" rather than the generic "enable"; the badge beside it explains why+ // the scout stopped.+ const tooltip = config.enabled+ ? "Disable scout"+ : deriveScoutLifecycle(config).isSystemPaused+ ? "Resume scout"+ : "Enable scout";return (- <Tooltip content={config.enabled ? "Disable scout" : "Enable scout"}>+ <Tooltip content={tooltip}>{/* Tooltip stamps its own data-state on its child, which would overwritethe Switch's checked/unchecked state and leave the track stuck on theaccent color. Give it a span to stamp. */}@@ -70,6 +80,7 @@ export function ScoutConfigForm({onUpdate,}: ScoutConfigControlsProps) {const intervalOptions = useIntervalOptions(config);+ const lifecycle = deriveScoutLifecycle(config);return (<Flex direction="column" gap="2">@@ -109,6 +120,29 @@ export function ScoutConfigForm({}/></Flex>+ {/* Null means the backend never sent the field, so a PATCH carrying it+ could not persist. Offer the control only where it writes. */}+ {lifecycle.autoPauseExempt !== null ? (+ <div className="flex items-center justify-between gap-4">+ <div className="flex min-w-0 flex-col">+ <QuillText size="xs" className="text-gray-12">+ Never pause for inactivity+ </QuillText>+ <QuillText size="xxs" className="text-gray-10">+ Keep running when the scout goes quiet or its findings go unacted+ on. Repeated failures still pause it.+ </QuillText>+ </div>+ <QuillSwitch+ size="sm"+ checked={lifecycle.autoPauseExempt}+ onCheckedChange={(checked) =>+ onUpdate(config.id, { auto_pause_exempt: checked })+ }+ aria-label={`${config.skill_name} exempt from inactivity pauses`}+ />+ </div>+ ) : null}</Flex>);}diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailHeader.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailHeader.tsxindex 764383b231b5..e6375ec40698 100644--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailHeader.tsx+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutDetailHeader.tsx@@ -12,6 +12,10 @@ import { useState } from "react";import type { ScoutConfigUpdate } from "../hooks/useScoutConfigMutations";import { DryRunBadge, ScoutOriginBadge } from "./ScoutBadges";import { ScoutConfigForm, ScoutEnabledSwitch } from "./ScoutConfigControls";+import {+ ScoutLifecycleBadge,+ ScoutLifecycleNotice,+} from "./ScoutLifecycleBadges";import { ScoutChatButton } from "./ScoutRowCard";import { ScoutRunBoxes } from "./ScoutRunBoxes";@@ -49,6 +53,7 @@ export function ScoutDetailHeader({</Text><ScoutOriginBadge config={config} /><DryRunBadge config={config} />+ <ScoutLifecycleBadge config={config} />{cloudSkillUrl ? (<Tooltip content="View skill in PostHog"><a@@ -100,6 +105,8 @@ export function ScoutDetailHeader({<ScoutEnabledSwitch config={config} onUpdate={onUpdate} /></Flex>+ <ScoutLifecycleNotice config={config} />+{runsLoading ? (<Box className="h-[18px] w-80 max-w-full animate-pulse rounded bg-(--gray-3)" />) : rollup && rollup.runCount > 0 ? (diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutLifecycleBadges.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutLifecycleBadges.tsxnew file mode 100644index 000000000000..0098d44b7155--- /dev/null+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutLifecycleBadges.tsx@@ -0,0 +1,71 @@+import type { ScoutConfig } from "@posthog/api-client/posthog-client";+import { deriveScoutLifecycle } from "@posthog/core/scouts/scoutPresentation";+import {+ Badge,+ Text,+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@posthog/quill";+import { RelativeTimestamp } from "@posthog/ui/primitives/RelativeTimestamp";++/**+ * Why a scout is stopped, or about to be. Renders nothing for the healthy+ * states — the enable switch already says whether a scout is on, so the badge+ * only appears when the system did something the user did not ask for.+ */+export function ScoutLifecycleBadge({ config }: { config: ScoutConfig }) {+ const lifecycle = deriveScoutLifecycle(config);+ if (!lifecycle.label) return null;+ return (+ <TooltipProvider delay={300}>+ <Tooltip>+ <TooltipTrigger+ render={+ <Badge+ variant={lifecycle.isSystemPaused ? "destructive" : "warning"}+ className="relative"+ >+ {lifecycle.label}+ </Badge>+ }+ />+ <TooltipContent side="bottom" className="max-w-xs">+ {lifecycle.explanation ?? lifecycle.label}+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ );+}++/**+ * The full lifecycle story for surfaces with room for a sentence: what the+ * system did and what gets the scout running again. The fleet list makes do+ * with `ScoutLifecycleBadge`'s tooltip; this is for the scout detail screen.+ */+export function ScoutLifecycleNotice({ config }: { config: ScoutConfig }) {+ const lifecycle = deriveScoutLifecycle(config);+ if (!lifecycle.explanation) return null;+ return (+ <div+ className={`flex flex-wrap items-center gap-2 rounded-(--radius-2) border px-3 py-2 ${+ lifecycle.isSystemPaused+ ? "border-(--red-6) bg-(--red-2)"+ : "border-(--amber-6) bg-(--amber-2)"+ }`}+ >+ <Text+ size="xs"+ className={`leading-snug ${+ lifecycle.isSystemPaused ? "text-(--red-11)" : "text-(--amber-11)"+ }`}+ >+ {lifecycle.explanation}+ </Text>+ {lifecycle.changedAt ? (+ <RelativeTimestamp timestamp={lifecycle.changedAt} />+ ) : null}+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutRowCard.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutRowCard.tsxindex 9bf258310f39..d53c3ea29c34 100644--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutRowCard.tsx+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutRowCard.tsx@@ -22,6 +22,7 @@ import { useScoutChatTask } from "../hooks/useScoutChatTask";import type { ScoutConfigUpdate } from "../hooks/useScoutConfigMutations";import { DryRunBadge, ScoutOriginBadge } from "./ScoutBadges";import { ScoutConfigForm, ScoutEnabledSwitch } from "./ScoutConfigControls";+import { ScoutLifecycleBadge } from "./ScoutLifecycleBadges";import { ScoutRunBoxes } from "./ScoutRunBoxes";/**@@ -104,6 +105,7 @@ export function ScoutRowCard({) : null}<ScoutOriginBadge config={config} /><DryRunBadge config={config} />+ <ScoutLifecycleBadge config={config} /><Text className="whitespace-nowrap text-[11px] text-gray-10">{formatRunIntervalShort(config.run_interval_minutes)}</Text>diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.stories.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.stories.tsxindex b75b497102e6..b6c43147e997 100644--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.stories.tsx+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.stories.tsx@@ -26,6 +26,7 @@ const config = (overrides: Partial<ScoutConfig> = {}): ScoutConfig => ({scout_origin: "canonical",run_interval_minutes: 180,last_run_at: "2026-07-09T06:30:00Z",+ auto_pause_exempt: false,created_at: "2026-06-01T00:00:00Z",...overrides,});@@ -56,11 +57,48 @@ const CONFIGS: ScoutConfig[] = [skill_name: "signals-scout-weekly-digest",scout_origin: "custom",enabled: false,+ status: "paused_by_user",run_interval_minutes: 10080,description: "Posts a weekly digest of notable product metrics.",}),];+/** The lifecycle states the platform drives, not the user. */+const LIFECYCLE_CONFIGS: ScoutConfig[] = [+ ...CONFIGS,+ // Quiet, so flagged for a look — but silence alone never pauses a scout.+ config({+ id: "config-quiet-watchdog",+ skill_name: "signals-scout-quiet-watchdog",+ scout_origin: "custom",+ status: "pending_pause",+ pause_reason: "no_output",+ status_changed_at: "2026-07-08T06:15:00Z",+ description: "Watches for a failure mode that has not fired in a while.",+ }),+ // Findings nobody picked up: this is the warning that does advance to a pause.+ config({+ id: "config-ignored-digest",+ skill_name: "signals-scout-ignored-digest",+ scout_origin: "custom",+ status: "pending_pause",+ pause_reason: "ignored",+ status_changed_at: "2026-07-08T06:15:00Z",+ description: "Files a digest of product metrics nobody has acted on.",+ }),+ config({+ id: "config-flaky-import",+ skill_name: "signals-scout-flaky-import",+ scout_origin: "custom",+ enabled: false,+ status: "paused_by_system",+ pause_reason: "repeated_failures",+ consecutive_failure_count: 6,+ status_changed_at: "2026-07-07T00:45:00Z",+ description: "Sweeps warehouse imports for stuck or failing syncs.",+ }),+];+// Authorship joins from the backing skills: canonical scouts carry no author.const CREATORS = buildScoutCreatorIndex([{ name: "signals-scout-ad-spend", created_by: YOU, is_latest: true },@@ -156,3 +194,13 @@ export const NothingOfYours: Story = {export const WithoutCreatorData: Story = {args: { creators: null },};++/**+ * The three system-driven states side by side: a quiet scout (flagged only), one+ * whose ignored findings will pause it, and one the failure breaker already+ * paused. Only the latter two are counted in the summary line, and the paused+ * one stays out of the "hide disabled" filter so it remains recoverable.+ */+export const SystemPaused: Story = {+ args: { configs: LIFECYCLE_CONFIGS },+};diff --git a/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.tsx b/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.tsxindex 1bd97fd15193..cb7fc41d3178 100644--- a/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.tsx+++ b/products/desktop/packages/ui/src/features/scouts/components/ScoutsFleetSection.tsx@@ -9,6 +9,7 @@ import type { ScoutConfig } from "@posthog/api-client/posthog-client";import {computeFleetSummary,computeScoutRollups,+ deriveScoutLifecycle,getScoutOrigin,listScoutCreatorOptions,type ScoutCreatorIndex,@@ -103,6 +104,9 @@ export function ScoutsFleetSection() {}const enabledCount = configs.filter((config) => config.enabled).length;+ const systemPausedCount = configs.filter(+ (config) => deriveScoutLifecycle(config).isSystemPaused,+ ).length;return (<Flex direction="column" gap="3">@@ -121,6 +125,11 @@ export function ScoutsFleetSection() {</Text><Text className="text-[12px] text-gray-11 leading-snug">{enabledCount} of {configs.length} scouts enabled+ {systemPausedCount > 0 ? (+ <span className="text-(--red-11)">+ {` · ${systemPausedCount} auto-paused`}+ </span>+ ) : null}{lastRunAt ? (<>{" · last dispatched "}@@ -221,7 +230,13 @@ export function ScoutsFleetListView({const visibleConfigs = useMemo(() => {let sorted = sortConfigsForDisplay(configs);if (hideDisabled) {- sorted = sorted.filter((config) => config.enabled);+ // "Disabled" means the scouts a person switched off. The ones PostHog+ // switched off are exactly what this view has to keep in front of them,+ // since switching them back on is the only way to recover them.+ sorted = sorted.filter(+ (config) =>+ config.enabled || deriveScoutLifecycle(config).isSystemPaused,+ );}if (creatorKey && creators) {sorted = sorted.filter(@@ -251,6 +266,18 @@ export function ScoutsFleetListView({· {scoutRunsWindowLabel(runsWindow)}</span></Text>+ {/* Auto-paused scouts sink below the enabled ones and vanish entirely+ under "Hide disabled", so the count has to lead here. */}+ {summary.systemPausedCount > 0 ? (+ <span className="whitespace-nowrap text-(--red-11) text-[12.5px]">+ {summary.systemPausedCount} auto-paused+ </span>+ ) : null}+ {summary.pausingSoonCount > 0 ? (+ <span className="whitespace-nowrap text-(--amber-11) text-[12.5px]">+ {summary.pausingSoonCount} pausing soon+ </span>+ ) : null}<span className="flex-1" />{creatorOptions.length > 0 ? (<Flex align="center" gap="2">diff --git a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigMutations.ts b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigMutations.tsindex dcd742e2e3b3..e628797aa570 100644--- a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigMutations.ts+++ b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigMutations.ts@@ -13,9 +13,15 @@ export interface ScoutConfigUpdate {enabled?: boolean;emit?: boolean;run_interval_minutes?: number;+ auto_pause_exempt?: boolean;}-const CONFIG_SETTINGS = ["enabled", "emit", "run_interval_minutes"] as const;+const CONFIG_SETTINGS = [+ "enabled",+ "emit",+ "run_interval_minutes",+ "auto_pause_exempt",+] as const;function trackConfigChange(previousConfig: ScoutConfig | undefined,@@ -31,7 +37,10 @@ function trackConfigChange(scout_origin: getScoutOrigin(previousConfig),setting,new_value: newValue,- old_value: previousConfig[setting],+ // Explicit null, not undefined: `auto_pause_exempt` is optional, and the+ // cloud client normalizes an unknown prior value to null. Undefined would+ // drop the key on serialization and split the two clients' event shape.+ old_value: previousConfig[setting] ?? null,success,});}diff --git a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigs.ts b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigs.tsindex 2f96fe22b3a8..9a2577cc8ba7 100644--- a/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigs.ts+++ b/products/desktop/packages/ui/src/features/scouts/hooks/useScoutConfigs.ts@@ -9,6 +9,9 @@ export function useScoutConfigs() {scoutQueryKeys.configs(projectId),(client) =>projectId ? client.listScoutConfigs(projectId) : Promise.resolve([]),- { enabled: !!projectId, staleTime: 30_000 },+ // Polled like the sibling runs query: the inactivity sweep and the failure+ // breaker move `status` with no client involvement, so a fleet page left+ // open would otherwise show a stale lifecycle until it regained focus.+ { enabled: !!projectId, staleTime: 30_000, refetchInterval: 60_000 },);}