Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): add delete scout to fleet config view (#67445)

Andrew Maguire2f117b2fe82f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index bbbdf3cc5840..39098ab12919 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6421,9 +6421,9 @@ snapshots:
scenes-app-posthog-ai--thread-with-text-and-number-form--light:
hash: v1.k794b7964.e8fd98a5c3f51f43002ef87a8ef565281f93d65a9f1d538f99d2f2990d832db1.AIHu18GX5HpXLmggZt4MYTIsPdsRfcJESTXHc9gAOhk
scenes-app-posthog-ai--welcome--dark:
- hash: v1.k794b7964.920dad83fa1f3d7147242cfaf9d8f2e1de3d68372c3f9fb4b4a72c69814e3b24.ScvL64se8JAosuryN1cJ2ms5o2QLwar9LpgtdOZTf0o
+ hash: v1.k794b7964.425023dec85659e7397acb8edd3ce6b6d40bcb0111fc887e9850e2c7c9918947.z8TdxDh4MeDtiHLnfom1X8PrMxiEKQrvsz2wJuG_fz8
scenes-app-posthog-ai--welcome--light:
- hash: v1.k794b7964.0e47e924658a5d313efdd5b6532466875af1ac283abdd95b7fcb49247c82d387.gPFlQcvApVhjYdZJYdHa2AV9cy9kZjZCxtPFw92jyAo
+ hash: v1.k794b7964.2c9d935a1a827721fdd6a438b5fbc114e3e4d7fc90cbe21f5fa39732eaca62de.w17zb9WLWZpRX6-z-9qtIVWhpFBmr5citkC1GBOGiew
scenes-app-posthog-ai--welcome-feature-preview-auto-enrolled--dark:
hash: v1.k794b7964.25f5dfa1383bd8b2cbd9232ea5a7e6ac9ed5bd63058e53e79e087dfe6d80035f.G3zkjSmmWsHNTiKPBL8XGkvZzxZ9-d7KYVo0MgzSnjg
scenes-app-posthog-ai--welcome-feature-preview-auto-enrolled--light:
@@ -6793,25 +6793,25 @@ snapshots:
scenes-app-tasks--empty--light:
hash: v1.k794b7964.0f6cd8ff0b64d8ab73e1b52609e2d6f87831dad09bc8cef9e70cb1ad02721572.S-jlFvTMeb5xsf9f91lZsEXJikHQglCzmPq-dtm5U4g
scenes-app-tasks--list-load-error--dark:
- hash: v1.k794b7964.9566449737abdd51fde7d6056dc2aba9dfbc52df4e7d9ec026971e82adab1bfa.9mb2jTWhyqCPIfIPMjs6zvJegIBX1y5G9ArWSVOQFo4
+ hash: v1.k794b7964.368745fe9fffe686e48055d5bcb845f1a237f9983c75075693c163ff7633d142.pstQDOZm19Cp-gF_HAIj_5i21EL3ZUNyjn0WexIcQbQ
scenes-app-tasks--list-load-error--light:
- hash: v1.k794b7964.6206b9e3ba160ae9e49dd71ce75498ce51f900728b362140b02b15d4c75391fa.ApdMVwb1IsI_tfNk_a10Btf7Zm0LfVFFEFQtEGAkexg
+ hash: v1.k794b7964.58b8418673007af44903c9848fb32f761bfdb496d53ff17c3730195aa46a7bf0.fZTJvXJYQgnGQ7BFZ8Dp-FoCR_TCPs8CawhyPcTnXmk
scenes-app-tasks--list-with-composer--dark:
hash: v1.k794b7964.bf8b6abf4b61c5a5a753a4a4b65a68a826083843c72ce5c84874a5f8b1a351f0.8_E1dRIEkR4aBflwi38DbZ24Bb-O8JlxNhV7r0ftFCM
scenes-app-tasks--list-with-composer--light:
hash: v1.k794b7964.645d8fb5c766ad02d84cde4622a5bbe7234addd10bcc9ee7c228cd522fc44527.LY9de-ZX-ogFSxm5PbmeU4XHXNOlvoXQoxXCHUqszVM
scenes-app-tasks--loading--dark:
- hash: v1.k794b7964.d7ce35a82755d07fd7087938512cd8a694db44c364fe1883f680e730c93628c1.ZdLszvghuPSGC1-UvSkNu-LIBHR5jm-Z9kNJ7Hvq_fo
+ hash: v1.k794b7964.3341ca85b5e619070d96ca158c9ae1b7d9021e87bf54959861e8415d4abefc7a.h7Khw0d4gSHdl6BS0te0J8gJCRgB7f4Zm17DmEg3MC8
scenes-app-tasks--loading--light:
- hash: v1.k794b7964.4cebea368622b670c2c2105bb3dc3383bff632b61bfdb7539d7cdbf8a421333b.lJ4-GQEvgF9KKeKy5HaJN8rarvRfHbBuEqqw832euuI
+ hash: v1.k794b7964.368255ea27ffc7a362b0d6bbbefe85ea3f4fd4ed95b8092a90091087d62bd364.wbuwRgxSpLuh0CPLFt-KtqSXz7zLS1i4OeyR0MqY3xY
scenes-app-tasks--mobile-list--dark:
hash: v1.k794b7964.e65c5e289cbb347ed1cc035d3a381c56503b67ef643db47dd2e02f32fac047a8.aNQOxj2nwQyFuzC8E3a1YGPFtaxje7hw1Eb7HbBLyfQ
scenes-app-tasks--mobile-list--light:
hash: v1.k794b7964.a42e7297c99d46bf03e8ba9c7576b164e120a41c914d1d52824823140b8fae92.nCFkmftkVPQYI7UqGBF84D6YQ52LTeSiWkz6w_K_YWM
scenes-app-tasks--mobile-new-task--dark:
- hash: v1.k794b7964.04a9d2be080fb6586920169a05f14d1ee3fecab3a7bff2b54991540eeda24903.i5EHYx6N-QK-ooccoLVdyP0zpRT4Y7amJnLbP-6kXNg
+ hash: v1.k794b7964.de22e10e282dd787afc1fc4784d1aef6064b32b7c3bed6b3bced8ba776264cf2.UCqKfpWcRlmvwmvML2DjdyVQCwj3zUZpXlKA8wxMgVs
scenes-app-tasks--mobile-new-task--light:
- hash: v1.k794b7964.365b32bd25aaa19ef2b7e35db06b67fe57d09ce1f39890b4201080345cbc4fb3.CuVZNBxkDEtv9uVsE3Q1hQslA4Tqdut3NuB3xzATMYM
+ hash: v1.k794b7964.cf669044c3c0e2b6d870e588a22f58be3032bec6d90a2c1c3b1ee1412a491661.3mNJ_P0G8pSfhi3oEkjsTKKG7wVSFB9jdY7ujjDXj7k
scenes-app-tasks--mobile-task-selected--dark:
hash: v1.k794b7964.7a885468ce6eee10b0835ef0b76f5c5dd45d35d90273d972bcb8023d9c943b62.4O4SeGjvj3rHSH0F5LinWCoJv7oGd0UgG39TRxQQeEo
scenes-app-tasks--mobile-task-selected--light:
@@ -6821,9 +6821,9 @@ snapshots:
scenes-app-tasks--new-task--light:
hash: v1.k794b7964.25133a1f325d13995ce3308d3373d31db214be56bc0ba1a7165f1351cc57463f.rw15Q9WFmYC5WA1DkSKApJMz0Zf0VmfsPXZilsqqZuw
scenes-app-tasks--new-task-with-repository--dark:
- hash: v1.k794b7964.0b91a374f31195a572e4dc9ba06538fb24aa469715053646c59d6dcf55ce9d0a.mPiBMxgeYR2VFvWiyCVIqAffHpa1eWlmq1j6CelnInM
+ hash: v1.k794b7964.007045013ea7ca323a854ac898f357959215851601122652edd8b66f5522b748.FCfJRPZKDXGgNO5QthA84KFRTui_bwjO2sF69KQTeqQ
scenes-app-tasks--new-task-with-repository--light:
- hash: v1.k794b7964.5e2f1107fe1ffce2d4c0189c839624e05c0c5df50011769bac86eb17e9476422.EUn4T_Fj1IbtANyMVPjdzJiKLWfZmI4Yoz2bnzPVdhU
+ hash: v1.k794b7964.85b8d80bed5a3f681769896383446146a143df4724ecf1e1feda295fd3e9a0ee.-nwx_seZR7tyvrewZFbxcgGWYpGxPSVR-xiSBkE0UaI
scenes-app-tasks--task-detail-loading--dark:
hash: v1.k794b7964.a05d0af03f7eaeb33e1c22ccae2d417241ef3cb997cb4675ac5f8efe701a7c74.Fn6G0_Zzcycs9ikkn7R1jXhXk0czUQGbcdU0X58F8Jo
scenes-app-tasks--task-detail-loading--light:
@@ -6973,9 +6973,9 @@ snapshots:
scenes-other-billing--billing-purchase-credits-modal--light:
hash: v1.k794b7964.b5764f97504ff981a389efeec44dd4d86929f243fa3b99ab0516eb4bcddac2ad.k8EFOT3n4tKgKEC5-ciAKGmKQX4emuSKvVCOkG8TU7g
scenes-other-billing--billing-unsubscribe-modal--dark:
- hash: v1.k794b7964.4bd0c0e3d5ded847c5e6b6a5d66ed812b313cb3c00f9d0afe9c64f3b438a7ef3.DeUXxHaBSk_YkE79Jf9lqQDkidPGocuooFHwz1dYWSU
+ hash: v1.k794b7964.4485466b38421f57e913dee9aa38bdec44e2a4545ab87c5e84e25116cc0024df.mEoCNNs0aT_srYooDJg4pKAUNjcSdbvYyvhkdpeh2uc
scenes-other-billing--billing-unsubscribe-modal--light:
- hash: v1.k794b7964.52306488be9b41efde2a9d5bb3c3d610b1603f4488722e48e5feeec32961b3c2.1vRvz6JB9ihWV0Px1PePgfqQh76cuUw9JCnIiXYbPbA
+ hash: v1.k794b7964.a2bfac76f992d3b0bac3fb6f08c8039f6011ad028c4f41e9001ccdec5e31636d.yq8TXP2L8KHkon4UwKHGYPPeCwbZzZhkYqJDc2N8xss
scenes-other-billing--billing-with-credit-cta--dark:
hash: v1.k794b7964.959bdf4d047f8c5f1af0453848d5632b2dfcaaab80fe6d9cb3aa58dcb08fe760.vLS-1KEmdcBoEcV4l87e7jlR2VMAMvykgIITrkvqLCM
scenes-other-billing--billing-with-credit-cta--light:
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 8cfba1e5a31c..7c04bf46a879 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -5258,6 +5258,9 @@ const api = {
async update(id: string, data: SignalScoutConfigUpdate): Promise<SignalScoutConfig> {
return await new ApiRequest().signalScoutConfig(id).update({ data })
},
+ async delete(id: string): Promise<void> {
+ return await new ApiRequest().signalScoutConfig(id).delete()
+ },
},
},
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
index df8f7f846597..88fd3ef1231c 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
@@ -1,10 +1,9 @@
import { LemonTag, Tooltip } from '@posthog/lemon-ui'
-import { getScoutOrigin } from '../../../utils/scoutRunsWindow'
+import { ScoutOrigin } from '../../../types'
/** Canonical (PostHog-maintained) vs Custom (team-authored) scout badge. */
-export function ScoutOriginBadge({ skillName }: { skillName: string }): JSX.Element {
- const origin = getScoutOrigin(skillName)
+export function ScoutOriginBadge({ origin }: { origin: ScoutOrigin }): JSX.Element {
return (
<Tooltip
title={
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
index fd2e6c7deea9..89f82f9bedce 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
@@ -1,13 +1,20 @@
-import { LemonSelect, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
+import { IconTrash } from '@posthog/icons'
+import { LemonButton, LemonDialog, LemonSelect, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
import { SignalScoutConfig, SignalScoutConfigUpdate } from '../../../types'
-import { formatRunInterval, RUN_INTERVAL_OPTIONS } from '../../../utils/scoutRunsWindow'
+import { formatRunInterval, prettifyScoutSkillName, RUN_INTERVAL_OPTIONS } from '../../../utils/scoutRunsWindow'
interface ScoutConfigControlsProps {
config: SignalScoutConfig
onUpdate: (configId: string, updates: SignalScoutConfigUpdate) => void
}
+interface ScoutConfigFormProps extends ScoutConfigControlsProps {
+ onDelete?: (configId: string) => void
+ /** True while this scout's delete request is in flight — disables the delete button. */
+ deleting?: boolean
+}
+
function intervalOptions(config: SignalScoutConfig): { value: string; label: string }[] {
const options = RUN_INTERVAL_OPTIONS.map((option) => ({
value: String(option.minutes),
@@ -42,7 +49,7 @@ export function ScoutEnabledSwitch({ config, onUpdate }: ScoutConfigControlsProp
* Labeled settings form for one scout, shown when a fleet row's gear is toggled
* open. Everything except enablement, which stays on the row.
*/
-export function ScoutConfigForm({ config, onUpdate }: ScoutConfigControlsProps): JSX.Element {
+export function ScoutConfigForm({ config, onUpdate, onDelete, deleting }: ScoutConfigFormProps): JSX.Element {
return (
<div className="flex flex-col gap-2">
<div className="flex items-center justify-between gap-4">
@@ -59,6 +66,51 @@ export function ScoutConfigForm({ config, onUpdate }: ScoutConfigControlsProps):
onChange={(value) => onUpdate(config.id, { run_interval_minutes: Number(value) })}
/>
</div>
+ {/* Only custom scouts are deletable. A canonical scout would be re-seeded from disk after
+ deletion (and couldn't be re-added from the UI), so its terminal action stays disable. */}
+ {onDelete && config.scout_origin === 'custom' ? (
+ <div className="flex items-center justify-between gap-4 border-t border-primary pt-2">
+ <div className="flex flex-col min-w-0">
+ <span className="text-xs text-default">Delete scout</span>
+ <span className="text-[11.5px] text-muted">Permanently deletes the scout and its skill</span>
+ </div>
+ <LemonButton
+ size="small"
+ status="danger"
+ icon={<IconTrash />}
+ loading={deleting}
+ disabledReason={deleting ? 'Deleting…' : undefined}
+ onClick={() => confirmDeleteScout(config, onDelete)}
+ >
+ Delete
+ </LemonButton>
+ </div>
+ ) : null}
</div>
)
}
+
+/**
+ * Confirm-then-delete for a custom scout. Deletion archives the scout's skill (the permanent off
+ * switch — the coordinator won't re-seed a tombstoned skill or re-create its config) and removes
+ * its config. Irreversible, so the dialog steers users toward disable when they only want a pause.
+ */
+function confirmDeleteScout(config: SignalScoutConfig, onDelete: (configId: string) => void): void {
+ const displayName = prettifyScoutSkillName(config.skill_name)
+ LemonDialog.open({
+ title: `Delete the ${displayName} scout?`,
+ description: (
+ <span>
+ This archives the <span className="font-mono text-[11px]">{config.skill_name}</span> skill and removes
+ its config. The scout stops running and won't come back — this can't be undone. To pause a scout without
+ deleting it, disable it instead.
+ </span>
+ ),
+ primaryButton: {
+ children: 'Delete',
+ status: 'danger',
+ onClick: () => onDelete(config.id),
+ },
+ secondaryButton: { children: 'Cancel' },
+ })
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
index 3775a7219258..8cc72f6f8a72 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
@@ -23,11 +23,18 @@ export function ScoutRowCard({
config,
rollup,
onUpdate,
+ onDelete,
+ deleting = false,
asHeader = false,
}: {
config: SignalScoutConfig
rollup: ScoutRollup | undefined
onUpdate: (configId: string, updates: SignalScoutConfigUpdate) => void
+ /** Delete the scout (archives its skill + removes the config). Omitted where deletion isn't
+ * offered, e.g. the detail header; the form also hides it for canonical scouts. */
+ onDelete?: (configId: string) => void
+ /** True while this scout's delete request is in flight — disables the delete button. */
+ deleting?: boolean
/** When rendered as the scout detail header the name is plain text (the row IS the page). */
asHeader?: boolean
}): JSX.Element {
@@ -91,7 +98,7 @@ export function ScoutRowCard({
<IconArrowUpRight className="size-3.5" />
</Link>
</Tooltip>
- <ScoutOriginBadge skillName={config.skill_name} />
+ <ScoutOriginBadge origin={config.scout_origin} />
</div>
</div>
<div className="flex items-center gap-1 whitespace-nowrap text-[11px] text-muted">
@@ -121,7 +128,7 @@ export function ScoutRowCard({
</div>
{settingsOpen ? (
<div className="mt-3 border-t border-primary pt-3">
- <ScoutConfigForm config={config} onUpdate={onUpdate} />
+ <ScoutConfigForm config={config} onUpdate={onUpdate} onDelete={onDelete} deleting={deleting} />
</div>
) : null}
</div>
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
index cbc485cc4d2f..62b223aa8e2e 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
@@ -160,8 +160,8 @@ function FleetStatsHeader(): JSX.Element {
}
function ScoutsFleetList(): JSX.Element {
- const { visibleConfigs, rollups, hideDisabled } = useValues(scoutFleetLogic)
- const { setHideDisabled, updateScoutConfig } = useActions(scoutFleetLogic)
+ const { visibleConfigs, rollups, hideDisabled, deletingScoutIds } = useValues(scoutFleetLogic)
+ const { setHideDisabled, updateScoutConfig, deleteScout } = useActions(scoutFleetLogic)
return (
<div className="flex flex-col gap-3">
@@ -184,6 +184,8 @@ function ScoutsFleetList(): JSX.Element {
config={config}
rollup={rollups.get(config.skill_name)}
onUpdate={updateScoutConfig}
+ onDelete={deleteScout}
+ deleting={deletingScoutIds.includes(config.id)}
/>
))}
</div>
diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
index bdc4febbe342..f4d785cb1d2a 100644
--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
@@ -12,13 +12,14 @@ import { urls } from 'scenes/urls'
import { OriginProduct } from 'products/posthog_ai/frontend/types/taskTypes'
import { signalsScoutMetadataGet, signalsScoutRunsFindingsSummary } from 'products/signals/frontend/generated/api'
import type { FleetFindingsSummaryApi, ScoutMetadataApi } from 'products/signals/frontend/generated/api.schemas'
+import { llmSkillsNameArchiveCreate } from 'products/skills/frontend/generated/api'
import { SignalScoutConfig, SignalScoutConfigUpdate, SignalScoutRunSummary } from '../types'
import {
computeFleetSummary,
computeScoutRollups,
FleetSummary,
- getScoutOrigin,
+ prettifyScoutSkillName,
SCOUT_RUNS_WINDOW_HOURS,
ScoutRollup,
sortConfigsForDisplay,
@@ -49,6 +50,9 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
actions({
updateScoutConfig: (configId: string, updates: SignalScoutConfigUpdate) => ({ configId, updates }),
patchScoutConfigLocally: (configId: string, updates: SignalScoutConfigUpdate) => ({ configId, updates }),
+ deleteScout: (configId: string) => ({ configId }),
+ deleteScoutFinished: (configId: string) => ({ configId }),
+ removeScoutConfigLocally: (configId: string) => ({ configId }),
setHideDisabled: (hideDisabled: boolean) => ({ hideDisabled }),
setExpanded: (expanded: boolean) => ({ expanded }),
// Started/stopped by the fleet-list component so the always-mounted setup widget
@@ -188,6 +192,18 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
// Optimistic patch; the listener reconciles against the server response.
patchScoutConfigLocally: (state, { configId, updates }) =>
state?.map((config) => (config.id === configId ? { ...config, ...updates } : config)) ?? state,
+ // Drop a deleted row from the list once the backend confirms removal.
+ removeScoutConfigLocally: (state, { configId }) =>
+ state?.filter((config) => config.id !== configId) ?? state,
+ },
+ ],
+ // Scouts with a delete request in flight — drives the delete button's loading/disabled state
+ // so a slow request can't be submitted twice from the still-visible row.
+ deletingScoutIds: [
+ [] as string[],
+ {
+ deleteScout: (state, { configId }) => (state.includes(configId) ? state : [...state, configId]),
+ deleteScoutFinished: (state, { configId }) => state.filter((id) => id !== configId),
},
],
// Flips true the first time the runs window loads *successfully* and stays true across the
@@ -267,8 +283,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
],
customScoutCount: [
(s) => [s.scoutConfigs],
- (scoutConfigs): number =>
- scoutConfigs?.filter((config) => getScoutOrigin(config.skill_name) === 'custom').length ?? 0,
+ (scoutConfigs): number => scoutConfigs?.filter((config) => config.scout_origin === 'custom').length ?? 0,
],
}),
@@ -288,6 +303,66 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
lemonToast.error(error?.detail || error?.message || 'Failed to update scout config')
}
},
+ deleteScout: async ({ configId }) => {
+ // The reducer above already flags this id, but that value is reactive (for the button)
+ // and can't tell a fresh submit from a duplicate. The cache Set is the non-reactive guard:
+ // a second submit while the first is in flight bails before issuing another request.
+ const inFlight: Set<string> = (cache.deletingScoutIds ??= new Set())
+ if (inFlight.has(configId)) {
+ return
+ }
+ inFlight.add(configId)
+ try {
+ const config = values.scoutConfigs?.find((c) => c.id === configId)
+ if (!config) {
+ return
+ }
+ const displayName = prettifyScoutSkillName(config.skill_name)
+ // Scout skills are seeded under the canonical (parent/root) team, and the coordinator's
+ // `register_missing_configs` only scans skill rows there — so archive against the canonical
+ // project id, not the raw child-environment team id. Archiving the child team would 404 (the
+ // skill lives on the parent), get swallowed as "already archived" below, and leave a live
+ // skill the coordinator re-seeds. `currentProjectId` mirrors the backend `_canonical_team_id`
+ // (parent_team_id or team_id); it's '@current' until the team loads, which we reject.
+ const canonicalProjectId = teamLogic.values.currentProjectId
+ try {
+ // Archiving the skill is the permanent off switch: the coordinator won't re-seed a
+ // tombstoned skill or re-create its config. Only custom scouts are deletable — the UI
+ // offers canonical ones disable instead, since a deleted canonical scout can't be re-added.
+ if (config.scout_origin === 'custom') {
+ // A custom scout's config must never be dropped without first archiving its skill —
+ // otherwise the coordinator re-seeds the config and the scout runs again. If the
+ // project can't be resolved to archive, fail here instead of half-deleting (the outer
+ // catch surfaces the error and reloads, leaving the row intact).
+ if (typeof canonicalProjectId !== 'number') {
+ throw new Error('Could not resolve the active project to archive the scout')
+ }
+ try {
+ await llmSkillsNameArchiveCreate(String(canonicalProjectId), config.skill_name)
+ } catch (error: any) {
+ // Already archived (e.g. retrying after a partial failure) — fall through to
+ // clear the leftover config rather than dead-ending on a 404.
+ if (error?.status !== 404) {
+ throw error
+ }
+ }
+ }
+ await api.signalScout.configs.delete(configId)
+ // Remove only after the backend confirms — deletion is irreversible, so no optimistic
+ // drop that would have to be re-inserted (and re-sorted) on failure.
+ actions.removeScoutConfigLocally(configId)
+ lemonToast.success(`Deleted ${displayName}`)
+ } catch (error: any) {
+ lemonToast.error(error?.detail || error?.message || 'Failed to delete scout')
+ // A partial failure (skill archived but config delete failed) could desync the list
+ // from the backend — reload the truth so the row reflects reality.
+ actions.loadScoutConfigs()
+ }
+ } finally {
+ inFlight.delete(configId)
+ actions.deleteScoutFinished(configId)
+ }
+ },
startScoutChatTask: async ({ prompt, fallbackTitle, taskLabel }) => {
// Task-kickoff, mirroring inboxTaskKickoffLogic: create an auto-mode cloud
// task from a templated prompt, then navigate to it. Not a live chat.
diff --git a/frontend/src/scenes/inbox/types.ts b/frontend/src/scenes/inbox/types.ts
index 9f1f9a05b2c9..693700b04098 100644
--- a/frontend/src/scenes/inbox/types.ts
+++ b/frontend/src/scenes/inbox/types.ts
@@ -200,6 +200,9 @@ export interface SignalTeamConfig {
// ── Scouts (backend SignalScoutConfigViewSet / SignalScoutRunViewSet) ─────────
+/** Canonical (PostHog-shipped) vs custom (team-authored) scout, resolved server-side. */
+export type ScoutOrigin = 'canonical' | 'custom'
+
/** Per-(team, skill) scout config. One row per `signals-scout-*` skill. */
export interface SignalScoutConfig {
id: string
@@ -207,6 +210,8 @@ export interface SignalScoutConfig {
skill_name: string
/** What this scout investigates, sourced from the skill's `description` metadata. Empty if absent. */
description: string
+ /** Where this scout came from, resolved by the backend. Only `custom` scouts are deletable. */
+ scout_origin: ScoutOrigin
/** Whether this scout runs on its schedule. */
enabled: boolean
/** Whether the scout writes findings to the inbox. false = dry-run. */
diff --git a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts b/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
index 268c4a8b5c66..ffb4ef22dca2 100644
--- a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
+++ b/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
@@ -49,37 +49,6 @@ export function mostRecentEmittedRuns(runs: SignalScoutRunSummary[]): SignalScou
)
}
-// ── Origin classification ────────────────────────────────────────────────────
-
-/**
- * Canonical scouts shipped in the PostHog repo (products/signals/skills). The
- * configs endpoint does not yet distinguish canonical from hand-authored skills,
- * so classify by this known-name list (matches desktop `CANONICAL_SCOUT_SKILLS`).
- */
-export const CANONICAL_SCOUT_SKILLS = new Set<string>([
- 'signals-scout-general',
- 'signals-scout-anomaly-detection',
- 'signals-scout-ai-observability',
- 'signals-scout-csp-violations',
- 'signals-scout-data-pipelines',
- 'signals-scout-error-tracking',
- 'signals-scout-experiments',
- 'signals-scout-feature-flags',
- 'signals-scout-health-checks',
- 'signals-scout-logs',
- 'signals-scout-observability-gaps',
- 'signals-scout-revenue-analytics',
- 'signals-scout-session-replay',
- 'signals-scout-surveys',
- 'signals-scout-web-analytics',
-])
-
-export type ScoutOrigin = 'canonical' | 'custom'
-
-export function getScoutOrigin(skillName: string): ScoutOrigin {
- return CANONICAL_SCOUT_SKILLS.has(skillName) ? 'canonical' : 'custom'
-}
-
/** "signals-scout-error-tracking" → "Error tracking" */
export function prettifyScoutSkillName(skillName: string): string {
const cleaned = skillName