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(aio): schedule scouts with an optional cron schedule (#72731)

Radu Raicea8fd209cc2166
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 4de74c7edb74..f5df59fa250b 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -23,8 +23,6 @@ import {
SignalReportArtefact,
SignalReportArtefactResponse,
SignalReportStateRequest,
- SignalScoutConfig,
- SignalScoutConfigUpdate,
SignalScoutEmission,
SignalScoutEmissionReportLink,
SignalScoutRunSummary,
@@ -1219,17 +1217,6 @@ export class ApiRequest {
return this.signalScoutRuns(teamId).addPathComponent(id)
}
- public signalScoutConfigs(teamId?: TeamType['id']): ApiRequest {
- return this.projectsDetail(teamId)
- .addPathComponent('signals')
- .addPathComponent('scout')
- .addPathComponent('configs')
- }
-
- public signalScoutConfig(id: string, teamId?: TeamType['id']): ApiRequest {
- return this.signalScoutConfigs(teamId).addPathComponent(id)
- }
-
// # Tasks
public tasks(teamId?: TeamType['id']): ApiRequest {
return this.projectsDetail(teamId).addPathComponent('tasks')
@@ -5249,8 +5236,7 @@ const api = {
},
},
- // Scouts: scheduled agents that sweep the project and emit findings. Backend:
- // SignalScoutRunViewSet (runs) + SignalScoutConfigViewSet (configs).
+ // Scout runs still use the legacy client. Scout configs use the generated Signals client.
signalScout: {
runs: {
// Newest-first raw array (not paginated), capped at 100 server-side.
@@ -5291,18 +5277,6 @@ const api = {
.create({ data: { run_ids: runIds } })
},
},
- configs: {
- // Newest-first raw array, ordered by skill_name.
- async list(): Promise<SignalScoutConfig[]> {
- return await new ApiRequest().signalScoutConfigs().get()
- },
- 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()
- },
- },
},
signalUserAutonomy: {
diff --git a/frontend/src/lib/lemon-ui/LemonInput/LemonInput.test.tsx b/frontend/src/lib/lemon-ui/LemonInput/LemonInput.test.tsx
new file mode 100644
index 000000000000..afdceaf90911
--- /dev/null
+++ b/frontend/src/lib/lemon-ui/LemonInput/LemonInput.test.tsx
@@ -0,0 +1,22 @@
+import { fireEvent, render } from '@testing-library/react'
+
+import { LemonInput } from './LemonInput'
+
+describe('LemonInput', () => {
+ it('does not refocus the native input when it handles the click itself', () => {
+ const { container } = render(<LemonInput type="time" />)
+ const wrapper = container.querySelector<HTMLElement>('.LemonInput')
+ const input = container.querySelector<HTMLInputElement>('input')
+
+ expect(wrapper).not.toBeNull()
+ expect(input).not.toBeNull()
+
+ const focus = jest.spyOn(input!, 'focus')
+
+ fireEvent.click(input!)
+ expect(focus).not.toHaveBeenCalled()
+
+ fireEvent.click(wrapper!)
+ expect(focus).toHaveBeenCalledTimes(1)
+ })
+})
diff --git a/frontend/src/lib/lemon-ui/LemonInput/LemonInput.tsx b/frontend/src/lib/lemon-ui/LemonInput/LemonInput.tsx
index c28c1af889df..a2eaeaa43bd6 100644
--- a/frontend/src/lib/lemon-ui/LemonInput/LemonInput.tsx
+++ b/frontend/src/lib/lemon-ui/LemonInput/LemonInput.tsx
@@ -222,7 +222,14 @@ export const LemonInput = React.forwardRef<HTMLDivElement, LemonInputProps>(func
className
)}
aria-disabled={disabled || !!disabledReason}
- onClick={() => focus()}
+ onClick={(event) => {
+ // Native segmented inputs (notably `type="time"` in Safari) reset to their
+ // first segment when focused again. The input already handles its own clicks;
+ // only focus it when the surrounding input chrome was clicked.
+ if (event.target !== internalInputRef.current) {
+ focus()
+ }
+ }}
ref={ref}
>
{prefix}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
index 88fd3ef1231c..eb949b719419 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
@@ -1,9 +1,9 @@
import { LemonTag, Tooltip } from '@posthog/lemon-ui'
-import { ScoutOrigin } from '../../../types'
+import type { ScoutOriginEnumApi } from 'products/signals/frontend/generated/api.schemas'
/** Canonical (PostHog-maintained) vs Custom (team-authored) scout badge. */
-export function ScoutOriginBadge({ origin }: { origin: ScoutOrigin }): JSX.Element {
+export function ScoutOriginBadge({ origin }: { origin: ScoutOriginEnumApi }): JSX.Element {
return (
<Tooltip
title={
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx
new file mode 100644
index 000000000000..e254fa87f11b
--- /dev/null
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx
@@ -0,0 +1,54 @@
+import { fireEvent, render } from '@testing-library/react'
+
+import { initKeaTests } from '~/test/init'
+
+import type { SignalScoutConfigApi } from 'products/signals/frontend/generated/api.schemas'
+
+import { ScoutConfigForm } from './ScoutConfigControls'
+
+const config: SignalScoutConfigApi = {
+ id: 'config-1',
+ skill_name: 'signals-scout-general',
+ description: 'General scout',
+ scout_origin: 'canonical',
+ enabled: true,
+ emit: true,
+ run_interval_minutes: 1440,
+ run_cron_schedule: '0 9 * * *',
+ last_run_at: null,
+ created_at: '2026-07-21T12:00:00Z',
+}
+
+describe('ScoutConfigForm', () => {
+ beforeEach(() => initKeaTests())
+
+ it('saves the daily run time on blur and never clears the schedule from an empty input', () => {
+ const onUpdate = jest.fn()
+ const { container } = render(<ScoutConfigForm config={config} onUpdate={onUpdate} />)
+ const input = container.querySelector<HTMLInputElement>('input[type="time"]')
+
+ expect(input).not.toBeNull()
+
+ fireEvent.change(input!, { target: { value: '14:45' } })
+ expect(onUpdate).not.toHaveBeenCalled()
+
+ fireEvent.blur(input!)
+ expect(onUpdate).toHaveBeenCalledWith('config-1', { run_cron_schedule: '45 14 * * *' })
+
+ // A half-typed edit blurring empty must not silently revert the scout to its rolling
+ // interval — switching schedule mode is the select's job.
+ fireEvent.change(input!, { target: { value: '' } })
+ fireEvent.blur(input!)
+ expect(onUpdate).toHaveBeenCalledTimes(1)
+ })
+
+ it('shows an unexpressible cron as a read-only custom mode without a time picker', () => {
+ const onUpdate = jest.fn()
+ const { container, getByText } = render(
+ <ScoutConfigForm config={{ ...config, run_cron_schedule: '0 9 * * 1-5' }} onUpdate={onUpdate} />
+ )
+
+ expect(container.querySelector('input[type="time"]')).toBeNull()
+ expect(getByText('Custom (0 9 * * 1-5)')).toBeTruthy()
+ })
+})
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
index 89f82f9bedce..2b06ba4a0468 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
@@ -1,8 +1,22 @@
+import { useValues } from 'kea'
+
import { IconTrash } from '@posthog/icons'
-import { LemonButton, LemonDialog, LemonSelect, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
+import { LemonButton, LemonDialog, LemonInput, LemonSelect, LemonSwitch, Tooltip } from '@posthog/lemon-ui'
+
+import { teamLogic } from 'scenes/teamLogic'
-import { SignalScoutConfig, SignalScoutConfigUpdate } from '../../../types'
-import { formatRunInterval, prettifyScoutSkillName, RUN_INTERVAL_OPTIONS } from '../../../utils/scoutRunsWindow'
+import type {
+ PatchedSignalScoutConfigUpdateApi as SignalScoutConfigUpdate,
+ SignalScoutConfigApi as SignalScoutConfig,
+} from 'products/signals/frontend/generated/api.schemas'
+
+import {
+ dailyCronToTime,
+ formatRunInterval,
+ prettifyScoutSkillName,
+ RUN_INTERVAL_OPTIONS,
+ timeToDailyCron,
+} from '../../../utils/scoutRunsWindow'
interface ScoutConfigControlsProps {
config: SignalScoutConfig
@@ -13,9 +27,21 @@ interface ScoutConfigFormProps extends ScoutConfigControlsProps {
onDelete?: (configId: string) => void
/** True while this scout's delete request is in flight — disables the delete button. */
deleting?: boolean
+ /** True while this scout's config update request is in flight. */
+ updating?: boolean
}
-function intervalOptions(config: SignalScoutConfig): { value: string; label: string }[] {
+/** Sentinel select values for the scheduled (cron) modes — rolling options use the interval minutes. */
+const DAILY_AT_MODE = 'daily_at'
+const CUSTOM_CRON_MODE = 'custom_cron'
+const DEFAULT_DAILY_TIME = '09:00'
+
+/**
+ * The schedule is either a rolling interval OR a cron — one select models that choice.
+ * Rolling presets carry the interval minutes; "Daily at a set time" switches to a daily cron
+ * (revealing the time picker); a cron the picker can't express shows as a read-only "Custom" mode.
+ */
+function scheduleOptions(config: SignalScoutConfig, scheduleMode: string): { value: string; label: string }[] {
const options = RUN_INTERVAL_OPTIONS.map((option) => ({
value: String(option.minutes),
label: option.label,
@@ -26,11 +52,19 @@ function intervalOptions(config: SignalScoutConfig): { value: string; label: str
label: formatRunInterval(config.run_interval_minutes),
})
}
+ options.push({ value: DAILY_AT_MODE, label: 'Daily at a set time' })
+ if (scheduleMode === CUSTOM_CRON_MODE) {
+ options.push({ value: CUSTOM_CRON_MODE, label: `Custom (${config.run_cron_schedule})` })
+ }
return options
}
/** Enable/disable toggle for a scout. Lives on the row, not in the settings form. */
-export function ScoutEnabledSwitch({ config, onUpdate }: ScoutConfigControlsProps): JSX.Element {
+export function ScoutEnabledSwitch({
+ config,
+ onUpdate,
+ updating = false,
+}: ScoutConfigControlsProps & { updating?: boolean }): JSX.Element {
return (
<Tooltip title={config.enabled ? 'Disable scout' : 'Enable scout'}>
<span>
@@ -38,6 +72,7 @@ export function ScoutEnabledSwitch({ config, onUpdate }: ScoutConfigControlsProp
size="small"
checked={config.enabled}
onChange={(checked) => onUpdate(config.id, { enabled: checked })}
+ disabledReason={updating ? 'Saving scout settings' : undefined}
aria-label={`${config.skill_name} enabled`}
/>
</span>
@@ -49,23 +84,85 @@ 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, onDelete, deleting }: ScoutConfigFormProps): JSX.Element {
+export function ScoutConfigForm({
+ config,
+ onUpdate,
+ onDelete,
+ deleting,
+ updating = false,
+}: ScoutConfigFormProps): JSX.Element {
+ const { timezone: projectTimezone } = useValues(teamLogic)
+ const dailyTime = dailyCronToTime(config.run_cron_schedule)
+ const scheduleMode = config.run_cron_schedule
+ ? dailyTime !== null
+ ? DAILY_AT_MODE
+ : CUSTOM_CRON_MODE
+ : String(config.run_interval_minutes)
+ const controlsDisabledReason = updating
+ ? 'Saving scout settings'
+ : config.enabled
+ ? undefined
+ : 'Enable the scout first'
+
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">Cadence</span>
- <span className="text-[11.5px] text-muted">How often the scout is dispatched</span>
+ <span className="text-xs text-default">Schedule</span>
+ <span className="text-[11.5px] text-muted">
+ {scheduleMode === CUSTOM_CRON_MODE
+ ? 'A cron schedule set via the API'
+ : 'A rolling cadence, or a set time each day'}
+ </span>
</div>
<LemonSelect
size="small"
- value={String(config.run_interval_minutes)}
- options={intervalOptions(config)}
- disabledReason={config.enabled ? undefined : 'Enable the scout first'}
- className="w-36"
- onChange={(value) => onUpdate(config.id, { run_interval_minutes: Number(value) })}
+ value={scheduleMode}
+ options={scheduleOptions(config, scheduleMode)}
+ disabledReason={controlsDisabledReason}
+ className="w-44"
+ onChange={(value) => {
+ if (value === scheduleMode || value === CUSTOM_CRON_MODE) {
+ return
+ }
+ if (value === DAILY_AT_MODE) {
+ onUpdate(config.id, { run_cron_schedule: timeToDailyCron(dailyTime ?? DEFAULT_DAILY_TIME) })
+ return
+ }
+ // A rolling cadence replaces any cron — the schedule is one or the other.
+ onUpdate(config.id, { run_interval_minutes: Number(value), run_cron_schedule: null })
+ }}
/>
</div>
+ {scheduleMode === DAILY_AT_MODE ? (
+ <div className="flex items-center justify-between gap-4">
+ <div className="flex flex-col min-w-0">
+ <span className="text-xs text-default">Run time</span>
+ <span className="text-[11.5px] text-muted">Uses the project timezone ({projectTimezone})</span>
+ </div>
+ <LemonInput
+ key={config.run_cron_schedule ?? 'unset'}
+ type="time"
+ step={60}
+ size="small"
+ defaultValue={dailyTime ?? DEFAULT_DAILY_TIME}
+ disabledReason={controlsDisabledReason}
+ className="w-44"
+ onBlur={(event) => {
+ const value = event.currentTarget.value
+ // Empty means a half-finished edit, never "clear" — turning the
+ // schedule off is the select's job, so just fall back to the saved time.
+ if (!value) {
+ return
+ }
+ const runCronSchedule = timeToDailyCron(value)
+ if (runCronSchedule !== config.run_cron_schedule) {
+ onUpdate(config.id, { run_cron_schedule: runCronSchedule })
+ }
+ }}
+ />
+ </div>
+ ) : null}
{/* 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' ? (
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
index 0b89c574ce8a..64ea9bcf8273 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
@@ -8,8 +8,17 @@ import { LemonButton, Link, Tooltip } from '@posthog/lemon-ui'
import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
-import { SignalScoutConfig, SignalScoutConfigUpdate } from '../../../types'
-import { formatRunIntervalShort, prettifyScoutSkillName, ScoutRollup } from '../../../utils/scoutRunsWindow'
+import type {
+ PatchedSignalScoutConfigUpdateApi as SignalScoutConfigUpdate,
+ SignalScoutConfigApi as SignalScoutConfig,
+} from 'products/signals/frontend/generated/api.schemas'
+
+import {
+ dailyCronToTime,
+ formatRunIntervalShort,
+ prettifyScoutSkillName,
+ ScoutRollup,
+} from '../../../utils/scoutRunsWindow'
import { agentSetupModalLogic } from '../../shell/agentSetupModalLogic'
import { ScoutOriginBadge } from './ScoutBadges'
import { ScoutConfigForm, ScoutEnabledSwitch } from './ScoutConfigControls'
@@ -25,6 +34,7 @@ export function ScoutRowCard({
onUpdate,
onDelete,
deleting = false,
+ updating = false,
asHeader = false,
}: {
config: SignalScoutConfig
@@ -35,6 +45,8 @@ export function ScoutRowCard({
onDelete?: (configId: string) => void
/** True while this scout's delete request is in flight — disables the delete button. */
deleting?: boolean
+ /** True while this scout's config update request is in flight. */
+ updating?: boolean
/** When rendered as the scout detail header the name is plain text (the row IS the page). */
asHeader?: boolean
}): JSX.Element {
@@ -110,7 +122,14 @@ export function ScoutRowCard({
</div>
</div>
<div className="flex items-center gap-1 whitespace-nowrap text-[11px] text-muted">
- <span>{formatRunIntervalShort(config.run_interval_minutes)}</span>
+ {/* A cron schedule overrides the rolling interval, so the badge shows it instead. */}
+ <span>
+ {config.run_cron_schedule
+ ? dailyCronToTime(config.run_cron_schedule)
+ ? `daily at ${dailyCronToTime(config.run_cron_schedule)}`
+ : config.run_cron_schedule
+ : formatRunIntervalShort(config.run_interval_minutes)}
+ </span>
{rollup && rollup.emittedCount > 0 ? (
<span>· {pluralize(rollup.emittedCount, 'signal')} emitted</span>
) : null}
@@ -127,7 +146,7 @@ export function ScoutRowCard({
</div>
) : null}
<div className="flex items-center gap-2 shrink-0">
- <ScoutEnabledSwitch config={config} onUpdate={onUpdate} />
+ <ScoutEnabledSwitch config={config} onUpdate={onUpdate} updating={updating} />
<Tooltip title="Scout settings">
<LemonButton
size="small"
@@ -141,7 +160,13 @@ export function ScoutRowCard({
</div>
{settingsOpen ? (
<div className="mt-3 border-t border-primary pt-3">
- <ScoutConfigForm config={config} onUpdate={onUpdate} onDelete={onDelete} deleting={deleting} />
+ <ScoutConfigForm
+ config={config}
+ onUpdate={onUpdate}
+ onDelete={onDelete}
+ deleting={deleting}
+ updating={updating}
+ />
</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 36a4ec83e656..ae0293b0823f 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
@@ -8,9 +8,10 @@ import { TZLabel } from 'lib/components/TZLabel'
import { percentage } from 'lib/utils/numbers'
import { pluralize } from 'lib/utils/strings'
+import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'
+
import { inboxSceneLogic } from '../../../inboxSceneLogic'
import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
-import { SignalScoutConfig } from '../../../types'
import {
FleetSummary,
SCOUT_AUTHOR_PROMPT,
@@ -172,7 +173,7 @@ function FleetStatsHeader(): JSX.Element {
}
function ScoutsFleetList(): JSX.Element {
- const { visibleConfigs, rollups, hideDisabled, deletingScoutIds } = useValues(scoutFleetLogic)
+ const { visibleConfigs, rollups, hideDisabled, deletingScoutIds, updatingScoutIds } = useValues(scoutFleetLogic)
const { setHideDisabled, updateScoutConfig, deleteScout } = useActions(scoutFleetLogic)
return (
@@ -198,6 +199,7 @@ function ScoutsFleetList(): JSX.Element {
onUpdate={updateScoutConfig}
onDelete={deleteScout}
deleting={deletingScoutIds.includes(config.id)}
+ updating={updatingScoutIds.includes(config.id)}
/>
))}
</div>
diff --git a/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts
index ec857e3fa0e6..ec0c04ad0a65 100644
--- a/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts
+++ b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts
@@ -1,7 +1,9 @@
import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
+import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'
+
import { signalSourcesLogic } from '../signalSourcesLogic'
-import type { SignalScoutConfig, SignalSourceConfig } from '../types'
+import type { SignalSourceConfig } from '../types'
import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from './reportListLogic'
import { scoutFleetLogic } from './scoutFleetLogic'
@@ -166,7 +168,7 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([
(s) => [s.sourceConfigs, s.scoutConfigs],
(
sourceConfigs: import('../types').SignalSourceConfig[] | null,
- scoutConfigs: import('../types').SignalScoutConfig[] | null
+ scoutConfigs: SignalScoutConfig[] | null
): boolean => sourceConfigs !== null && scoutConfigs !== null,
],
// Counts are "resolved" once both limit=1 requests have returned, OR once neither is still
diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
index 3de9892b9ef9..fd3dc2d9fe96 100644
--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
@@ -10,11 +10,22 @@ import { teamLogic } from 'scenes/teamLogic'
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 {
+ signalsScoutConfigDestroy,
+ signalsScoutConfigList,
+ signalsScoutConfigUpdate,
+ signalsScoutMetadataGet,
+ signalsScoutRunsFindingsSummary,
+} from 'products/signals/frontend/generated/api'
+import type {
+ FleetFindingsSummaryApi,
+ PatchedSignalScoutConfigUpdateApi,
+ ScoutMetadataApi,
+ SignalScoutConfigApi,
+} from 'products/signals/frontend/generated/api.schemas'
import { llmSkillsNameArchiveCreate } from 'products/skills/frontend/generated/api'
-import { SignalScoutConfig, SignalScoutConfigUpdate, SignalScoutRunSummary } from '../types'
+import { SignalScoutRunSummary } from '../types'
import {
computeFleetSummary,
computeScoutRollups,
@@ -27,6 +38,9 @@ import {
sortConfigsForDisplay,
} from '../utils/scoutRunsWindow'
+type SignalScoutConfig = SignalScoutConfigApi
+type SignalScoutConfigUpdate = PatchedSignalScoutConfigUpdateApi
+
// Fleet runs are refetched on a slow cadence so "running now" / recent emissions
// stay live without hammering the capped runs endpoint (desktop: 60s).
const RUNS_REFETCH_INTERVAL_MS = 60_000
@@ -70,6 +84,7 @@ export interface scoutFleetLogicValues {
scoutConfigsLoading: boolean
scoutMetadata: ScoutMetadataApi | null
scoutMetadataLoading: boolean
+ updatingScoutIds: string[]
visibleConfigs: SignalScoutConfig[]
}
@@ -126,10 +141,10 @@ export interface scoutFleetLogicActions {
errorObject?: any
}
loadScoutConfigsSuccess: (
- scoutConfigs: SignalScoutConfig[],
+ scoutConfigs: SignalScoutConfigApi[],
payload?: any
) => {
- scoutConfigs: SignalScoutConfig[]
+ scoutConfigs: SignalScoutConfigApi[]
payload?: any
}
loadScoutMetadata: () => any
@@ -152,7 +167,7 @@ export interface scoutFleetLogicActions {
updates: SignalScoutConfigUpdate
) => {
configId: string
- updates: SignalScoutConfigUpdate
+ updates: PatchedSignalScoutConfigUpdateApi
}
removeScoutConfigLocally: (configId: string) => {
configId: string
@@ -189,7 +204,10 @@ export interface scoutFleetLogicActions {
updates: SignalScoutConfigUpdate
) => {
configId: string
- updates: SignalScoutConfigUpdate
+ updates: PatchedSignalScoutConfigUpdateApi
+ }
+ updateScoutConfigFinished: (configId: string) => {
+ configId: string
}
}
@@ -199,12 +217,12 @@ export interface scoutFleetLogicMeta {
scoutBannerMessage: (scoutMetadata: ScoutMetadataApi | null) => string | null
rollups: (runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }) => Map<string, ScoutRollup>
fleetSummary: (
- scoutConfigs: SignalScoutConfig[] | null,
+ scoutConfigs: SignalScoutConfigApi[] | null,
rollups: Map<string, ScoutRollup>
) => FleetSummary | null
- enabledCount: (scoutConfigs: SignalScoutConfig[] | null) => number
- lastRunAt: (scoutConfigs: SignalScoutConfig[] | null) => string | null
- visibleConfigs: (scoutConfigs: SignalScoutConfig[] | null, hideDisabled: boolean) => SignalScoutConfig[]
+ enabledCount: (scoutConfigs: SignalScoutConfigApi[] | null) => number
+ lastRunAt: (scoutConfigs: SignalScoutConfigApi[] | null) => string | null
+ visibleConfigs: (scoutConfigs: SignalScoutConfigApi[] | null, hideDisabled: boolean) => SignalScoutConfig[]
runsWindowComplete: (runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }) => boolean
emittedFindingsSummary: (fleetFindingsSummary: FleetFindingsSummaryApi | null) => {
authoredReportCount: number
@@ -213,7 +231,7 @@ export interface scoutFleetLogicMeta {
latestAt: string | null
scoutCount: number
}
- customScoutCount: (scoutConfigs: SignalScoutConfig[] | null) => number
+ customScoutCount: (scoutConfigs: SignalScoutConfigApi[] | null) => number
}
}
@@ -237,6 +255,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
actions({
updateScoutConfig: (configId: string, updates: SignalScoutConfigUpdate) => ({ configId, updates }),
+ updateScoutConfigFinished: (configId: string) => ({ configId }),
patchScoutConfigLocally: (configId: string, updates: SignalScoutConfigUpdate) => ({ configId, updates }),
deleteScout: (configId: string) => ({ configId }),
deleteScoutFinished: (configId: string) => ({ configId }),
@@ -261,7 +280,8 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
null as SignalScoutConfig[] | null,
{
loadScoutConfigs: async () => {
- return await api.signalScout.configs.list()
+ const teamId = teamLogic.values.currentTeamId
+ return teamId ? await signalsScoutConfigList(String(teamId)) : []
},
},
],
@@ -402,6 +422,13 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
deleteScoutFinished: (state, { configId }) => state.filter((id) => id !== configId),
},
],
+ updatingScoutIds: [
+ [] as string[],
+ {
+ updateScoutConfig: (state, { configId }) => (state.includes(configId) ? state : [...state, configId]),
+ updateScoutConfigFinished: (state, { configId }) => state.filter((id) => id !== configId),
+ },
+ ],
// Flips true the first time the runs window loads *successfully* and stays true across the
// 60s polls. Consumers (e.g. the scout detail Signals section) use it to tell "not loaded
// yet" from "loaded, genuinely empty" without flickering a skeleton on polls. Deliberately
@@ -500,18 +527,39 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
listeners(({ actions, values, cache }) => ({
updateScoutConfig: async ({ configId, updates }) => {
+ const inFlight: Set<string> = (cache.updatingScoutIds ??= new Set())
+ if (inFlight.has(configId)) {
+ // The controls disable while a save is in flight, so this only catches the
+ // sub-render race (e.g. blur-save then an immediate click). Say so instead of
+ // silently dropping the change.
+ lemonToast.info('Still saving the previous change. Try again in a moment.')
+ return
+ }
+ inFlight.add(configId)
const previousConfig = values.scoutConfigs?.find((config) => config.id === configId)
// Optimistic update so the toggle/select feels instant.
actions.patchScoutConfigLocally(configId, updates)
try {
- const updated = await api.signalScout.configs.update(configId, updates)
+ const teamId = teamLogic.values.currentTeamId
+ if (!teamId) {
+ throw new Error('Could not resolve the active project')
+ }
+ const updated = await signalsScoutConfigUpdate(String(teamId), configId, updates)
// Reconcile this one row against the server (preserves concurrent edits to others).
actions.patchScoutConfigLocally(configId, updated)
+ if (updates.run_cron_schedule === null && previousConfig?.run_cron_schedule) {
+ // Clearing the schedule is a valid save, not an error — but it can also come
+ // from a half-typed time input blurring empty, so never let it pass silently.
+ lemonToast.info('Scheduled run time cleared. The scout is back on its rolling interval.')
+ }
} catch (error: any) {
if (previousConfig) {
actions.patchScoutConfigLocally(configId, previousConfig)
}
lemonToast.error(error?.detail || error?.message || 'Failed to update scout config')
+ } finally {
+ inFlight.delete(configId)
+ actions.updateScoutConfigFinished(configId)
}
},
deleteScout: async ({ configId }) => {
@@ -558,7 +606,11 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
}
}
}
- await api.signalScout.configs.delete(configId)
+ const teamId = teamLogic.values.currentTeamId
+ if (!teamId) {
+ throw new Error('Could not resolve the active project')
+ }
+ await signalsScoutConfigDestroy(String(teamId), 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)
diff --git a/frontend/src/scenes/inbox/types.ts b/frontend/src/scenes/inbox/types.ts
index 140dc3ce5675..22f37fc452a4 100644
--- a/frontend/src/scenes/inbox/types.ts
+++ b/frontend/src/scenes/inbox/types.ts
@@ -290,36 +290,6 @@ export interface SignalRun {
// ── 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
- /** The `signals-scout-*` skill this config controls. Fixed at creation. */
- 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. */
- emit: boolean
- /** Minutes between runs (30–43200). */
- run_interval_minutes: number
- /** When the coordinator last dispatched this scout; null if never. */
- last_run_at: string | null
- created_at: string
-}
-
-/** Editable subset of a scout config (PATCH `signals/scout/configs/{id}`). */
-export interface SignalScoutConfigUpdate {
- enabled?: boolean
- emit?: boolean
- run_interval_minutes?: number
-}
-
/** Status from the linked TaskRun behind a scout run. */
export type SignalScoutRunStatus = 'not_started' | 'queued' | 'in_progress' | 'completed' | 'failed' | 'cancelled'
diff --git a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts b/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
index ea37def303fc..4f80f4bd8914 100644
--- a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
+++ b/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts
@@ -9,7 +9,9 @@ import { humanFriendlyDuration } from 'lib/utils/durations'
import { objectsEqual } from 'lib/utils/objects'
import { pluralize } from 'lib/utils/strings'
-import { SignalScoutConfig, SignalScoutRunStatus, SignalScoutRunSummary } from '../types'
+import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'
+
+import { SignalScoutRunStatus, SignalScoutRunSummary } from '../types'
/**
* The window every scout stat describes. The cloud runs endpoint caps each list
@@ -471,6 +473,25 @@ export function formatRunInterval(minutes: number): string {
return `Every ${minutes} minutes`
}
+/**
+ * "30 9 * * *" → "09:30" when the cron is a plain daily time (the shape the settings form
+ * writes). Anything richer (multiple slots, day-of-week restrictions) returns null and is
+ * displayed as the raw expression instead.
+ */
+export function dailyCronToTime(cron: string | null | undefined): string | null {
+ const match = cron?.trim().match(/^(\d{1,2}) (\d{1,2}) \* \* \*$/)
+ if (!match) {
+ return null
+ }
+ return `${match[2].padStart(2, '0')}:${match[1].padStart(2, '0')}`
+}
+
+/** "09:30" → "30 9 * * *" — the inverse of `dailyCronToTime` for the settings form's time picker. */
+export function timeToDailyCron(time: string): string {
+ const [hours, minutes] = time.split(':')
+ return `${Number(minutes)} ${Number(hours)} * * *`
+}
+
/** Short form for row badges: "hourly", "every 3h". */
export function formatRunIntervalShort(minutes: number): string {
if (minutes === 60) {
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index 668899ed8bb6..7b13f5af75ca 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -292,19 +292,19 @@ This shares the same activities as reingestion; the only difference is that it s
Polling coordinator for the headless **Signals agent**. Driven by a Temporal Schedule
defined in `backend/temporal/agentic/schedule.py` with `every=COORDINATOR_INTERVAL_MINUTES`
(30min) and `ScheduleOverlapPolicy.SKIP` to drop ticks rather than queue them. The tick
-is just polling granularity — each scout's own `run_interval_minutes` schedule decides
-when it actually runs.
+is just polling granularity. Each scout's own `run_interval_minutes` schedule decides
+when it actually runs, unless an optional project-local cron `run_cron_schedule` overrides it.
Defined in `backend/temporal/agentic/scout_coordinator.py`.
**Flow:**
1. Activity `fetch_enabled_signals_scout_runs_activity` bounds candidates to the teams enrolled via the `signals-scout` feature flag's JSON payload allowlist — `guaranteed_team_ids` minus `skip_team_ids`, with a hardcoded fail-safe default (`_participating_teams` → `_enrolled_team_ids`, modeled on `posthog/temporal/ai_observability/team_discovery.py`). Enrollment is flag-driven: editing the payload in the flag UI enrolls or drains a team next tick with no manual seed. For each enrolled team it calls `sync_canonical_skills(team, prune=True)` to mirror the on-disk `signals-scout-*` skills onto the team's `LLMSkill` rows, then auto-registers a `SignalScoutConfig` for any scout skill missing one (`scout_harness/config_registry.register_missing_configs`; the `scout-config-create` endpoint is the explicit upsert counterpart, so a freshly authored scout is configurable without waiting for a tick). Failures here are logged and the tick continues — a stale skill is preferable to a dead tick.
-2. For each enabled config, the coordinator computes how overdue the scout is: due when `last_run_at is None`, or `now - last_run_at >= run_interval_minutes`. There is no sampling — every due scout is planned.
+2. For each enabled config, the coordinator computes how overdue the scout is. Rolling schedules are due when `last_run_at is None`, or `now - last_run_at >= run_interval_minutes`. A config with a `run_cron_schedule` is due at the earliest unfulfilled cron slot, evaluated as wall-clock time in the project's timezone (so slots follow daylight-saving changes). It runs on the first coordinator tick at or after that slot. Saving the config after a slot has passed waits for the next slot. There is no sampling — every due scout is planned.
3. Due runs are sorted most-overdue-first and truncated at `MAX_RUNS_PER_TICK` (50 per tick; the cost bound — overflow catches up next tick). `last_run_at` is advanced via `.update()` for everything dispatched (bypasses `save()`, so the per-tick write never hits the activity log). Planned runs are re-sorted by `(team_id, skill_name)` for stable child IDs.
4. Each `PlannedRun` becomes a child `RunSignalsScoutWorkflow` started with `ParentClosePolicy.ABANDON` and a deterministic workflow ID per `(team_id, skill_name, tick_id)` so retried coordinators can't double-launch within a tick.
-The coordinator's lifetime is seconds regardless of fan-out width; throttling happens at the Temporal task queue + worker concurrency layer. Pausing a scout is `enabled=False` on its config; slowing it is a larger `run_interval_minutes` — both tunable via the `scout-config-update` MCP tool.
+The coordinator's lifetime is seconds regardless of fan-out width; throttling happens at the Temporal task queue + worker concurrency layer. Pausing a scout is `enabled=False` on its config; slowing it is a larger `run_interval_minutes`. A cron `run_cron_schedule` (e.g. `30 9 * * *`, `0 9 * * 1-5`) anchors runs to wall-clock slots instead; null preserves the rolling interval behavior. All are tunable via the `scout-config-update` MCP tool.
**Per-scout holdback (`withheld_skills`).** The same flag payload carries a hard denylist for keeping an unreleased scout off the fleet while dogfooding it on a single project. A `withheld_skills` list (a `default_team_config` fleet-wide default, overridable per team via `team_configs[<id>].withheld_skills` with replace-not-merge semantics — set `[]` to release the full fleet to one team) names scouts that, for a held-back team, are never seeded into its `LLMSkill` rows (`sync_canonical_skills` skips them), never get a `SignalScoutConfig` (`register_missing_configs` drops them from its return), and are never dispatched. Resolved by `_resolve_withheld_skills`, most-specific-layer-first like the run caps. Unlike the soft `enabled_skills` seed allowlist (a default a user can still toggle on), this is a hard gate at the seed + dispatch layer — e.g. `default_team_config.withheld_skills = ["signals-scout-error-tracking"]` with `team_configs["2"].withheld_skills = []` dogfoods error tracking on project 2 only.
@@ -528,16 +528,18 @@ Per-team configuration for which signal sources are enabled.
Per-scout binding for the headless **Signals agent**: one row per `(team, skill_name)`. The coordinator auto-creates a row when it discovers a `signals-scout-*` skill on a participating team. Changes are activity-logged (they drive spend); team-level participation is gated by the `signals-scout` flag at the coordinator, not here. See `backend/scout_harness/AGENTS.md` for the harness internals.
-| Field | Type | Description |
-| ---------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `team` | FK → Team | Owning team (`related_name="signal_scout_configs"`). `unique_together(team, skill_name)`. |
-| `skill_name` | CharField | The `signals-scout-*` skill this row controls. Auto-registered by the coordinator when it finds the skill on a participating team. |
-| `enabled` | Boolean | Per-scout switch; defaults `True`. `False` pauses just this scout. |
-| `emit` | Boolean | Dry-run vs emit. Defaults `True`: a freshly authored scout is live from its first tick. Flip to `False` for dry-run — the scout runs and logs but `emit_finding` writes nothing — to validate it on a team before its findings reach the inbox. |
-| `run_interval_minutes` | PositiveSmallInt | Minutes between runs. The coordinator dispatches when `last_run_at is None or now - last_run_at >= run_interval_minutes`. Default `1440` (daily). Validated `30 <= N <= 43200`. |
-| `last_run_at` | DateTime (nullable) | Stamped after each dispatch; drives the due-check. Excluded from activity logging (written every run). |
-| `created_by` | FK → User (nullable) | Audit pointer |
-| `enabled_by` | FK → User (nullable) | Who last flipped `enabled` — tracked because enablement drives spend. |
+| Field | Type | Description |
+| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `team` | FK → Team | Owning team (`related_name="signal_scout_configs"`). `unique_together(team, skill_name)`. |
+| `skill_name` | CharField | The `signals-scout-*` skill this row controls. Auto-registered by the coordinator when it finds the skill on a participating team. |
+| `enabled` | Boolean | Per-scout switch; defaults `True`. `False` pauses just this scout. |
+| `emit` | Boolean | Dry-run vs emit. Defaults `True`: a freshly authored scout is live from its first tick. Flip to `False` for dry-run — the scout runs and logs but `emit_finding` writes nothing — to validate it on a team before its findings reach the inbox. |
+| `run_interval_minutes` | PositiveInteger | Minutes between runs. The coordinator dispatches rolling schedules when `last_run_at is None or now - last_run_at >= run_interval_minutes`. Default `1440` (daily). Validated `30 <= N <= 43200`. |
+| `run_cron_schedule` | Char (nullable) | Optional five-field cron expression anchoring runs to wall-clock slots; takes precedence over `run_interval_minutes` when set. Interpreted in the project's timezone so daylight-saving changes are applied automatically. Occurrences must be ≥ 30 minutes apart. Null keeps the rolling interval behavior. |
+| `schedule_changed_at` | DateTime (nullable) | Stamped by the config serializers only when a schedule field actually changes. Anchors the cron due-check (with `last_run_at` / `created_at`) instead of `updated_at`, so an unrelated emit/enabled save can never defer an overdue scheduled run. |
+| `last_run_at` | DateTime (nullable) | Stamped after each dispatch; drives the due-check. Excluded from activity logging (written every run). |
+| `created_by` | FK → User (nullable) | Audit pointer |
+| `enabled_by` | FK → User (nullable) | Who last flipped `enabled` — tracked because enablement drives spend. |
### `SignalScoutRun`
@@ -1122,7 +1124,8 @@ Signal {index}:
| S3 prefix | `signals/signal_batches/` | Object storage path for signal batch files (cleaned up by S3 lifecycle policies) |
| `COORDINATOR_INTERVAL_MINUTES` | `30` | Signals agent coordinator poll cadence (Temporal schedule, `SKIP` overlap policy) |
| `MAX_RUNS_PER_TICK` | `50` | Hard cap on planned runs per coordinator tick (most-overdue-first, truncated after sort) |
-| `SignalScoutConfig.run_interval_minutes` | `1440` | Per-scout default schedule in minutes (daily); due-check, no sampling (`10`–`43200`) |
+| `SignalScoutConfig.run_interval_minutes` | `1440` | Per-scout default schedule in minutes (daily); due-check, no sampling (`30`–`43200`) |
+| `SignalScoutConfig.run_cron_schedule` | `None` | Optional project-local cron schedule (overrides the interval); null keeps the rolling interval |
| `SignalScoutConfig.emit` | `True` | Per-scout emit gate — defaults emit-on; flip to `False` for dry-run (scout runs and logs, but `emit_finding` writes nothing) |
---
diff --git a/products/signals/backend/admin.py b/products/signals/backend/admin.py
index dc3072570d5e..95b3870d420d 100644
--- a/products/signals/backend/admin.py
+++ b/products/signals/backend/admin.py
@@ -89,6 +89,7 @@ class SignalScoutConfigAdmin(admin.ModelAdmin):
"enabled",
"emit",
"run_interval_minutes",
+ "run_cron_schedule",
"last_run_at",
"updated_at",
)
diff --git a/products/signals/backend/migrations/0067_signalscoutconfig_run_cron_schedule.py b/products/signals/backend/migrations/0067_signalscoutconfig_run_cron_schedule.py
new file mode 100644
index 000000000000..cba73282c11f
--- /dev/null
+++ b/products/signals/backend/migrations/0067_signalscoutconfig_run_cron_schedule.py
@@ -0,0 +1,20 @@
+# Generated by Django 5.2.14 on 2026-07-21 18:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("signals", "0066_alter_signalsourceconfig_source_product_and_more")]
+
+ operations = [
+ migrations.AddField(
+ model_name="signalscoutconfig",
+ name="run_cron_schedule",
+ field=models.CharField(blank=True, max_length=100, null=True),
+ ),
+ migrations.AddField(
+ model_name="signalscoutconfig",
+ name="schedule_changed_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ ]
diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txt
index 46480202aef0..db8d5db9d7f3 100644
--- a/products/signals/backend/migrations/max_migration.txt
+++ b/products/signals/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0066_alter_signalsourceconfig_source_product_and_more
+0067_signalscoutconfig_run_cron_schedule
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index 047d6b7d5fff..d7e2c2ee88f6 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -1106,9 +1106,9 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
# tick. Flip to False for dry-run — the scout runs and logs but `emit_finding` writes
# nothing — to validate it on a team before its findings reach the inbox.
emit = models.BooleanField(default=True, db_default=True)
- # Minutes between runs. The coordinator dispatches this scout when
+ # Minutes between runs. Without a cron schedule, the coordinator dispatches this scout when
# `last_run_at is None or now - last_run_at >= run_interval_minutes`. Deterministic —
- # no sampling. Floor of 30 keeps one scout from monopolising the worker pool and matches the
+ # no sampling. Floor of 30 keeps one scout from monopolizing the worker pool and matches the
# tightest cadence the UI offers (RUN_INTERVAL_OPTIONS); default
# 1440 = every 24 hours. Ceiling 43200 = 30 days. `PositiveIntegerField` (int4) not
# `PositiveSmallIntegerField` (smallint, max 32767) so the documented 30-day ceiling fits.
@@ -1122,6 +1122,19 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
db_default=1440,
validators=[MinValueValidator(30), MaxValueValidator(43200)],
)
+ # Optional five-field cron expression anchoring runs to wall-clock slots (e.g. "30 9 * * *",
+ # "0 9,17 * * *", "0 9 * * 1-5"). Takes precedence over the rolling `run_interval_minutes`
+ # when set. The coordinator evaluates it in `team.timezone`, so scheduled times follow
+ # daylight-saving changes without storing a second timezone on every scout config.
+ # Serializer-validated (croniter + a 30-minute minimum gap between occurrences, matching
+ # the interval floor) — this field is only written through the config API.
+ run_cron_schedule = models.CharField(max_length=100, null=True, blank=True)
+ # Stamped by the config serializers only when a schedule field (`run_interval_minutes`,
+ # `run_cron_schedule`) actually changes. The coordinator anchors the cron due-check on this
+ # (not `updated_at`, which every save bumps) so an unrelated emit/enabled toggle can never
+ # defer an already-overdue scheduled run. Null on rows whose schedule was never edited —
+ # `created_at` anchors those.
+ schedule_changed_at = models.DateTimeField(null=True, blank=True)
# Stamped by the coordinator after each dispatch; drives the due-check. Written every
# run, so it is excluded from activity logging (see field_exclusions below).
last_run_at = models.DateTimeField(null=True, blank=True)
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.md
index e3d26d5d93fd..06fc256ef8ab 100644
--- a/products/signals/backend/scout_harness/AGENTS.md
+++ b/products/signals/backend/scout_harness/AGENTS.md
@@ -181,8 +181,9 @@ one sandbox session → zero or more emitted signals.
DB constraint is still a possible follow-up for stronger single-flight guarantees.
- The sandbox is opened with the team's MCP token plus the harness-internal tools.
The skill body is loaded into the system prompt; each scout has its own
- `SignalScoutConfig` row (keyed on `(team, skill_name)`) whose `enabled` flag and
- `run_interval_minutes` schedule the coordinator's per-scout due-check honors.
+ `SignalScoutConfig` row (keyed on `(team, skill_name)`) whose `enabled` flag,
+ `run_interval_minutes`, and optional project-local cron `run_cron_schedule` the
+ coordinator's per-scout due-check honors.
- Scout sandbox GitHub credentials are **always read-only**: the runner requests
`github_read_access` on every scout run, so provisioning mints an ephemeral downscoped
installation token (`contents`/`metadata`/`pull_requests` read, team-level installs only, never
@@ -248,9 +249,9 @@ one sandbox session → zero or more emitted signals.
- **Coordinator** — `temporal/agentic/scout_coordinator.py` and `scout_scheduler.py`.
Polls every `COORDINATOR_INTERVAL_MINUTES = 30`; dispatches each scout whose
- per-scout schedule (`run_interval_minutes`, default every 24 hours) is due, most-overdue
- first, hard cap `MAX_RUNS_PER_TICK = 50` per tick, `ScheduleOverlapPolicy.SKIP` to
- drop ticks rather than queue them.
+ per-scout schedule (`run_interval_minutes`, default every 24 hours, or an optional
+ project-local cron `run_cron_schedule` that takes precedence) is due, most-overdue first, hard cap
+ `MAX_RUNS_PER_TICK = 50` per tick, `ScheduleOverlapPolicy.SKIP` to drop ticks rather than queue them.
- **Models** — `SignalScoutConfig`, `SignalScoutRun`, `SignalScratchpad`,
`SignalProjectProfile` in `../models.py`.
- **Source variant** — `SignalSourceConfig.SourceProduct.SIGNALS_SCOUT` paired with
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 0bcdda43db1a..5ec99ce69986 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -8,6 +8,11 @@ in `scout_harness/tools/` so the wire shape and Python shape stay in lockstep.
from __future__ import annotations
+from datetime import UTC, datetime
+
+from django.utils import timezone
+
+from croniter import croniter
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema_field
from rest_framework import serializers
@@ -1505,19 +1510,27 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
),
)
enabled = serializers.BooleanField(
- required=False,
+ read_only=True,
help_text="Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",
)
emit = serializers.BooleanField(
- required=False,
+ read_only=True,
help_text="Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing.",
)
run_interval_minutes = serializers.IntegerField(
- required=False,
+ read_only=True,
min_value=30,
max_value=43200,
help_text="Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.",
)
+ run_cron_schedule = serializers.CharField(
+ read_only=True,
+ allow_null=True,
+ help_text=(
+ "Optional five-field cron expression evaluated in the project timezone, e.g. '30 9 * * *'. "
+ "Takes precedence over `run_interval_minutes` when set. Null means the rolling interval schedule."
+ ),
+ )
last_run_at = serializers.DateTimeField(
read_only=True,
allow_null=True,
@@ -1548,12 +1561,85 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
"enabled",
"emit",
"run_interval_minutes",
+ "run_cron_schedule",
"last_run_at",
"created_at",
]
read_only_fields = ["id", "created_at"]
+# Matches the `run_interval_minutes` floor: one scout may not occupy the coordinator more
+# than once per 30 minutes, however the schedule is expressed.
+_CRON_MIN_GAP_SECONDS = 30 * 60
+# Occurrences sampled by the min-gap check. Enough to expose sub-30-minute patterns
+# (a `*/15` fires 96×/day) while staying trivially cheap for sparse schedules.
+_CRON_SAMPLE_OCCURRENCES = 100
+
+
+def _validate_run_cron_schedule(value: str) -> str:
+ expr = value.strip()
+ fields = expr.split()
+ # croniter also accepts 6/7-field (seconds/years) forms and @-aliases; restrict the API to
+ # the plain five-field shape so the stored expressions stay predictable across consumers.
+ if len(fields) != 5 or not croniter.is_valid(expr):
+ raise serializers.ValidationError("Not a valid five-field cron expression, e.g. '30 9 * * *' or '0 9 * * 1-5'.")
+ iterator = croniter(expr, datetime(2026, 1, 1, tzinfo=UTC))
+ occurrences = [iterator.get_next(datetime) for _ in range(_CRON_SAMPLE_OCCURRENCES)]
+ min_gap = min((later - earlier).total_seconds() for earlier, later in zip(occurrences, occurrences[1:]))
+ if min_gap < _CRON_MIN_GAP_SECONDS:
+ raise serializers.ValidationError(
+ "Scheduled runs must be at least 30 minutes apart (the same floor as run_interval_minutes)."
+ )
+ return expr
+
+
+class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):
+ """Editable schedule, enablement, and emit posture for one scout config."""
+
+ enabled = serializers.BooleanField(
+ required=False,
+ help_text="Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator.",
+ )
+ emit = serializers.BooleanField(
+ required=False,
+ help_text="Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing.",
+ )
+ run_interval_minutes = serializers.IntegerField(
+ required=False,
+ min_value=30,
+ max_value=43200,
+ help_text="Minutes between runs (30–43200). Use 1440 for a daily schedule.",
+ )
+ run_cron_schedule = serializers.CharField(
+ required=False,
+ allow_null=True,
+ max_length=100,
+ help_text=(
+ "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' "
+ "(twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. "
+ "Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes "
+ "apart. Set null to return to the rolling interval schedule."
+ ),
+ )
+
+ def validate_run_cron_schedule(self, value: str | None) -> str | None:
+ return _validate_run_cron_schedule(value) if value is not None else None
+
+ def update(self, instance: SignalScoutConfig, validated_data: dict) -> SignalScoutConfig:
+ # Re-anchor the coordinator's cron due-check only when the schedule actually changes —
+ # an emit/enabled-only save must not defer an already-overdue scheduled run.
+ schedule_fields = ("run_interval_minutes", "run_cron_schedule")
+ if any(
+ field in validated_data and validated_data[field] != getattr(instance, field) for field in schedule_fields
+ ):
+ validated_data["schedule_changed_at"] = timezone.now()
+ return super().update(instance, validated_data)
+
+ class Meta:
+ model = SignalScoutConfig
+ fields = ["enabled", "emit", "run_interval_minutes", "run_cron_schedule"]
+
+
class SignalScoutConfigCreateSerializer(serializers.Serializer):
"""Request body for registering a scout config without waiting for the coordinator tick.
@@ -1585,6 +1671,19 @@ class SignalScoutConfigCreateSerializer(serializers.Serializer):
max_value=43200,
help_text="Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).",
)
+ run_cron_schedule = serializers.CharField(
+ required=False,
+ allow_null=True,
+ max_length=100,
+ help_text=(
+ "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' "
+ "(twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. "
+ "Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
+ ),
+ )
+
+ def validate_run_cron_schedule(self, value: str | None) -> str | None:
+ return _validate_run_cron_schedule(value) if value is not None else None
def validate_skill_name(self, value: str) -> str:
# A config for a non-scout skill would never dispatch (the coordinator only considers
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index 71af4eec13f1..8d046244e5d9 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -91,6 +91,7 @@ from products.signals.backend.scout_harness.serializers import (
SearchRecentRunsQuerySerializer,
SignalScoutConfigCreateSerializer,
SignalScoutConfigSerializer,
+ SignalScoutConfigUpdateSerializer,
SignalScoutEmissionSerializer,
SignalScoutManualRunSerializer,
SignalScoutRunDetailSerializer,
@@ -1360,10 +1361,10 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
},
summary="List scout configs",
description=(
- "List the per-(team, skill) scout configs for this project — schedule "
- "(`run_interval_minutes`), `enabled`, and `emit` posture per scout. A freshly "
- "authored scout skill appears here once its config is registered, either "
- "explicitly via create or by the coordinator's next tick."
+ "List the per-(team, skill) scout configs for this project. Each row includes its schedule "
+ "(rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, "
+ "and `emit` posture. A freshly authored scout skill appears here once its config is registered, "
+ "either explicitly via create or by the coordinator's next tick."
),
operation_id="signals_scout_config_list",
)
@@ -1402,10 +1403,10 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
summary="Create a scout config",
description=(
"Register the config for a `signals-scout-*` skill immediately, without waiting "
- "for the coordinator to auto-register it — optionally setting `run_interval_minutes`, "
- "`enabled`, and `emit` in the same call. The skill must already exist on this "
- "project. Upsert: if a config already exists for the skill, the provided fields "
- "are applied to it."
+ "for the coordinator to auto-register it. The same call can optionally set "
+ "`run_interval_minutes`, a cron `run_cron_schedule`, `enabled`, and `emit`. "
+ "The skill must already exist on this project. Upsert: if a config already exists "
+ "for the skill, the provided fields are applied to it."
),
operation_id="signals_scout_config_create",
)
@@ -1448,7 +1449,7 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
if not created and tunables:
# The coordinator tick (or a concurrent caller) won the race — apply the provided
# fields to the existing row so the call still lands the requested settings.
- update = SignalScoutConfigSerializer(config, data=tunables, partial=True)
+ update = SignalScoutConfigUpdateSerializer(config, data=tunables, partial=True)
update.is_valid(raise_exception=True)
save_kwargs = {}
if not config.enabled and update.validated_data.get("enabled"):
@@ -1461,7 +1462,7 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
)
@extend_schema(
- request=SignalScoutConfigSerializer,
+ request=SignalScoutConfigUpdateSerializer,
responses={
200: OpenApiResponse(response=SignalScoutConfigSerializer, description="Updated config."),
400: OpenApiResponse(
@@ -1471,9 +1472,10 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
},
summary="Update a scout config",
description=(
- "Tune one scout: change its schedule (`run_interval_minutes`), `enabled`, or `emit` "
- "(dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is "
- "activity-logged since it drives spend."
+ "Tune one scout: change its schedule (rolling `run_interval_minutes`, or a cron "
+ "`run_cron_schedule` that takes precedence when set), `enabled`, or `emit` (dry-run) "
+ "posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged "
+ "since it drives spend."
),
operation_id="signals_scout_config_update",
)
@@ -1483,7 +1485,7 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
config = SignalScoutConfig.objects.unscoped().filter(team_id=team_id, id=config_id).first()
if config is None:
raise exceptions.NotFound()
- serializer = SignalScoutConfigSerializer(config, data=request.data, partial=True)
+ serializer = SignalScoutConfigUpdateSerializer(config, data=request.data, partial=True)
serializer.is_valid(raise_exception=True)
enabling = not config.enabled and serializer.validated_data.get("enabled")
if enabling:
diff --git a/products/signals/backend/temporal/agentic/scout_coordinator.py b/products/signals/backend/temporal/agentic/scout_coordinator.py
index 2f0e230bef67..f9280fa770e3 100644
--- a/products/signals/backend/temporal/agentic/scout_coordinator.py
+++ b/products/signals/backend/temporal/agentic/scout_coordinator.py
@@ -3,12 +3,13 @@ from __future__ import annotations
import json
import asyncio
from dataclasses import dataclass
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, tzinfo
from django.db.models import Q
from django.utils import timezone
import structlog
+from croniter import CroniterError, croniter
from temporalio import activity, workflow
from temporalio.common import RetryPolicy, WorkflowIDReusePolicy
from temporalio.exceptions import WorkflowAlreadyStartedError
@@ -224,7 +225,7 @@ def _collect_planned_runs(
# latest version: dispatching them would spawn a child workflow that fails fast in
# load_skill_for_run on every tick.
for config in SignalScoutConfig.all_teams.filter(team_id=team.id, enabled=True, skill_name__in=live_skills):
- overdue_s = _overdue_seconds(config, now)
+ overdue_s = _overdue_seconds(config, now, team.timezone_info)
if overdue_s is None:
continue
due.append(_DueRun(overdue_s, str(config.pk), team.id, config.skill_name))
@@ -390,8 +391,43 @@ def _participating_teams(enrollment: Enrollment) -> list[tuple[Team, bool]]:
return [(teams[team_id], team_id in explicit) for team_id in sorted(all_ids) if team_id in teams]
-def _overdue_seconds(config: SignalScoutConfig, now: datetime) -> float | None:
- """Seconds past due (down to `-DUE_GRACE_SECONDS`), or None if not yet due. Never-run rows are maximally overdue."""
+def _overdue_seconds(config: SignalScoutConfig, now: datetime, project_timezone: tzinfo) -> float | None:
+ """Seconds past due, or None if not yet due. Never-run rolling schedules are maximally overdue."""
+ if config.run_cron_schedule:
+ # `schedule_changed_at` (stamped only on actual schedule edits — deliberately not
+ # `updated_at`, which every emit/enabled save bumps) anchors a newly saved schedule so
+ # selecting a future slot waits for that occurrence instead of immediately catching up
+ # against a slot from before the edit. `created_at` covers never-edited rows.
+ schedule_reference = max(
+ reference
+ for reference in (config.last_run_at, config.schedule_changed_at, config.created_at)
+ if reference is not None
+ )
+ local_schedule_reference = schedule_reference.astimezone(project_timezone)
+ try:
+ # First occurrence strictly after the reference. Iterated in *naive* project-local
+ # time and re-localized afterwards: tz-aware croniter preserves the absolute interval
+ # across a DST change (shifting the local hour), but the contract here is wall-clock —
+ # a 9am schedule stays 9am local through DST transitions.
+ naive_slot = croniter(config.run_cron_schedule, local_schedule_reference.replace(tzinfo=None)).get_next(
+ datetime
+ )
+ first_unfulfilled_slot = naive_slot.replace(tzinfo=project_timezone)
+ except CroniterError:
+ # The expression is serializer-validated on write, so this only fires on out-of-band
+ # writes. Fall through to the rolling interval rather than killing the whole tick.
+ logger.warning(
+ "signals_scout_invalid_cron_schedule",
+ config_id=str(config.pk),
+ run_cron_schedule=config.run_cron_schedule,
+ )
+ else:
+ if now < first_unfulfilled_slot:
+ return None
+ # Keep measuring from the first missed slot until dispatch so bounded coordinator ticks
+ # cannot reset a deferred run's priority when the next scheduled slot arrives.
+ return (now - first_unfulfilled_slot).total_seconds()
+
if config.last_run_at is None:
return float("inf")
overdue = (now - config.last_run_at).total_seconds() - config.run_interval_minutes * 60
diff --git a/products/signals/backend/test/test_scout_coordinator.py b/products/signals/backend/test/test_scout_coordinator.py
index cc85da02cbc7..80c54da3dd51 100644
--- a/products/signals/backend/test/test_scout_coordinator.py
+++ b/products/signals/backend/test/test_scout_coordinator.py
@@ -1,8 +1,9 @@
from __future__ import annotations
import random
-from datetime import timedelta
+from datetime import datetime, timedelta
from typing import Any
+from zoneinfo import ZoneInfo
import pytest
from unittest.mock import AsyncMock, patch
@@ -12,6 +13,7 @@ from django.utils import timezone
import pytest_asyncio
from asgiref.sync import sync_to_async
+from parameterized import parameterized
from temporalio.exceptions import WorkflowAlreadyStartedError
from temporalio.testing import ActivityEnvironment
@@ -50,6 +52,7 @@ from products.signals.backend.temporal.agentic.scout_coordinator import (
StampDispatchedRunsInput,
_allocate_tick_budget,
_DueRun,
+ _overdue_seconds,
fetch_enabled_signals_scout_runs_activity,
stamp_dispatched_signals_scout_runs_activity,
)
@@ -472,6 +475,137 @@ async def test_config_whose_skill_is_gone_is_skipped(ateam):
# ── Schedule: deterministic due-check, no sampling ──────────────────────────────
+class TestCronScheduleDueCheck:
+ @parameterized.expand(
+ [
+ (
+ "before_project_local_slot",
+ "America/Toronto",
+ "2026-07-21T12:59:00+00:00",
+ "2026-07-20T13:05:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "0 9 * * *",
+ None,
+ ),
+ (
+ "after_project_local_slot",
+ "America/Toronto",
+ "2026-07-21T13:01:00+00:00",
+ "2026-07-20T13:05:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "0 9 * * *",
+ 60.0,
+ ),
+ (
+ "after_spring_dst_change",
+ "America/Toronto",
+ "2026-03-08T13:01:00+00:00",
+ "2026-03-07T14:05:00+00:00",
+ "2026-03-07T13:00:00+00:00",
+ "0 9 * * *",
+ 60.0,
+ ),
+ (
+ "deferred_across_next_day_keeps_original_slot",
+ "America/Toronto",
+ "2026-07-22T13:01:00+00:00",
+ "2026-07-20T13:05:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "0 9 * * *",
+ 86460.0,
+ ),
+ (
+ "schedule_saved_after_today_slot",
+ "America/Toronto",
+ "2026-07-21T15:00:00+00:00",
+ "2026-07-20T13:05:00+00:00",
+ "2026-07-21T14:00:00+00:00",
+ "0 9 * * *",
+ None,
+ ),
+ (
+ "midnight_catch_up_does_not_skip_next_day",
+ "America/Toronto",
+ "2026-07-23T03:46:00+00:00",
+ "2026-07-22T04:01:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "45 23 * * *",
+ 60.0,
+ ),
+ (
+ "twice_daily_second_slot_becomes_due_same_day",
+ "America/Toronto",
+ "2026-07-21T21:01:00+00:00",
+ "2026-07-21T13:05:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "0 9,17 * * *",
+ 60.0,
+ ),
+ (
+ "weekday_schedule_not_due_on_weekend",
+ "America/Toronto",
+ "2026-07-25T14:00:00+00:00",
+ "2026-07-24T13:05:00+00:00",
+ "2026-07-20T12:00:00+00:00",
+ "0 9 * * 1-5",
+ None,
+ ),
+ ]
+ )
+ def test_cron_schedule_uses_project_timezone_and_schedule_slots(
+ self,
+ _name: str,
+ timezone_name: str,
+ now_iso: str,
+ last_run_iso: str,
+ schedule_changed_at_iso: str,
+ run_cron_schedule: str,
+ expected_overdue_seconds: float | None,
+ ) -> None:
+ config = SignalScoutConfig(
+ run_interval_minutes=1440,
+ run_cron_schedule=run_cron_schedule,
+ last_run_at=datetime.fromisoformat(last_run_iso),
+ schedule_changed_at=datetime.fromisoformat(schedule_changed_at_iso),
+ )
+
+ overdue_seconds = _overdue_seconds(config, datetime.fromisoformat(now_iso), ZoneInfo(timezone_name))
+
+ assert overdue_seconds == expected_overdue_seconds
+
+ def test_unrelated_edit_does_not_defer_overdue_scheduled_run(self) -> None:
+ # An emit/enabled-only save bumps `updated_at` but not `schedule_changed_at` — the
+ # due-check must keep measuring from the missed slot, not re-anchor to the edit.
+ config = SignalScoutConfig(
+ run_interval_minutes=1440,
+ run_cron_schedule="0 9 * * *",
+ last_run_at=datetime.fromisoformat("2026-07-20T13:05:00+00:00"),
+ schedule_changed_at=datetime.fromisoformat("2026-07-19T12:00:00+00:00"),
+ updated_at=datetime.fromisoformat("2026-07-21T14:00:00+00:00"),
+ )
+
+ overdue_seconds = _overdue_seconds(
+ config, datetime.fromisoformat("2026-07-21T15:00:00+00:00"), ZoneInfo("America/Toronto")
+ )
+
+ assert overdue_seconds == 7200.0
+
+ def test_invalid_cron_expression_falls_back_to_rolling_interval(self) -> None:
+ # Only reachable via out-of-band writes (the API validates on write), but a bad row
+ # must degrade to the rolling schedule instead of killing the coordinator tick.
+ config = SignalScoutConfig(
+ run_interval_minutes=1440,
+ run_cron_schedule="not a cron",
+ last_run_at=datetime.fromisoformat("2026-07-20T12:00:00+00:00"),
+ )
+
+ overdue_seconds = _overdue_seconds(
+ config, datetime.fromisoformat("2026-07-21T13:00:00+00:00"), ZoneInfo("America/Toronto")
+ )
+
+ assert overdue_seconds == 3600.0
+
+
@pytest.mark.asyncio
@pytest.mark.django_db
async def test_config_within_interval_is_not_due(ateam):
diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.py
index 21ada855810a..dd4eddede499 100644
--- a/products/signals/backend/test/test_scout_harness_api.py
+++ b/products/signals/backend/test/test_scout_harness_api.py
@@ -1,12 +1,13 @@
from __future__ import annotations
-from datetime import timedelta
+from datetime import datetime, timedelta
from typing import TYPE_CHECKING
from posthog.test.base import APIBaseTest
from unittest.mock import AsyncMock, patch
from django.apps import apps
+from django.test import SimpleTestCase
from django.utils import timezone
from parameterized import parameterized
@@ -36,6 +37,7 @@ from products.signals.backend.models import (
)
from products.signals.backend.scout_harness.lazy_seed import HARNESS_SEEDED_BY, discover_canonical_skills
from products.signals.backend.scout_harness.limits import STALE_RUN_CUTOFF_S
+from products.signals.backend.scout_harness.serializers import SignalScoutConfigUpdateSerializer
from products.signals.backend.scout_harness.team_limits import MAX_RUNS_PER_TEAM_PER_TICK
from products.signals.backend.scout_harness.tools.profile import compute_project_profile
from products.signals.backend.temporal.signal_queries import fetch_report_ids_for_source_ids
@@ -940,6 +942,37 @@ class TestAgentHarnessProjectProfileAPI(APIBaseTest):
}
+class TestRunCronScheduleValidation(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("plain_daily", "30 9 * * *", True),
+ ("twice_daily", "0 9,17 * * *", True),
+ ("weekdays_only", "0 9 * * 1-5", True),
+ ("padded_input_is_normalized", " 30 9 * * * ", True),
+ ("not_a_cron", "not a cron", False),
+ ("minute_out_of_range", "60 9 * * *", False),
+ ("alias_form_rejected", "@daily", False),
+ ("six_field_form_rejected", "0 30 9 * * *", False),
+ ("sub_30_minute_gap_rejected", "*/15 * * * *", False),
+ ("uneven_gap_below_floor_rejected", "0,20 9 * * *", False),
+ ]
+ )
+ def test_run_cron_schedule_validation(self, _name: str, expression: str, valid: bool) -> None:
+ serializer = SignalScoutConfigUpdateSerializer(data={"run_cron_schedule": expression}, partial=True)
+
+ assert serializer.is_valid() is valid
+ if valid:
+ assert serializer.validated_data["run_cron_schedule"] == expression.strip()
+ else:
+ assert "run_cron_schedule" in serializer.errors
+
+ def test_null_clears_without_validation(self) -> None:
+ serializer = SignalScoutConfigUpdateSerializer(data={"run_cron_schedule": None}, partial=True)
+
+ assert serializer.is_valid()
+ assert serializer.validated_data["run_cron_schedule"] is None
+
+
class TestScoutHarnessConfigAPI(APIBaseTest):
def _list_url(self) -> str:
return f"/api/projects/{self.team.id}/signals/scout/configs/"
@@ -1098,6 +1131,74 @@ class TestScoutHarnessConfigAPI(APIBaseTest):
response = self.client.patch(self._detail_url(str(config.id)), data={"run_interval_minutes": 20}, format="json")
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ def test_partial_update_sets_and_clears_cron_schedule(self) -> None:
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")
+
+ set_response = self.client.patch(
+ self._detail_url(str(config.id)),
+ data={"run_cron_schedule": "30 9 * * 1-5"},
+ format="json",
+ )
+
+ assert set_response.status_code == status.HTTP_200_OK
+ assert set_response.json()["run_cron_schedule"] == "30 9 * * 1-5"
+ config.refresh_from_db()
+ assert config.run_cron_schedule == "30 9 * * 1-5"
+
+ clear_response = self.client.patch(
+ self._detail_url(str(config.id)), data={"run_cron_schedule": None}, format="json"
+ )
+
+ assert clear_response.status_code == status.HTTP_200_OK
+ config.refresh_from_db()
+ assert config.run_cron_schedule is None
+
+ def test_partial_update_stamps_schedule_changed_at_only_for_schedule_changes(self) -> None:
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")
+
+ # Re-fetches rather than refresh_from_db so mypy doesn't narrow the attribute
+ # (it can't see the mutation and would mark later assertions unreachable).
+ def stored_stamp() -> datetime | None:
+ return SignalScoutConfig.all_teams.get(id=config.id).schedule_changed_at
+
+ emit_response = self.client.patch(self._detail_url(str(config.id)), data={"emit": False}, format="json")
+
+ assert emit_response.status_code == status.HTTP_200_OK
+ assert stored_stamp() is None
+
+ cron_response = self.client.patch(
+ self._detail_url(str(config.id)), data={"run_cron_schedule": "0 9 * * *"}, format="json"
+ )
+
+ assert cron_response.status_code == status.HTTP_200_OK
+ first_stamp = stored_stamp()
+ assert first_stamp is not None
+
+ noop_response = self.client.patch(
+ self._detail_url(str(config.id)), data={"run_cron_schedule": "0 9 * * *"}, format="json"
+ )
+
+ assert noop_response.status_code == status.HTTP_200_OK
+ assert stored_stamp() == first_stamp
+
+ def test_partial_update_rejects_invalid_cron_schedule(self) -> None:
+ # Wiring guard for the serializer-level validation matrix in TestRunCronScheduleValidation.
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")
+
+ response = self.client.patch(
+ self._detail_url(str(config.id)),
+ data={"run_cron_schedule": "*/15 * * * *"},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json() == {
+ "type": "validation_error",
+ "code": "invalid_input",
+ "detail": "Scheduled runs must be at least 30 minutes apart (the same floor as run_interval_minutes).",
+ "attr": "run_cron_schedule",
+ }
+
def test_partial_update_cannot_change_skill_name(self) -> None:
config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")
self.client.patch(self._detail_url(str(config.id)), data={"skill_name": "signals-scout-bar"}, format="json")
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 9eca40935028..cbd0b884d53b 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -1482,15 +1482,20 @@ export interface SignalScoutConfigApi {
/** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */
readonly scout_origin: ScoutOriginEnumApi
/** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */
- enabled?: boolean
+ readonly enabled: boolean
/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */
- emit?: boolean
+ readonly emit: boolean
/**
* Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.
* @minimum 30
* @maximum 43200
*/
- run_interval_minutes?: number
+ readonly run_interval_minutes: number
+ /**
+ * Optional five-field cron expression evaluated in the project timezone, e.g. '30 9 * * *'. Takes precedence over `run_interval_minutes` when set. Null means the rolling interval schedule.
+ * @nullable
+ */
+ readonly run_cron_schedule: string | null
/**
* When the coordinator last dispatched this scout. Null if it has never run.
* @nullable
@@ -1521,38 +1526,34 @@ export interface SignalScoutConfigCreateApi {
* @maximum 43200
*/
run_interval_minutes?: number
+ /**
+ * Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart.
+ * @maxLength 100
+ * @nullable
+ */
+ run_cron_schedule?: string | null
}
/**
- * Per-(team, skill) scout config: schedule, enablement, and emit posture.
- *
- * One row per `signals-scout-*` skill on the team. The coordinator auto-creates a row
- * when it discovers a scout skill; this serializer lets agents tune the row.
+ * Editable schedule, enablement, and emit posture for one scout config.
*/
-export interface PatchedSignalScoutConfigApi {
- readonly id?: string
- /** The `signals-scout-*` skill this config controls. Set at creation, not editable. */
- readonly skill_name?: string
- /** Human-readable summary of what this scout investigates, sourced from the scout skill's `description` metadata. Use it for a quick steer on the scout's focus without loading the full skill body. Empty if the skill is not currently present on the team or carries no description. */
- readonly description?: string
- /** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */
- readonly scout_origin?: ScoutOriginEnumApi
+export interface PatchedSignalScoutConfigUpdateApi {
/** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */
enabled?: boolean
/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */
emit?: boolean
/**
- * Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.
+ * Minutes between runs (30–43200). Use 1440 for a daily schedule.
* @minimum 30
* @maximum 43200
*/
run_interval_minutes?: number
/**
- * When the coordinator last dispatched this scout. Null if it has never run.
+ * Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule.
+ * @maxLength 100
* @nullable
*/
- readonly last_run_at?: string | null
- readonly created_at?: string
+ run_cron_schedule?: string | null
}
/**
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 14e7604038ac..a449344c5775 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -25,7 +25,7 @@ import type {
PaginatedSignalSourceConfigListApi,
PatchedSignalReportArtefactLogUpdateApi,
PatchedSignalReportContentUpdateApi,
- PatchedSignalScoutConfigApi,
+ PatchedSignalScoutConfigUpdateApi,
PatchedSignalSourceConfigApi,
PauseResponseApi,
PauseUntilRequestApi,
@@ -487,7 +487,7 @@ export const getSignalsScoutConfigListUrl = (projectId: string) => {
}
/**
- * List the per-(team, skill) scout configs for this project — schedule (`run_interval_minutes`), `enabled`, and `emit` posture per scout. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
+ * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, and `emit` posture. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
* @summary List scout configs
*/
export const signalsScoutConfigList = async (
@@ -505,7 +505,7 @@ export const getSignalsScoutConfigCreateUrl = (projectId: string) => {
}
/**
- * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting `run_interval_minutes`, `enabled`, and `emit` in the same call. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
+ * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set `run_interval_minutes`, a cron `run_cron_schedule`, `enabled`, and `emit`. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
* @summary Create a scout config
*/
export const signalsScoutConfigCreate = async (
@@ -526,20 +526,20 @@ export const getSignalsScoutConfigUpdateUrl = (projectId: string, id: string) =>
}
/**
- * Tune one scout: change its schedule (`run_interval_minutes`), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
+ * Tune one scout: change its schedule (rolling `run_interval_minutes`, or a cron `run_cron_schedule` that takes precedence when set), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
* @summary Update a scout config
*/
export const signalsScoutConfigUpdate = async (
projectId: string,
id: string,
- patchedSignalScoutConfigApi?: NonReadonly<PatchedSignalScoutConfigApi>,
+ patchedSignalScoutConfigUpdateApi?: PatchedSignalScoutConfigUpdateApi,
options?: RequestInit
): Promise<SignalScoutConfigApi> => {
return apiMutator<SignalScoutConfigApi>(getSignalsScoutConfigUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(patchedSignalScoutConfigApi),
+ body: JSON.stringify(patchedSignalScoutConfigUpdateApi),
})
}
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 21009f069090..6daf0fe536c6 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -226,7 +226,7 @@ export const SignalsReportsBulkStateCreateBody = /* @__PURE__ */ zod.object({
})
/**
- * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting `run_interval_minutes`, `enabled`, and `emit` in the same call. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
+ * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set `run_interval_minutes`, a cron `run_cron_schedule`, `enabled`, and `emit`. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
* @summary Create a scout config
*/
export const signalsScoutConfigCreateBodySkillNameMax = 200
@@ -234,6 +234,8 @@ export const signalsScoutConfigCreateBodySkillNameMax = 200
export const signalsScoutConfigCreateBodyRunIntervalMinutesMin = 30
export const signalsScoutConfigCreateBodyRunIntervalMinutesMax = 43200
+export const signalsScoutConfigCreateBodyRunCronScheduleMax = 100
+
export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.object({
skill_name: zod
@@ -255,18 +257,27 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.max(signalsScoutConfigCreateBodyRunIntervalMinutesMax)
.optional()
.describe('Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).'),
+ run_cron_schedule: zod
+ .string()
+ .max(signalsScoutConfigCreateBodyRunCronScheduleMax)
+ .nullish()
+ .describe(
+ "Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
+ ),
})
.describe(
'Request body for registering a scout config without waiting for the coordinator tick.\n\nUpsert keyed on `skill_name`: if the coordinator (or a concurrent caller) already\nregistered the row, the provided tunables are applied to it instead.'
)
/**
- * Tune one scout: change its schedule (`run_interval_minutes`), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
+ * Tune one scout: change its schedule (rolling `run_interval_minutes`, or a cron `run_cron_schedule` that takes precedence when set), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
* @summary Update a scout config
*/
export const signalsScoutConfigUpdateBodyRunIntervalMinutesMin = 30
export const signalsScoutConfigUpdateBodyRunIntervalMinutesMax = 43200
+export const signalsScoutConfigUpdateBodyRunCronScheduleMax = 100
+
export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.object({
enabled: zod
@@ -284,13 +295,16 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.min(signalsScoutConfigUpdateBodyRunIntervalMinutesMin)
.max(signalsScoutConfigUpdateBodyRunIntervalMinutesMax)
.optional()
+ .describe('Minutes between runs (30–43200). Use 1440 for a daily schedule.'),
+ run_cron_schedule: zod
+ .string()
+ .max(signalsScoutConfigUpdateBodyRunCronScheduleMax)
+ .nullish()
.describe(
- 'Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.'
+ "Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule."
),
})
- .describe(
- 'Per-(team, skill) scout config: schedule, enablement, and emit posture.\n\nOne row per `signals-scout-\*` skill on the team. The coordinator auto-creates a row\nwhen it discovers a scout skill; this serializer lets agents tune the row.'
- )
+ .describe('Editable schedule, enablement, and emit posture for one scout config.')
/**
* Rewrite a report's title/summary, append a note, and/or set its suggested reviewers. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index 3357851a85f3..46ef395ce931 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -361,8 +361,10 @@ tools:
title: Create a scout config
description: >
Register the config for a freshly authored `signals-scout-*` skill immediately, without waiting for the
- coordinator to auto-register it — optionally setting its schedule (`run_interval_minutes`, 30–43200),
- `enabled`, and `emit` (false = dry-run) in the same call. The skill must already exist on the project
+ coordinator to auto-register it. The same call can optionally set its schedule (rolling
+ `run_interval_minutes`, 30–43200, or a five-field cron `run_cron_schedule` like '30 9 * * *' that takes
+ precedence when set), `enabled`, and `emit` (false = dry-run). Cron schedules use the project timezone
+ automatically and occurrences must be at least 30 minutes apart. The skill must already exist on the project
(author it via the skills store first). Upsert: if a config already exists for the skill, the provided
fields are applied to it. Creating an enabled config is activity-logged, since running a scout drives spend.
scout-config-delete:
@@ -394,11 +396,12 @@ tools:
list: true
title: List scout configs
description: >
- List the per-scout configs for this project — one row per `signals-scout-*` skill, each with its schedule
- (`run_interval_minutes`), `enabled` flag, and `emit` (dry-run) posture. A freshly authored scout appears
- once its config is registered — immediately via `scout-config-create` (one skill) or `scout-config-sync`
- (the whole fleet), or on the coordinator's next tick. Use this to see which scouts run, how often, and
- whether they emit findings to the inbox. Pair with `scout-config-update` to tune them.
+ List the per-scout configs for this project. Each `signals-scout-*` skill has one row with its schedule
+ (rolling `run_interval_minutes`, or a project-local cron `run_cron_schedule` when set), `enabled` flag, and
+ `emit` (dry-run) posture. A freshly authored scout appears once its config is registered: immediately via
+ `scout-config-create` (one skill) or `scout-config-sync` (the whole fleet), or on the coordinator's next
+ tick. Use this to see which scouts run, how often, and whether they emit findings to the inbox. Pair with
+ `scout-config-update` to tune them.
scout-config-sync:
operation: signals_scout_config_sync
enabled: true
@@ -427,9 +430,12 @@ tools:
enrich_url: '{id}'
title: Update a scout config
description: >
- Tune one scout by its config `id`: change its schedule (`run_interval_minutes`, 30–43200), `enabled`, or
- `emit` (false = dry-run: the scout runs and logs but writes nothing to the inbox). `skill_name` is fixed.
- Enabling records who flipped it on and is activity-logged, since running a scout drives spend.
+ Tune one scout by its config `id`: change its schedule (rolling `run_interval_minutes`, 30–43200, or a
+ five-field cron `run_cron_schedule` like '30 9 * * *', '0 9,17 * * *', or '0 9 * * 1-5' that takes
+ precedence when set), `enabled`, or `emit` (false = dry-run: the scout runs and logs but writes nothing to
+ the inbox). Cron schedules use the project timezone automatically and occurrences must be at least 30
+ minutes apart; set null to return to the rolling interval. `skill_name` is fixed. Enabling records who
+ flipped it on and is activity-logged, since running a scout drives spend.
scout-edit-report:
operation: signals_scout_edit_report
enabled: true
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 81cefcbb78a2..5ff334829215 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -7667,7 +7667,7 @@
}
},
"scout-config-create": {
- "description": "Register the config for a freshly authored `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting its schedule (`run_interval_minutes`, 30–43200), `enabled`, and `emit` (false = dry-run) in the same call. The skill must already exist on the project (author it via the skills store first). Upsert: if a config already exists for the skill, the provided fields are applied to it. Creating an enabled config is activity-logged, since running a scout drives spend.",
+ "description": "Register the config for a freshly authored `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set its schedule (rolling `run_interval_minutes`, 30–43200, or a five-field cron `run_cron_schedule` like '30 9 * * *' that takes precedence when set), `enabled`, and `emit` (false = dry-run). Cron schedules use the project timezone automatically and occurrences must be at least 30 minutes apart. The skill must already exist on the project (author it via the skills store first). Upsert: if a config already exists for the skill, the provided fields are applied to it. Creating an enabled config is activity-logged, since running a scout drives spend.",
"category": "Signals",
"feature": "signals",
"summary": "Create a scout config",
@@ -7695,7 +7695,7 @@
}
},
"scout-config-list": {
- "description": "List the per-scout configs for this project — one row per `signals-scout-*` skill, each with its schedule (`run_interval_minutes`), `enabled` flag, and `emit` (dry-run) posture. A freshly authored scout appears once its config is registered — immediately via `scout-config-create` (one skill) or `scout-config-sync` (the whole fleet), or on the coordinator's next tick. Use this to see which scouts run, how often, and whether they emit findings to the inbox. Pair with `scout-config-update` to tune them.",
+ "description": "List the per-scout configs for this project. Each `signals-scout-*` skill has one row with its schedule (rolling `run_interval_minutes`, or a project-local cron `run_cron_schedule` when set), `enabled` flag, and `emit` (dry-run) posture. A freshly authored scout appears once its config is registered: immediately via `scout-config-create` (one skill) or `scout-config-sync` (the whole fleet), or on the coordinator's next tick. Use this to see which scouts run, how often, and whether they emit findings to the inbox. Pair with `scout-config-update` to tune them.",
"category": "Signals",
"feature": "signals",
"summary": "List scout configs",
@@ -7723,7 +7723,7 @@
}
},
"scout-config-update": {
- "description": "Tune one scout by its config `id`: change its schedule (`run_interval_minutes`, 30–43200), `enabled`, or `emit` (false = dry-run: the scout runs and logs but writes nothing to the inbox). `skill_name` is fixed. Enabling records who flipped it on and is activity-logged, since running a scout drives spend.",
+ "description": "Tune one scout by its config `id`: change its schedule (rolling `run_interval_minutes`, 30–43200, or a five-field cron `run_cron_schedule` like '30 9 * * *', '0 9,17 * * *', or '0 9 * * 1-5' that takes precedence when set), `enabled`, or `emit` (false = dry-run: the scout runs and logs but writes nothing to the inbox). Cron schedules use the project timezone automatically and occurrences must be at least 30 minutes apart; set null to return to the rolling interval. `skill_name` is fixed. Enabling records who flipped it on and is activity-logged, since running a scout drives spend.",
"category": "Signals",
"feature": "signals",
"summary": "Update a scout config",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 09a14a573493..b4632ab1742d 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -8202,7 +8202,7 @@
}
},
"scout-config-create": {
- "description": "Register the config for a freshly authored `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting its schedule (`run_interval_minutes`, 30–43200), `enabled`, and `emit` (false = dry-run) in the same call. The skill must already exist on the project (author it via the skills store first). Upsert: if a config already exists for the skill, the provided fields are applied to it. Creating an enabled config is activity-logged, since running a scout drives spend.",
+ "description": "Register the config for a freshly authored `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set its schedule (rolling `run_interval_minutes`, 30–43200, or a five-field cron `run_cron_schedule` like '30 9 * * *' that takes precedence when set), `enabled`, and `emit` (false = dry-run). Cron schedules use the project timezone automatically and occurrences must be at least 30 minutes apart. The skill must already exist on the project (author it via the skills store first). Upsert: if a config already exists for the skill, the provided fields are applied to it. Creating an enabled config is activity-logged, since running a scout drives spend.",
"category": "Signals",
"feature": "signals",
"summary": "Create a scout config",
@@ -8230,7 +8230,7 @@
}
},
"scout-config-list": {
- "description": "List the per-scout configs for this project — one row per `signals-scout-*` skill, each with its schedule (`run_interval_minutes`), `enabled` flag, and `emit` (dry-run) posture. A freshly authored scout appears once its config is registered — immediately via `scout-config-create` (one skill) or `scout-config-sync` (the whole fleet), or on the coordinator's next tick. Use this to see which scouts run, how often, and whether they emit findings to the inbox. Pair with `scout-config-update` to tune them.",
+ "description": "List the per-scout configs for this project. Each `signals-scout-*` skill has one row with its schedule (rolling `run_interval_minutes`, or a project-local cron `run_cron_schedule` when set), `enabled` flag, and `emit` (dry-run) posture. A freshly authored scout appears once its config is registered: immediately via `scout-config-create` (one skill) or `scout-config-sync` (the whole fleet), or on the coordinator's next tick. Use this to see which scouts run, how often, and whether they emit findings to the inbox. Pair with `scout-config-update` to tune them.",
"category": "Signals",
"feature": "signals",
"summary": "List scout configs",
@@ -8258,7 +8258,7 @@
}
},
"scout-config-update": {
- "description": "Tune one scout by its config `id`: change its schedule (`run_interval_minutes`, 30–43200), `enabled`, or `emit` (false = dry-run: the scout runs and logs but writes nothing to the inbox). `skill_name` is fixed. Enabling records who flipped it on and is activity-logged, since running a scout drives spend.",
+ "description": "Tune one scout by its config `id`: change its schedule (rolling `run_interval_minutes`, 30–43200, or a five-field cron `run_cron_schedule` like '30 9 * * *', '0 9,17 * * *', or '0 9 * * 1-5' that takes precedence when set), `enabled`, or `emit` (false = dry-run: the scout runs and logs but writes nothing to the inbox). Cron schedules use the project timezone automatically and occurrences must be at least 30 minutes apart; set null to return to the rolling interval. `skill_name` is fixed. Enabling records who flipped it on and is activity-logged, since running a scout drives spend.",
"category": "Signals",
"feature": "signals",
"summary": "Update a scout config",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index da5e03d6f23e..5b59e104780c 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -51528,44 +51528,26 @@ export namespace Schemas {
summary?: string;
}
- export type ScoutOriginEnum = typeof ScoutOriginEnum[keyof typeof ScoutOriginEnum];
-
-
- export const ScoutOriginEnum = {
- Canonical: 'canonical',
- Custom: 'custom',
- } as const;
-
/**
- * Per-(team, skill) scout config: schedule, enablement, and emit posture.
- *
- * One row per `signals-scout-*` skill on the team. The coordinator auto-creates a row
- * when it discovers a scout skill; this serializer lets agents tune the row.
+ * Editable schedule, enablement, and emit posture for one scout config.
*/
- export interface PatchedSignalScoutConfig {
- readonly id?: string;
- /** The `signals-scout-*` skill this config controls. Set at creation, not editable. */
- readonly skill_name?: string;
- /** Human-readable summary of what this scout investigates, sourced from the scout skill's `description` metadata. Use it for a quick steer on the scout's focus without loading the full skill body. Empty if the skill is not currently present on the team or carries no description. */
- readonly description?: string;
- /** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */
- readonly scout_origin?: ScoutOriginEnum;
+ export interface PatchedSignalScoutConfigUpdate {
/** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */
enabled?: boolean;
/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */
emit?: boolean;
/**
- * Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.
+ * Minutes between runs (30–43200). Use 1440 for a daily schedule.
* @minimum 30
* @maximum 43200
*/
run_interval_minutes?: number;
/**
- * When the coordinator last dispatched this scout. Null if it has never run.
+ * Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule.
+ * @maxLength 100
* @nullable
*/
- readonly last_run_at?: string | null;
- readonly created_at?: string;
+ run_cron_schedule?: string | null;
}
export interface PatchedSignalSourceConfig {
@@ -60391,6 +60373,14 @@ export namespace Schemas {
limits: ScoutLimits;
}
+ export type ScoutOriginEnum = typeof ScoutOriginEnum[keyof typeof ScoutOriginEnum];
+
+
+ export const ScoutOriginEnum = {
+ Canonical: 'canonical',
+ Custom: 'custom',
+ } as const;
+
/**
* Request body for the batched emissions / emission-reports lookups: the set of run UUIDs to
* resolve in one call. Collapses the findings UI's old per-run fan-out (one request — and for the
@@ -61004,15 +60994,20 @@ export namespace Schemas {
/** Where this scout came from: `canonical` for a scout PostHog ships and maintains (seeded from `products/signals/skills/`), or `custom` for one a team hand-authored on this project. Use it to badge built-in vs custom scouts instead of a hardcoded name list. Defaults to `custom` if the skill is not currently present on the team. */
readonly scout_origin: ScoutOriginEnum;
/** Whether this scout runs on its schedule. Disabled scouts are skipped by the coordinator. */
- enabled?: boolean;
+ readonly enabled: boolean;
/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. */
- emit?: boolean;
+ readonly emit: boolean;
/**
* Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.
* @minimum 30
* @maximum 43200
*/
- run_interval_minutes?: number;
+ readonly run_interval_minutes: number;
+ /**
+ * Optional five-field cron expression evaluated in the project timezone, e.g. '30 9 * * *'. Takes precedence over `run_interval_minutes` when set. Null means the rolling interval schedule.
+ * @nullable
+ */
+ readonly run_cron_schedule: string | null;
/**
* When the coordinator last dispatched this scout. Null if it has never run.
* @nullable
@@ -61043,6 +61038,12 @@ export namespace Schemas {
* @maximum 43200
*/
run_interval_minutes?: number;
+ /**
+ * Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart.
+ * @maxLength 100
+ * @nullable
+ */
+ run_cron_schedule?: string | null;
}
/**
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index b7fdbed2ee58..63b311656ffb 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -381,7 +381,7 @@ export const SignalsReportsBulkStateCreateBody = /* @__PURE__ */ zod.object({
})
/**
- * List the per-(team, skill) scout configs for this project — schedule (`run_interval_minutes`), `enabled`, and `emit` posture per scout. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
+ * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, and `emit` posture. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
* @summary List scout configs
*/
export const SignalsScoutConfigListParams = /* @__PURE__ */ zod.object({
@@ -393,7 +393,7 @@ export const SignalsScoutConfigListParams = /* @__PURE__ */ zod.object({
})
/**
- * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it — optionally setting `run_interval_minutes`, `enabled`, and `emit` in the same call. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
+ * Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set `run_interval_minutes`, a cron `run_cron_schedule`, `enabled`, and `emit`. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
* @summary Create a scout config
*/
export const SignalsScoutConfigCreateParams = /* @__PURE__ */ zod.object({
@@ -409,6 +409,8 @@ export const signalsScoutConfigCreateBodySkillNameMax = 200
export const signalsScoutConfigCreateBodyRunIntervalMinutesMin = 30
export const signalsScoutConfigCreateBodyRunIntervalMinutesMax = 43200
+export const signalsScoutConfigCreateBodyRunCronScheduleMax = 100
+
export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.object({
skill_name: zod
@@ -430,13 +432,20 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.max(signalsScoutConfigCreateBodyRunIntervalMinutesMax)
.optional()
.describe('Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).'),
+ run_cron_schedule: zod
+ .string()
+ .max(signalsScoutConfigCreateBodyRunCronScheduleMax)
+ .nullish()
+ .describe(
+ "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
+ ),
})
.describe(
'Request body for registering a scout config without waiting for the coordinator tick.\n\nUpsert keyed on `skill_name`: if the coordinator (or a concurrent caller) already\nregistered the row, the provided tunables are applied to it instead.'
)
/**
- * Tune one scout: change its schedule (`run_interval_minutes`), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
+ * Tune one scout: change its schedule (rolling `run_interval_minutes`, or a cron `run_cron_schedule` that takes precedence when set), `enabled`, or `emit` (dry-run) posture. `skill_name` is fixed. Enabling records `enabled_by` and is activity-logged since it drives spend.
* @summary Update a scout config
*/
export const SignalsScoutConfigUpdateParams = /* @__PURE__ */ zod.object({
@@ -451,6 +460,8 @@ export const SignalsScoutConfigUpdateParams = /* @__PURE__ */ zod.object({
export const signalsScoutConfigUpdateBodyRunIntervalMinutesMin = 30
export const signalsScoutConfigUpdateBodyRunIntervalMinutesMax = 43200
+export const signalsScoutConfigUpdateBodyRunCronScheduleMax = 100
+
export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.object({
enabled: zod
@@ -468,13 +479,16 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.min(signalsScoutConfigUpdateBodyRunIntervalMinutesMin)
.max(signalsScoutConfigUpdateBodyRunIntervalMinutesMax)
.optional()
+ .describe('Minutes between runs (30–43200). Use 1440 for a daily schedule.'),
+ run_cron_schedule: zod
+ .string()
+ .max(signalsScoutConfigUpdateBodyRunCronScheduleMax)
+ .nullish()
.describe(
- 'Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.'
+ "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule."
),
})
- .describe(
- 'Per-(team, skill) scout config: schedule, enablement, and emit posture.\n\nOne row per `signals-scout-*` skill on the team. The coordinator auto-creates a row\nwhen it discovers a scout skill; this serializer lets agents tune the row.'
- )
+ .describe('Editable schedule, enablement, and emit posture for one scout config.')
/**
* Delete one scout config by its `id`, removing the per-(team, skill) schedule/emit row outright. The point is cleaning up an orphaned config whose `signals-scout-*` skill was archived or deleted — it lingers in `list` with an empty `description`, never runs (the coordinator skips it and the skill can't load), but can't otherwise be removed over the API. Deletion is activity-logged. Note: if the skill still exists, the coordinator re-creates a default-schedule config on its next tick — to retire a live scout, archive its skill (or set `enabled=false` to make it inert) rather than deleting the config.
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index f5d66daa6e5b..cec441e99452 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -512,6 +512,9 @@ const scoutConfigCreate = (): ToolBase<typeof ScoutConfigCreateSchema, Schemas.S
if (params.run_interval_minutes !== undefined) {
body['run_interval_minutes'] = params.run_interval_minutes
}
+ if (params.run_cron_schedule !== undefined) {
+ body['run_cron_schedule'] = params.run_cron_schedule
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/`,
@@ -587,6 +590,9 @@ const scoutConfigUpdate = (): ToolBase<typeof ScoutConfigUpdateSchema, WithPostH
if (params.run_interval_minutes !== undefined) {
body['run_interval_minutes'] = params.run_interval_minutes
}
+ if (params.run_cron_schedule !== undefined) {
+ body['run_cron_schedule'] = params.run_cron_schedule
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,
@@ -970,6 +976,9 @@ const signalsScoutConfigCreate = (): ToolBase<typeof SignalsScoutConfigCreateSch
if (params.run_interval_minutes !== undefined) {
body['run_interval_minutes'] = params.run_interval_minutes
}
+ if (params.run_cron_schedule !== undefined) {
+ body['run_cron_schedule'] = params.run_cron_schedule
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/`,
@@ -1054,6 +1063,9 @@ const signalsScoutConfigUpdate = (): ToolBase<
if (params.run_interval_minutes !== undefined) {
body['run_interval_minutes'] = params.run_interval_minutes
}
+ if (params.run_cron_schedule !== undefined) {
+ body['run_cron_schedule'] = params.run_cron_schedule
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
index 42c20aebc57f..b14d2febd197 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
@@ -10,6 +10,18 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "run_cron_schedule": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
+ },
"run_interval_minutes": {
"description": "Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).",
"maximum": 43200,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
index 8488859679f3..37d5787ff6f4 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
@@ -13,8 +13,20 @@
"description": "A UUID string identifying this Signal scout config.",
"type": "string"
},
+ "run_cron_schedule": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule."
+ },
"run_interval_minutes": {
- "description": "Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.",
+ "description": "Minutes between runs (30–43200). Use 1440 for a daily schedule.",
"maximum": 43200,
"minimum": 30,
"type": "number"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
index 42c20aebc57f..b14d2febd197 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
@@ -10,6 +10,18 @@
"description": "Whether this scout runs on its schedule. Defaults to true.",
"type": "boolean"
},
+ "run_cron_schedule": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
+ },
"run_interval_minutes": {
"description": "Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).",
"maximum": 43200,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
index 8488859679f3..37d5787ff6f4 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
@@ -13,8 +13,20 @@
"description": "A UUID string identifying this Signal scout config.",
"type": "string"
},
+ "run_cron_schedule": {
+ "anyOf": [
+ {
+ "maxLength": 100,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional five-field cron expression, e.g. '30 9 * * *' (daily at 09:30), '0 9,17 * * *' (twice daily), or '0 9 * * 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart. Set null to return to the rolling interval schedule."
+ },
"run_interval_minutes": {
- "description": "Minutes between runs (30–43200). The scout runs once this interval has elapsed since its last run.",
+ "description": "Minutes between runs (30–43200). Use 1440 for a daily schedule.",
"maximum": 43200,
"minimum": 30,
"type": "number"