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.

fix(signals): add run toggles to scout settings (#88605)

ella-c765eb5e003ec
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ee809866fc07..337f0f0f8c8d 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6800,6 +6800,18 @@ snapshots:
hash: v1.k794b7964.570e5dddd645996b94ff94b2c563b32ced3793db3ab5ccf360d16126af3b9a0b.WC_VEZ1N_iX-o4r11w15QWfD8Nzo1gFerTznKiaIX84
scenes-app-inbox-scene--self-driving-verdict-pending--light:
hash: v1.k794b7964.1d230f03b5a074e0816ee4c5dd1b4591cfdf86bb602971a6233019985f1c2677.h7Zlyp6gh4AnCQRve-W4zeSDnhAhhqVM1FIqiYN1gNA
+ scenes-app-inbox-scoutconfigform--disabled--dark:
+ hash: v1.k794b7964.c7ec994ac1d65f711be7805c9cae7e3db5c8846f859c77f565faa24618b3b5a2.oDVuzPoCmul8km-CQhaZ7ZwFSLfob_HQTpzZSXkGtgs
+ scenes-app-inbox-scoutconfigform--disabled--light:
+ hash: v1.k794b7964.86ae13cc6c174ff7be406e2a458b0e130e0da95a13908a13b1e4d2f354bdfeda.Wd-vAysy8wGyYzR4n0JuLx1mDjR_iMlOBOg6naT4m8E
+ scenes-app-inbox-scoutconfigform--dry-run--dark:
+ hash: v1.k794b7964.c0899205490439c88e086e5a9dacea08bb3434456ed926ab4479f5221b408fa9.eZWbRAQHY0eyNbx503YAvE7QAcBQntKlka4Nzo7MG_k
+ scenes-app-inbox-scoutconfigform--dry-run--light:
+ hash: v1.k794b7964.4a01a0a88d4fc031b44960d52c93a1dfa2ad6a10d68661850444ce496d744298.cjLEjfbtQYJAT5zbHLBkOADZ3RkaRPGukRCG781nVoQ
+ scenes-app-inbox-scoutconfigform--live--dark:
+ hash: v1.k794b7964.462c4cbfe7592968d9c82b2fd69ef07735ba8ced891c34a9d9d1d0e3bc4bf776.MG5RQ1DeROS8UiVEL_hsGNf2stSlsTAwQp0MZcwn5Mk
+ scenes-app-inbox-scoutconfigform--live--light:
+ hash: v1.k794b7964.c246f46b27e1d29ba3b29d3272ccc6e71b03cfc34f167d1de8985ebc3795e2b7.2Us1Q6Li99J0AJ5xjFUCTqtLC-WDO0yOUb_CbLsaPJM
scenes-app-inbox-scoutmcpserverspicker--create-dialog-variant--dark:
hash: v1.k794b7964.afe2203f4dd53373a3203fcfa611b5b65555341bdc2fc7fd73c15c2d83914600.O4kSRnOgICuQDkyD2HJCwBXdzE-KwsfzWT98nm43_5A
scenes-app-inbox-scoutmcpserverspicker--create-dialog-variant--light:
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.stories.tsx
new file mode 100644
index 000000000000..2085cea358af
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.stories.tsx
@@ -0,0 +1,51 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { useState } from 'react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+
+import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'
+
+import { mockScoutConfigs } from '../../../__mocks__/scoutConfigs'
+import { ScoutConfigForm } from './ScoutConfigControls'
+
+// The settings form a scout's gear opens. Use this to check that every row reads as the same kind of
+// row, and that the mode, schedule, and network controls line up down the right edge.
+
+function EditableConfigForm({ initialConfig }: { initialConfig: SignalScoutConfig }): JSX.Element {
+ const [config, setConfig] = useState(initialConfig)
+
+ return (
+ <div className="w-[520px] p-2">
+ <ScoutConfigForm
+ config={config}
+ onUpdate={(_, updates) => setConfig((current) => ({ ...current, ...updates }))}
+ />
+ </div>
+ )
+}
+
+const meta: Meta<typeof ScoutConfigForm> = {
+ title: 'Scenes-App/Inbox/ScoutConfigForm',
+ component: ScoutConfigForm,
+ parameters: {
+ featureFlags: { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true },
+ },
+}
+export default meta
+
+type Story = StoryObj<typeof ScoutConfigForm>
+
+export const Live: Story = {
+ render: () => <EditableConfigForm initialConfig={mockScoutConfigs[0]} />,
+}
+
+// Dry run: the scout still runs on its schedule, its findings just never reach the inbox.
+export const DryRun: Story = {
+ render: () => <EditableConfigForm initialConfig={{ ...mockScoutConfigs[0], emit: false }} />,
+}
+
+// A scout that is switched off. Everything the next run would use stays editable; only the controls
+// that would change that run's timing lock.
+export const Disabled: Story = {
+ render: () => <EditableConfigForm initialConfig={{ ...mockScoutConfigs[0], enabled: false }} />,
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
index efdb4579a41a..d0c57cae9816 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx
@@ -1,4 +1,6 @@
-import { fireEvent, render } from '@testing-library/react'
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render } from '@testing-library/react'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -41,6 +43,35 @@ describe('ScoutConfigForm', () => {
})
beforeEach(() => initKeaTests())
+ afterEach(cleanup)
+
+ const emitSwitchLabel = 'signals-scout-general write signals to the inbox'
+
+ it.each([
+ ['live', true, false],
+ ['dry run', false, true],
+ ])('moves a %s scout to the other posture', (_posture, emit, expectedPatch) => {
+ const onUpdate = jest.fn()
+ const { getByLabelText } = render(<ScoutConfigForm config={{ ...config, emit }} onUpdate={onUpdate} />)
+
+ const emitSwitch = getByLabelText(emitSwitchLabel)
+ expect(emitSwitch).toHaveAttribute('aria-checked', String(emit))
+
+ fireEvent.click(emitSwitch)
+
+ expect(onUpdate).toHaveBeenCalledWith('config-1', { emit: expectedPatch })
+ })
+
+ // Settable while the scout is off, so a dry-run posture can be chosen before the enable
+ // sends the first run out.
+ it('leaves the dry-run switch editable while the scout is disabled', () => {
+ const onUpdate = jest.fn()
+ const { getByLabelText } = render(
+ <ScoutConfigForm config={{ ...config, enabled: false }} onUpdate={onUpdate} />
+ )
+
+ expect(getByLabelText(emitSwitchLabel)).not.toBeDisabled()
+ })
it('saves the daily run time on blur and never clears the schedule from an empty input', () => {
const onUpdate = jest.fn()
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
index f78125a22e94..d2bb183abac7 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.tsx
@@ -82,6 +82,25 @@ export function ScoutConfigForm({
return (
<div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-4">
+ <div className="flex flex-col min-w-0">
+ <span className="text-xs text-default">Write signals to the inbox</span>
+ <span className="text-[11.5px] text-muted">
+ Turn this off for a dry run. The scout still runs on its schedule, and its signals stay out of
+ the inbox.
+ </span>
+ </div>
+ <LemonSwitch
+ size="small"
+ checked={config.emit}
+ // Editable while the scout is disabled, like network access: a newly enabled
+ // scout with no prior run is immediately due, so the dry-run posture must be
+ // settable BEFORE the enable or the first run reaches the inbox anyway.
+ disabledReason={updating ? 'Saving scout settings' : undefined}
+ onChange={(checked) => onUpdate(config.id, { emit: checked })}
+ aria-label={`${config.skill_name} write signals to the inbox`}
+ />
+ </div>
<div className="flex items-center justify-between gap-4">
<div className="flex flex-col min-w-0">
<span className="text-xs text-default">Schedule</span>
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
index 7081eb7d3f32..b9f4929da052 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
@@ -218,10 +218,14 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
label="Enable this scout"
bordered
fullWidth
+ disabledReason={isScoutCreateFormSubmitting ? 'Creating the scout' : undefined}
/>
)}
</LemonField>
- <LemonField name="config.emit">
+ <LemonField
+ name="config.emit"
+ help="Turn this off for a dry run. The scout still runs on its schedule, and its signals stay out of the inbox."
+ >
{({ value, onChange }) => (
<LemonSwitch
checked={value}
@@ -229,12 +233,10 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
label="Write signals to the inbox"
bordered
fullWidth
+ disabledReason={isScoutCreateFormSubmitting ? 'Creating the scout' : undefined}
/>
)}
</LemonField>
- <span className="text-xs text-muted">
- Turn off inbox signals to run the scout in dry-run mode.
- </span>
<LemonField name="config.output_destinations">
{({ value, onChange }) => (
<ScoutSlackDestination