Skip to content

The agent that grows with you

feat(desktop): Stop a running cron job and choose its missed-run policy in the editor

Teknium0e0b2328e0fa
diff --git a/apps/desktop/src/api/cron.ts b/apps/desktop/src/api/cron.ts
index 61405590c42..a841b6a9c30 100644
--- a/apps/desktop/src/api/cron.ts
+++ b/apps/desktop/src/api/cron.ts
@@ -1,6 +1,7 @@
import { stampRowsWithOwningConnection } from '@/lib/session-owner-stamp'
import type {
AutomationBlueprint,
+ CronCancelResult,
CronDeliveryTarget,
CronJob,
CronJobCreatePayload,
@@ -126,6 +127,17 @@ export function triggerCronJob(jobId: string): Promise<CronJob> {
})
}
+// Asks the job's live run to stop; the run books a 'cancelled' attempt at its next cancel
+// check (a second or two), so callers poll the job list for the ledger to settle.
+export function cancelCronJobRun(jobId: string): Promise<CronCancelResult> {
+ return hermesApi<CronCancelResult>({
+ ...profileScoped(),
+ ...connectionScoped(),
+ path: `/api/cron/jobs/${encodeURIComponent(jobId)}/cancel`,
+ method: 'POST'
+ })
+}
+
export function deleteCronJob(jobId: string): Promise<{ ok: boolean }> {
return hermesApi<{ ok: boolean }>({
...profileScoped(),
diff --git a/apps/desktop/src/app/cron/catch-up-field.tsx b/apps/desktop/src/app/cron/catch-up-field.tsx
new file mode 100644
index 00000000000..be846284889
--- /dev/null
+++ b/apps/desktop/src/app/cron/catch-up-field.tsx
@@ -0,0 +1,34 @@
+import { Field, FieldHint } from '@/components/ui/field'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
+import type { Translations } from '@/i18n'
+
+import { CATCH_UP_CHOICES, type CatchUpChoice } from './run-control'
+
+/** Cron editor: what happens to the runs a job missed while Hermes was not running. */
+export function CatchUpField({
+ c,
+ onChange,
+ value
+}: {
+ c: Translations['cron']
+ onChange: (value: CatchUpChoice) => void
+ value: CatchUpChoice
+}) {
+ return (
+ <Field htmlFor="cron-catch-up" label={c.control.catchUpLabel}>
+ <Select onValueChange={next => onChange(next as CatchUpChoice)} value={value}>
+ <SelectTrigger className="h-9 rounded-md" id="cron-catch-up">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {CATCH_UP_CHOICES.map(choice => (
+ <SelectItem key={choice} value={choice}>
+ {c.control.catchUpChoices[choice]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldHint>{c.control.catchUpHint}</FieldHint>
+ </Field>
+ )
+}
diff --git a/apps/desktop/src/app/cron/cron-job-model.ts b/apps/desktop/src/app/cron/cron-job-model.ts
index b74a9dc7092..82639e95f8b 100644
--- a/apps/desktop/src/app/cron/cron-job-model.ts
+++ b/apps/desktop/src/app/cron/cron-job-model.ts
@@ -42,6 +42,8 @@ export function validateCronEditor(input: CronEditorValidationInput): CronEditor
}
export interface CronEditorSaveValues {
+ /** Missed-run policy (true run once, false skip, null default); undefined = unchanged, not sent. */
+ catchUp?: boolean | null
deliver: string
/** Per-job model override ('' = follow the global default at fire time). */
model: string
@@ -154,5 +156,10 @@ export function cronEditorUpdates(values: CronEditorSaveValues, options: { scrip
updates.provider = values.provider.trim() || null
}
+ // Sent only when the user changed it, so an edit never rewrites a policy it did not touch.
+ if (values.catchUp !== undefined) {
+ updates.catch_up = values.catchUp
+ }
+
return updates
}
diff --git a/apps/desktop/src/app/cron/index.tsx b/apps/desktop/src/app/cron/index.tsx
index e79f611944c..5f54952ee27 100644
--- a/apps/desktop/src/app/cron/index.tsx
+++ b/apps/desktop/src/app/cron/index.tsx
@@ -74,6 +74,7 @@ import {
import type { SetStatusbarItemGroup } from '../shell/statusbar-controls'
import { BlueprintSlotControl, blueprintSlotHelp, cleanBlueprintFieldError, initialBlueprintValues } from './blueprints'
+import { CatchUpField } from './catch-up-field'
import { mutateAndRefreshCronJobs, refreshCronJobs, triggerAndRefreshCronJobs } from './cron-actions'
import {
cronEditorUpdates,
@@ -88,6 +89,9 @@ import {
} from './cron-job-model'
import { jobState, jobTitle, nextRunOverdueMs, STATE_DOT, truncateText } from './job-state'
import { isCronRunRow, openCronRun, reconcileCronRunVerdicts } from './open-cron-run'
+import { catchUpChoice, catchUpValue, jobLastCancelReason, jobRunLive } from './run-control'
+import { LastCancelledNote, RunStopAction } from './run-stop-action'
+import { useCronRunStop } from './use-cron-run-stop'
const DEFAULT_DELIVER = 'local'
@@ -324,6 +328,8 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
// the click and the controller guard has no untracked window.
const pendingTriggersRef = useRef(new Map<string, number>())
const [pendingTriggers, setPendingTriggers] = useState<ReadonlyMap<string, number>>(() => new Map())
+ // Click time of each Run-now whose request has not returned, by the same key (Stop visibility).
+ const [triggerStarts, setTriggerStarts] = useState<ReadonlyMap<string, number>>(() => new Map())
// eslint-disable-next-line no-restricted-syntax -- controller mount identity, not an atom mirror
useEffect(() => {
@@ -456,6 +462,11 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
}, [selectedJob])
const totalCount = jobs.length
+ const selectedJobKey = selectedJob ? `${profile}:${selectedJob.id}` : ''
+
+ const selectedRunLive = selectedJob ? jobRunLive(selectedJob, triggerStarts.get(selectedJobKey)) : false
+
+ const runStop = useCronRunStop({ c, jobs, profile, watch: selectedRunLive })
function beginJobBusy(jobId: string): symbol {
const token = Symbol(jobId)
@@ -545,6 +556,7 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
// Ref first so the busy render and the controller guard share one instant.
pendingTriggersRef.current.set(key, requestedAt)
setPendingTriggers(current => new Map(current).set(key, requestedAt))
+ setTriggerStarts(current => new Map(current).set(key, requestedAt))
try {
const run = await controller.run(
@@ -562,7 +574,7 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
return
}
- const { refreshError, stale } = run.value
+ const { jobs: refreshed, refreshError, stale } = run.value
if (stale) {
return
@@ -572,6 +584,13 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
notifyError(refreshError, c.failedLoad)
}
+ // A run stopped mid-flight already got its "cancelled" toast from the Stop flow.
+ const outcome = refreshed?.find(candidate => candidate.id === job.id)
+
+ if (outcome && jobLastCancelReason(outcome) !== null) {
+ return
+ }
+
notify({ kind: 'success', title: c.triggered, message: truncate(jobTitle(job), 60) })
} catch (err) {
if (triggerControllerRef.current === controller && cronProfileForScope($profileScope.get()) === viewProfile) {
@@ -580,6 +599,18 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
// The request never reached the backend; the queued row is a lie.
settlePendingTrigger(key, requestedAt)
+ } finally {
+ setTriggerStarts(current => {
+ if (current.get(key) !== requestedAt) {
+ return current
+ }
+
+ const next = new Map(current)
+
+ next.delete(key)
+
+ return next
+ })
}
}
@@ -614,6 +645,7 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
schedule: values.schedule,
name: values.name || undefined,
deliver: values.deliver || DEFAULT_DELIVER,
+ ...(typeof values.catchUp === 'boolean' ? { catch_up: values.catchUp } : {}),
...(values.model.trim() ? { model: values.model.trim(), provider: values.provider.trim() || undefined } : {})
})
)
@@ -754,9 +786,12 @@ export function CronView({ onClose, onOpenSession, setStatusbarItemGroup: _setSt
onOpenSession={onOpenSession}
onPauseResume={() => void handlePauseResume(selectedJob)}
onPendingRunSettled={settlePendingTrigger}
+ onStop={() => void runStop.stop(selectedJob)}
onTrigger={() => void handleTrigger(selectedJob)}
pendingJobKey={`${profile}:${selectedJob.id}`}
pendingRunAt={pendingTriggers.get(`${profile}:${selectedJob.id}`)}
+ runLive={selectedRunLive}
+ stopping={runStop.stoppingJobIds.has(selectedJob.id)}
/>
) : query.trim() ? (
// A search with no selected job: search-flavored copy is right.
@@ -846,9 +881,13 @@ interface CronJobDetailProps {
onOpenSession?: (sessionId: string, session?: SessionInfo) => void
onPauseResume: () => void
onPendingRunSettled: (key: string, requestedAt: number) => void
+ onStop: () => void
onTrigger: () => void
pendingJobKey?: string
pendingRunAt?: number
+ /** A run is in flight (ledger) or this window's Run-now is still waiting on it. */
+ runLive: boolean
+ stopping: boolean
}
function CronJobDetail({
@@ -859,11 +898,14 @@ function CronJobDetail({
onOpenSession,
onPauseResume,
onPendingRunSettled,
+ onStop,
onTrigger,
pendingJobKey,
- pendingRunAt
+ pendingRunAt,
+ runLive,
+ stopping
}: CronJobDetailProps) {
- const state = jobState(job)
+ const state = runLive ? 'running' : jobState(job)
const isPaused = state === 'paused'
const deliver = jobDeliver(job)
const prompt = jobPrompt(job)
@@ -881,6 +923,7 @@ function CronJobDetail({
<PanelPill tone={STATE_TONE[state] ?? 'muted'}>{c.states[state] ?? state}</PanelPill>
</div>
<div className="flex shrink-0 items-center gap-0.5">
+ <RunStopAction c={c} onStop={onStop} runLive={runLive} stopping={stopping} />
<PanelAction disabled={busy} icon={isPaused ? 'play' : 'debug-pause'} onClick={onPauseResume}>
{isPaused ? c.resumeTitle : c.pauseTitle}
</PanelAction>
@@ -909,6 +952,8 @@ function CronJobDetail({
]}
/>
+ <LastCancelledNote c={c} reason={runLive ? null : jobLastCancelReason(job)} />
+
{job.last_error ? (
<div className="space-y-1.5 rounded bg-destructive/10 p-2 text-[0.7rem] text-destructive">
<div className="flex items-start gap-1.5">
@@ -1234,6 +1279,7 @@ function CronEditorDialog({
// Per-job model override encoded as an opaque provider/model pair.
// MODEL_DEFAULT_VALUE = follow the global default.
const [modelChoice, setModelChoice] = useState(MODEL_DEFAULT_VALUE)
+ const [catchUp, setCatchUp] = useState(catchUpChoice(null))
// Blueprint fills typed slots (time/enum/weekdays/text) instead of the raw
// cron fields; the backend renders the prompt + schedule from them.
const [slotValues, setSlotValues] = useState<Record<string, string>>({})
@@ -1290,6 +1336,7 @@ function CronEditorDialog({
setModelChoice(
initial && jobModel(initial) ? cronModelChoiceValue(jobProvider(initial), jobModel(initial)) : MODEL_DEFAULT_VALUE
)
+ setCatchUp(catchUpChoice(initial?.catch_up))
setSlotValues({})
setTemplateChoice(editor.mode === 'create' ? (editor.blueprintKey ?? CUSTOM_TEMPLATE) : CUSTOM_TEMPLATE)
setError(null)
@@ -1364,6 +1411,7 @@ function CronEditorDialog({
try {
await onSave({
+ catchUp: catchUp === catchUpChoice(initial?.catch_up) ? undefined : catchUpValue(catchUp),
deliver,
model: override?.model ?? '',
name: name.trim(),
@@ -1561,6 +1609,8 @@ function CronEditorDialog({
</Field>
)}
+ <CatchUpField c={c} onChange={setCatchUp} value={catchUp} />
+
{schedulePreset === 'custom' ? (
<Field htmlFor="cron-schedule" label={c.customScheduleLabel}>
<Input
@@ -1611,6 +1661,8 @@ type EditorState =
| { blueprintKey?: string; mode: 'create' }
interface EditorValues {
+ /** Missed-run policy; undefined = unchanged (not sent). */
+ catchUp?: boolean | null
deliver: string
/** Per-job model override ('' = follow the global default). */
model: string
diff --git a/apps/desktop/src/app/cron/run-control.test.ts b/apps/desktop/src/app/cron/run-control.test.ts
new file mode 100644
index 00000000000..e445a379f65
--- /dev/null
+++ b/apps/desktop/src/app/cron/run-control.test.ts
@@ -0,0 +1,44 @@
+import { describe, expect, it } from 'vitest'
+
+import { cronEditorUpdates } from './cron-job-model'
+import { catchUpChoice, catchUpValue, jobLastCancelReason, jobRunInFlight, jobRunLive } from './run-control'
+
+const SAVE = { deliver: 'local', model: '', name: 'Nightly', prompt: 'p', provider: '', schedule: '0 3 * * *' }
+
+describe('cron Stop visibility', () => {
+ it('offers Stop only while the newest attempt is unfinished', () => {
+ const at = (status: string) => ({ latest_execution: { id: 'e1', status } })
+
+ expect(jobRunInFlight(at('claimed'))).toBe(true)
+ expect(jobRunInFlight(at('running'))).toBe(true)
+ expect(['completed', 'failed', 'cancelled', 'missed'].some(s => jobRunInFlight(at(s)))).toBe(false)
+ expect(jobRunInFlight({ latest_execution: null })).toBe(false)
+ expect(jobLastCancelReason({ latest_execution: { error: 'job removed while running', id: 'e1', status: 'cancelled' } })).toBe(
+ 'job removed while running'
+ )
+ })
+})
+
+describe('cron Stop during a Run-now', () => {
+ it('stays live until an attempt claimed since the click has finished', () => {
+ const click = Date.parse('2026-10-25T21:00:00Z')
+ const row = (status: string, claimed_at: string) => ({ latest_execution: { claimed_at, id: 'e', status } })
+
+ // The list has not caught up yet: the newest row is an older run.
+ expect(jobRunLive(row('completed', '2026-10-25T20:00:00Z'), click)).toBe(true)
+ // This click's run already ended (stopped): no flicker back to Stop while the request returns.
+ expect(jobRunLive(row('cancelled', '2026-10-25T21:00:01Z'), click)).toBe(false)
+ expect(jobRunLive(row('completed', '2026-10-25T20:00:00Z'))).toBe(false)
+ })
+})
+
+describe('cron editor missed-run policy', () => {
+ it('sends catch_up only when the choice changed, including back to the default', () => {
+ const stored = catchUpChoice(false)
+
+ expect(cronEditorUpdates({ ...SAVE }, { scriptOnlyJob: false })).not.toHaveProperty('catch_up')
+ expect(cronEditorUpdates({ ...SAVE, catchUp: catchUpValue('run') }, { scriptOnlyJob: false }).catch_up).toBe(true)
+ expect(stored).toBe('skip')
+ expect(cronEditorUpdates({ ...SAVE, catchUp: catchUpValue('default') }, { scriptOnlyJob: true }).catch_up).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/app/cron/run-control.ts b/apps/desktop/src/app/cron/run-control.ts
new file mode 100644
index 00000000000..c2311934c64
--- /dev/null
+++ b/apps/desktop/src/app/cron/run-control.ts
@@ -0,0 +1,54 @@
+import type { CronJob } from '@/types/hermes'
+
+// Ledger statuses of an attempt that has not finished (cron/executions.py). The job list only
+// reports the newest attempt, and the scheduler rewrites a dead owner's row on its next tick,
+// so a claimed/running row is the run the Stop button can reach.
+const IN_FLIGHT_STATUSES = new Set(['claimed', 'running'])
+
+export function jobRunInFlight(job: Pick<CronJob, 'latest_execution'>): boolean {
+ return IN_FLIGHT_STATUSES.has(job.latest_execution?.status ?? '')
+}
+
+// A run created this long before a Run-now click (renderer/backend clock skew) still counts as its run.
+const TRIGGER_CLOCK_SLACK_MS = 2000
+
+/**
+ * Whether the job has a run to stop. While this window's Run-now is still waiting
+ * (`triggerStartedAt`, ms), the run counts as live until the ledger shows an attempt claimed
+ * since the click that already finished, so the button does not flicker back to Stop between
+ * the run ending and the trigger request returning.
+ */
+export function jobRunLive(job: Pick<CronJob, 'latest_execution'>, triggerStartedAt?: number): boolean {
+ if (jobRunInFlight(job)) {
+ return true
+ }
+
+ if (triggerStartedAt === undefined) {
+ return false
+ }
+
+ const claimedAt = Date.parse(job.latest_execution?.claimed_at ?? '')
+
+ return !(claimedAt >= triggerStartedAt - TRIGGER_CLOCK_SLACK_MS)
+}
+
+/** The newest attempt's reason when it was stopped (Stop, `hermes cron cancel`, or removal). */
+export function jobLastCancelReason(job: Pick<CronJob, 'latest_execution'>): null | string {
+ const execution = job.latest_execution
+
+ return execution?.status === 'cancelled' ? (execution.error ?? '').trim() : null
+}
+
+// The editor's missed-run choice. `default` stores nothing, so the job follows
+// `cron.catch_up_missed` (recurring) or skips (one-shot), exactly as before the field existed.
+export type CatchUpChoice = 'default' | 'run' | 'skip'
+
+export const CATCH_UP_CHOICES: readonly CatchUpChoice[] = ['default', 'run', 'skip']
+
+export function catchUpChoice(value: boolean | null | undefined): CatchUpChoice {
+ return value === true ? 'run' : value === false ? 'skip' : 'default'
+}
+
+export function catchUpValue(choice: CatchUpChoice): boolean | null {
+ return choice === 'run' ? true : choice === 'skip' ? false : null
+}
diff --git a/apps/desktop/src/app/cron/run-stop-action.tsx b/apps/desktop/src/app/cron/run-stop-action.tsx
new file mode 100644
index 00000000000..9bff24893d8
--- /dev/null
+++ b/apps/desktop/src/app/cron/run-stop-action.tsx
@@ -0,0 +1,39 @@
+import type { Translations } from '@/i18n'
+
+import { PanelAction } from '../overlays/panel'
+
+/** Job header Stop for a live run; not gated on `busy`, which this window's own Run-now holds. */
+export function RunStopAction({
+ c,
+ onStop,
+ runLive,
+ stopping
+}: {
+ c: Translations['cron']
+ onStop: () => void
+ runLive: boolean
+ stopping: boolean
+}) {
+ if (!runLive && !stopping) {
+ return null
+ }
+
+ return (
+ <PanelAction disabled={stopping} icon={stopping ? 'loading' : 'debug-stop'} onClick={onStop} spinning={stopping}>
+ {stopping ? c.control.stopping : c.control.stop}
+ </PanelAction>
+ )
+}
+
+/** Why the newest attempt was stopped, under the job's metadata; hidden while a run is live. */
+export function LastCancelledNote({ c, reason }: { c: Translations['cron']; reason: null | string }) {
+ if (reason === null) {
+ return null
+ }
+
+ return (
+ <p className="text-[0.7rem] text-muted-foreground" data-slot="cron-last-cancelled">
+ {c.control.lastCancelled(reason)}
+ </p>
+ )
+}
diff --git a/apps/desktop/src/app/cron/use-cron-run-stop.ts b/apps/desktop/src/app/cron/use-cron-run-stop.ts
new file mode 100644
index 00000000000..8d287391529
--- /dev/null
+++ b/apps/desktop/src/app/cron/use-cron-run-stop.ts
@@ -0,0 +1,144 @@
+import { useStore } from '@nanostores/react'
+import { useCallback, useEffect, useRef, useState } from 'react'
+
+import { cancelCronJobRun, type CronJob } from '@/hermes'
+import type { Translations } from '@/i18n'
+import { $cronChangeTick } from '@/store/live-sync'
+import { notify, notifyError } from '@/store/notifications'
+
+import { mutateAndRefreshCronJobs, refreshCronJobs } from './cron-actions'
+import { jobTitle, truncateText } from './job-state'
+import { jobRunInFlight } from './run-control'
+
+// A cancel lands at the run's next cancel check (about a second); poll the job list that
+// fast while a run is live or stopping so the button settles without a manual refresh.
+const LIVE_RUN_POLL_MS = 1500
+
+interface CronRunStopOptions {
+ c: Translations['cron']
+ jobs: CronJob[]
+ profile: string
+ /** The selected job has a run in flight (ledger) or a Run-now still waiting. */
+ watch: boolean
+}
+
+export interface CronRunStop {
+ stop: (job: CronJob) => Promise<void>
+ stoppingJobIds: ReadonlySet<string>
+}
+
+/**
+ * Stop for a cron job's live run: POST /cancel, then hold "Stopping…" until the job list
+ * shows that attempt finished. A run that ends on its own first is reported as such, not
+ * as cancelled.
+ */
+export function useCronRunStop({ c, jobs, profile, watch }: CronRunStopOptions): CronRunStop {
+ // jobId → the execution the cancel targeted ('' until the endpoint names it) + its title.
+ const stoppingRef = useRef(new Map<string, { executionId: string; title: string }>())
+ const [stoppingJobIds, setStoppingJobIds] = useState<ReadonlySet<string>>(() => new Set())
+ const cronChangeTick = useStore($cronChangeTick)
+
+ const publish = useCallback(() => setStoppingJobIds(new Set(stoppingRef.current.keys())), [])
+
+ const settle = useCallback(
+ (list: CronJob[] | null) => {
+ if (!list) {
+ return
+ }
+
+ let changed = false
+
+ for (const [jobId, { executionId, title }] of stoppingRef.current) {
+ const job = list.find(candidate => candidate.id === jobId)
+
+ if (job && jobRunInFlight(job)) {
+ continue
+ }
+
+ stoppingRef.current.delete(jobId)
+ changed = true
+
+ const execution = job?.latest_execution
+ // A removed job's run is stopped by the removal itself.
+ const cancelled = !job || (execution?.status === 'cancelled' && (!executionId || execution.id === executionId))
+
+ notify(
+ cancelled
+ ? { kind: 'success', title: c.control.stopped, message: title }
+ : { kind: 'info', title: c.control.finishedFirst, message: title }
+ )
+ }
+
+ if (changed) {
+ publish()
+ }
+ },
+ [c, publish]
+ )
+
+ // Another surface (the poll below, the sidebar, a cron.changed refresh) may publish the
+ // settling snapshot; reading the shared atom catches it whichever request wins.
+ useEffect(() => settle(jobs), [jobs, settle])
+
+ const active = watch || stoppingJobIds.size > 0
+
+ useEffect(() => {
+ if (!active) {
+ return
+ }
+
+ const intervalId = window.setInterval(() => {
+ if (document.visibilityState === 'visible') {
+ void refreshCronJobs(profile)
+ }
+ }, LIVE_RUN_POLL_MS)
+
+ return () => window.clearInterval(intervalId)
+ }, [active, profile])
+
+ // A scheduler fire rewrites jobs.json (cron.changed): refresh so a run the user did not
+ // start here still shows its Stop button.
+ useEffect(() => {
+ if (cronChangeTick > 0) {
+ void refreshCronJobs(profile)
+ }
+ }, [cronChangeTick, profile])
+
+ const stop = useCallback(
+ async (job: CronJob) => {
+ if (stoppingRef.current.has(job.id)) {
+ return
+ }
+
+ const title = truncateText(jobTitle(job), 60)
+
+ stoppingRef.current.set(job.id, { executionId: '', title })
+ publish()
+
+ try {
+ const { jobs: refreshed, value } = await mutateAndRefreshCronJobs(profile, () => cancelCronJobRun(job.id))
+
+ if (value && !value.cancelled) {
+ stoppingRef.current.delete(job.id)
+ publish()
+ notify({ kind: 'info', title: c.control.nothingToStop, message: title })
+
+ return
+ }
+
+ if (value?.execution_id && stoppingRef.current.has(job.id)) {
+ stoppingRef.current.set(job.id, { executionId: value.execution_id, title })
+ }
+
+ settle(refreshed)
+ } catch (err) {
+ stoppingRef.current.delete(job.id)
+ publish()
+ notifyError(err, c.control.failedStop)
+ }
+ },
+ [c, profile, publish, settle]
+ )
+
+ return { stop, stoppingJobIds }
+}
diff --git a/apps/desktop/src/i18n/ar_command_center.ts b/apps/desktop/src/i18n/ar_command_center.ts
index aae936ad02b..5a843c3011c 100644
--- a/apps/desktop/src/i18n/ar_command_center.ts
+++ b/apps/desktop/src/i18n/ar_command_center.ts
@@ -1,3 +1,4 @@
+import { arCronControl } from './ar_cron_control'
import type { TranslationOverrides } from './define-locale'
export const arCommandCenter = {
@@ -520,6 +521,7 @@ export const arCommandCenter = {
failedRename: 'فشل إعادة التسمية'
},
cron: {
+ control: arCronControl,
close: 'إغلاق',
search: 'بحث',
loading: 'جار التحميل...',
diff --git a/apps/desktop/src/i18n/ar_cron_control.ts b/apps/desktop/src/i18n/ar_cron_control.ts
new file mode 100644
index 00000000000..276ff493869
--- /dev/null
+++ b/apps/desktop/src/i18n/ar_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const arCronControl: CronControlCopy = {
+ stop: 'إيقاف',
+ stopping: 'جارٍ الإيقاف…',
+ stopped: 'أُلغي التشغيل',
+ finishedFirst: 'انتهى التشغيل قبل إيقافه',
+ nothingToStop: 'لا يوجد تشغيل جارٍ',
+ failedStop: 'تعذّر إيقاف التشغيل',
+ lastCancelled: (reason: string) => (reason ? `أُلغي آخر تشغيل: ${reason}` : 'أُلغي آخر تشغيل'),
+ catchUpLabel: 'التشغيلات الفائتة',
+ catchUpHint: 'ما يحدث للتشغيلات الفائتة أثناء توقف Hermes.',
+ catchUpChoices: {
+ default: 'استخدام الإعداد الافتراضي',
+ run: 'تشغيل مرة واحدة عند العودة',
+ skip: 'تخطيها'
+ }
+}
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index a68b5029360..b8028db926a 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -5,6 +5,7 @@ import { deBoot } from './de_boot'
import { deClarify } from './de_clarify'
import { deConnectorAccounts } from './de_connector_accounts'
import { deConnectorCard } from './de_connector_card'
+import { deCronControl } from './de_cron_control'
import { deErrorCodes } from './de_error_codes'
import { deErrorLayers } from './de_error_layers'
import { deFirstRun } from './de_first_run'
@@ -3370,6 +3371,7 @@ export const deOverrides = {
declined: 'Modelländerung abgebrochen – Sie haben die Warnung zur Datentrainings-Stufe abgelehnt.'
},
cron: {
+ control: deCronControl,
close: 'Cron schließen',
title: 'Geplante Jobs',
count: count => `${count} ${count === 1 ? 'Job' : 'Jobs'}`,
diff --git a/apps/desktop/src/i18n/de_cron_control.ts b/apps/desktop/src/i18n/de_cron_control.ts
new file mode 100644
index 00000000000..ca2fad060e1
--- /dev/null
+++ b/apps/desktop/src/i18n/de_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const deCronControl: CronControlCopy = {
+ stop: 'Stoppen',
+ stopping: 'Wird gestoppt…',
+ stopped: 'Lauf abgebrochen',
+ finishedFirst: 'Lauf war vor dem Stoppen fertig',
+ nothingToStop: 'Kein Lauf aktiv',
+ failedStop: 'Lauf konnte nicht gestoppt werden',
+ lastCancelled: (reason: string) => (reason ? `Letzter Lauf abgebrochen: ${reason}` : 'Letzter Lauf abgebrochen'),
+ catchUpLabel: 'Verpasste Läufe',
+ catchUpHint: 'Was mit Läufen geschieht, die verpasst wurden, während Hermes nicht lief.',
+ catchUpChoices: {
+ default: 'Standard verwenden',
+ run: 'Einmal nachholen',
+ skip: 'Überspringen'
+ }
+}
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 1c3bf6395e7..074e0f5f2d6 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -9,6 +9,7 @@ import { enCatalogInstall } from './en_catalog_install'
import { enClarify } from './en_clarify'
import { enConnectorAccounts } from './en_connector_accounts'
import { enConnectorCard } from './en_connector_card'
+import { enCronControl } from './en_cron_control'
import { enGatewayGroupOpen, enSkillDeepLink } from './en_deep_links'
import { enErrorCodes } from './en_error_codes'
import { enErrorLayers } from './en_error_layers'
@@ -2934,6 +2935,7 @@ export const en: Translations = {
},
cron: {
+ control: enCronControl,
close: 'Close cron',
title: 'Scheduled jobs',
count: count => `${count} ${count === 1 ? 'job' : 'jobs'}`,
diff --git a/apps/desktop/src/i18n/en_cron_control.ts b/apps/desktop/src/i18n/en_cron_control.ts
new file mode 100644
index 00000000000..b459587acd8
--- /dev/null
+++ b/apps/desktop/src/i18n/en_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const enCronControl: CronControlCopy = {
+ stop: 'Stop',
+ stopping: 'Stopping…',
+ stopped: 'Run cancelled',
+ finishedFirst: 'Run finished before it could stop',
+ nothingToStop: 'No run in flight',
+ failedStop: 'Could not stop the run',
+ lastCancelled: (reason: string) => (reason ? `Last run cancelled: ${reason}` : 'Last run cancelled'),
+ catchUpLabel: 'Missed runs',
+ catchUpHint: 'What to do with runs missed while Hermes was not running.',
+ catchUpChoices: {
+ default: 'Use the default',
+ run: 'Run once when back',
+ skip: 'Skip them'
+ }
+}
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 9325c7cbb02..9ce9337766f 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -6,6 +6,7 @@ import { esBoot } from './es_boot'
import { esClarify } from './es_clarify'
import { esConnectorAccounts } from './es_connector_accounts'
import { esConnectorCard } from './es_connector_card'
+import { esCronControl } from './es_cron_control'
import { esErrorCodes } from './es_error_codes'
import { esErrorLayers } from './es_error_layers'
import { esFirstRun } from './es_first_run'
@@ -3358,6 +3359,7 @@ export const esOverrides = {
declined: 'Cambio de modelo cancelado: rechazaste el aviso del nivel con entrenamiento de datos.'
},
cron: {
+ control: esCronControl,
close: 'Cerrar cron',
title: 'Tareas programadas',
count: count => `${count} ${count === 1 ? 'tarea' : 'tareas'}`,
diff --git a/apps/desktop/src/i18n/es_cron_control.ts b/apps/desktop/src/i18n/es_cron_control.ts
new file mode 100644
index 00000000000..73bd5dcc23a
--- /dev/null
+++ b/apps/desktop/src/i18n/es_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const esCronControl: CronControlCopy = {
+ stop: 'Detener',
+ stopping: 'Deteniendo…',
+ stopped: 'Ejecución cancelada',
+ finishedFirst: 'La ejecución terminó antes de detenerse',
+ nothingToStop: 'No hay ninguna ejecución en curso',
+ failedStop: 'No se pudo detener la ejecución',
+ lastCancelled: (reason: string) => (reason ? `Última ejecución cancelada: ${reason}` : 'Última ejecución cancelada'),
+ catchUpLabel: 'Ejecuciones perdidas',
+ catchUpHint: 'Qué hacer con las ejecuciones perdidas mientras Hermes no estaba en marcha.',
+ catchUpChoices: {
+ default: 'Usar el valor predeterminado',
+ run: 'Ejecutar una vez al volver',
+ skip: 'Omitirlas'
+ }
+}
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 9bff916b69a..7aaaaf23a5d 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -6,6 +6,7 @@ import { frBoot } from './fr_boot'
import { frClarify } from './fr_clarify'
import { frConnectorAccounts } from './fr_connector_accounts'
import { frConnectorCard } from './fr_connector_card'
+import { frCronControl } from './fr_cron_control'
import { frErrorCodes } from './fr_error_codes'
import { frErrorLayers } from './fr_error_layers'
import { frFirstRun } from './fr_first_run'
@@ -3375,6 +3376,7 @@ export const frOverrides = {
'Changement de modèle annulé — vous avez refusé l’avertissement sur le niveau d’entraînement sur les données.'
},
cron: {
+ control: frCronControl,
close: 'Fermer le cron',
title: 'Tâches planifiées',
count: count => `${count} ${count === 1 ? 'tâche' : 'tâches'}`,
diff --git a/apps/desktop/src/i18n/fr_cron_control.ts b/apps/desktop/src/i18n/fr_cron_control.ts
new file mode 100644
index 00000000000..4a5960a544d
--- /dev/null
+++ b/apps/desktop/src/i18n/fr_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const frCronControl: CronControlCopy = {
+ stop: 'Arrêter',
+ stopping: 'Arrêt…',
+ stopped: 'Exécution annulée',
+ finishedFirst: 'L’exécution s’est terminée avant l’arrêt',
+ nothingToStop: 'Aucune exécution en cours',
+ failedStop: 'Impossible d’arrêter l’exécution',
+ lastCancelled: (reason: string) => (reason ? `Dernière exécution annulée: ${reason}` : 'Dernière exécution annulée'),
+ catchUpLabel: 'Exécutions manquées',
+ catchUpHint: 'Que faire des exécutions manquées pendant que Hermes ne tournait pas.',
+ catchUpChoices: {
+ default: 'Utiliser la valeur par défaut',
+ run: 'Exécuter une fois au retour',
+ skip: 'Les ignorer'
+ }
+}
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 35404e457b2..e13fe0bc4dd 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -7,6 +7,7 @@ import { jaBoot } from './ja_boot'
import { jaCatalog, jaSkillDeepLink } from './ja_catalog'
import { jaClarify } from './ja_clarify'
import { jaConnectors } from './ja_connectors'
+import { jaCronControl } from './ja_cron_control'
import { jaErrorCodes } from './ja_error_codes'
import { jaErrorLayers } from './ja_error_layers'
import { jaFirstRun } from './ja_first_run'
@@ -1921,6 +1922,7 @@ export const jaOverrides = {
},
cron: {
+ control: jaCronControl,
close: 'Cron を閉じる',
title: 'スケジュール済みジョブ',
count: count => `${count} 件のジョブ`,
diff --git a/apps/desktop/src/i18n/ja_cron_control.ts b/apps/desktop/src/i18n/ja_cron_control.ts
new file mode 100644
index 00000000000..1f987391261
--- /dev/null
+++ b/apps/desktop/src/i18n/ja_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const jaCronControl: CronControlCopy = {
+ stop: '停止',
+ stopping: '停止中…',
+ stopped: '実行をキャンセルしました',
+ finishedFirst: '停止する前に実行が終了しました',
+ nothingToStop: '実行中のジョブはありません',
+ failedStop: '実行を停止できませんでした',
+ lastCancelled: (reason: string) => (reason ? `前回の実行はキャンセルされました: ${reason}` : '前回の実行はキャンセルされました'),
+ catchUpLabel: '見逃した実行',
+ catchUpHint: 'Hermes が動いていない間に見逃した実行の扱い。',
+ catchUpChoices: {
+ default: '既定の設定に従う',
+ run: '復帰時に1回だけ実行',
+ skip: 'スキップする'
+ }
+}
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index acab7e0df33..3af61f435d8 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -6,6 +6,7 @@ import { ruBoot } from './ru_boot'
import { ruCatalog, ruSkillDeepLink } from './ru_catalog'
import { ruClarify } from './ru_clarify'
import { ruConnectors } from './ru_connectors'
+import { ruCronControl } from './ru_cron_control'
import { ruErrorCodes } from './ru_error_codes'
import { ruFirstRun } from './ru_first_run'
import { ruGatewayHost } from './ru_gateway_host'
@@ -2175,6 +2176,7 @@ export const ruOverrides = {
},
cron: {
+ control: ruCronControl,
close: 'Закрыть cron',
title: 'Запланированные задачи',
count: count => `${count} ${RU_PLURAL(count, 'задача', 'задачи', 'задач')}`,
diff --git a/apps/desktop/src/i18n/ru_cron_control.ts b/apps/desktop/src/i18n/ru_cron_control.ts
new file mode 100644
index 00000000000..ce93b3f23a4
--- /dev/null
+++ b/apps/desktop/src/i18n/ru_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const ruCronControl: CronControlCopy = {
+ stop: 'Остановить',
+ stopping: 'Остановка…',
+ stopped: 'Запуск отменён',
+ finishedFirst: 'Запуск завершился до остановки',
+ nothingToStop: 'Нет активного запуска',
+ failedStop: 'Не удалось остановить запуск',
+ lastCancelled: (reason: string) => (reason ? `Последний запуск отменён: ${reason}` : 'Последний запуск отменён'),
+ catchUpLabel: 'Пропущенные запуски',
+ catchUpHint: 'Что делать с запусками, пропущенными, пока Hermes не работал.',
+ catchUpChoices: {
+ default: 'По умолчанию',
+ run: 'Запустить один раз после возврата',
+ skip: 'Пропустить'
+ }
+}
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 7babc97d529..e3e1610532d 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -16,6 +16,7 @@ import type { CatalogTranslations } from './types_catalog'
import type { CatalogInstallTranslations } from './types_catalog_install'
import type { ClarifyCopy } from './types_clarify'
import type { ConnectorAccountsTranslations, ConnectorCardTranslations } from './types_connectors'
+import type { CronControlCopy } from './types_cron_control'
import type { GatewayGroupOpenCopy, SkillDeepLinkCopy } from './types_deep_links'
import type { ExternalOpenFailedCopy } from './types_external_open'
import type { FirstRunCopy } from './types_first_run'
@@ -2587,6 +2588,7 @@ export interface Translations extends NoticeTranslations {
cron: {
close: string
+ control: CronControlCopy
title: string
count: (count: number) => string
search: string
diff --git a/apps/desktop/src/i18n/types_cron_control.ts b/apps/desktop/src/i18n/types_cron_control.ts
new file mode 100644
index 00000000000..2056f483844
--- /dev/null
+++ b/apps/desktop/src/i18n/types_cron_control.ts
@@ -0,0 +1,20 @@
+/** Cron page: stopping a live run and the per-job missed-run (catch-up) policy. */
+export interface CronControlCopy {
+ /** Detail action that stops the job's run in flight. */
+ stop: string
+ /** The same action while the cancel is landing. */
+ stopping: string
+ /** Toast once the run booked its cancelled attempt. */
+ stopped: string
+ /** Toast when the run completed on its own before the cancel reached it. */
+ finishedFirst: string
+ /** Toast when no run was in flight by the time Stop was pressed. */
+ nothingToStop: string
+ failedStop: string
+ /** Header note for a job whose newest attempt was stopped. */
+ lastCancelled: (reason: string) => string
+ /** Editor field: what to do with runs missed while Hermes was not running. */
+ catchUpLabel: string
+ catchUpHint: string
+ catchUpChoices: { default: string; run: string; skip: string }
+}
diff --git a/apps/desktop/src/i18n/zh-hant_command_center.ts b/apps/desktop/src/i18n/zh-hant_command_center.ts
index f864a607386..39e9683262f 100644
--- a/apps/desktop/src/i18n/zh-hant_command_center.ts
+++ b/apps/desktop/src/i18n/zh-hant_command_center.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { zhHantCronControl } from './zh-hant_cron_control'
export const zhHantCommandCenter = {
commandCenter: {
@@ -443,6 +444,7 @@ export const zhHantCommandCenter = {
},
cron: {
+ control: zhHantCronControl,
close: '關閉排程',
title: '排程工作',
count: count => `${count} 個工作`,
diff --git a/apps/desktop/src/i18n/zh-hant_cron_control.ts b/apps/desktop/src/i18n/zh-hant_cron_control.ts
new file mode 100644
index 00000000000..b372a6071fb
--- /dev/null
+++ b/apps/desktop/src/i18n/zh-hant_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const zhHantCronControl: CronControlCopy = {
+ stop: '停止',
+ stopping: '正在停止…',
+ stopped: '執行已取消',
+ finishedFirst: '執行在停止前已結束',
+ nothingToStop: '沒有進行中的執行',
+ failedStop: '無法停止執行',
+ lastCancelled: (reason: string) => (reason ? `上次執行已取消: ${reason}` : '上次執行已取消'),
+ catchUpLabel: '錯過的執行',
+ catchUpHint: 'Hermes 未執行期間錯過的執行如何處理。',
+ catchUpChoices: {
+ default: '使用預設設定',
+ run: '恢復後補跑一次',
+ skip: '略過'
+ }
+}
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 7d4f6875811..84b3ca3b503 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -6,6 +6,7 @@ import { introZh } from './intro-zh'
import { zhCatalog, zhSkillDeepLink } from './zh_catalog'
import { zhClarify } from './zh_clarify'
import { zhConnectorCard } from './zh_connector_card'
+import { zhCronControl } from './zh_cron_control'
import { zhErrorCodes } from './zh_error_codes'
import { zhErrorLayers } from './zh_error_layers'
import { zhFirstRun } from './zh_first_run'
@@ -2838,6 +2839,7 @@ export const zhOverrides = {
},
cron: {
+ control: zhCronControl,
close: '关闭定时任务',
title: '定时任务',
count: count => `${count} 个任务`,
diff --git a/apps/desktop/src/i18n/zh_cron_control.ts b/apps/desktop/src/i18n/zh_cron_control.ts
new file mode 100644
index 00000000000..cadd289e4a1
--- /dev/null
+++ b/apps/desktop/src/i18n/zh_cron_control.ts
@@ -0,0 +1,18 @@
+import type { CronControlCopy } from './types_cron_control'
+
+export const zhCronControl: CronControlCopy = {
+ stop: '停止',
+ stopping: '正在停止…',
+ stopped: '运行已取消',
+ finishedFirst: '运行在停止前已结束',
+ nothingToStop: '没有正在进行的运行',
+ failedStop: '无法停止运行',
+ lastCancelled: (reason: string) => (reason ? `上次运行已取消: ${reason}` : '上次运行已取消'),
+ catchUpLabel: '错过的运行',
+ catchUpHint: 'Hermes 未运行期间错过的运行如何处理。',
+ catchUpChoices: {
+ default: '使用默认设置',
+ run: '恢复后补跑一次',
+ skip: '跳过'
+ }
+}
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index 01788e966ac..8da7b630ada 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -1049,11 +1049,15 @@ export interface AnalyticsTotals {
}
export interface CronJob {
+ /** Missed-run policy: true runs one catch-up, false skips; null/absent follows the default. */
+ catch_up?: boolean | null
deliver?: null | string
enabled: boolean
id: string
last_error?: null | string
last_run_at?: null | string
+ /** The job's newest ledger attempt (``cron.jobs.list_jobs``); claimed/running = a run in flight. */
+ latest_execution?: CronJobExecution | null
model?: null | string
name?: null | string
next_run_at?: null | string
@@ -1066,7 +1070,23 @@ export interface CronJob {
state?: null | string
}
+export interface CronJobExecution {
+ claimed_at?: null | string
+ error?: null | string
+ id: string
+ status: string
+}
+
+/** POST /api/cron/jobs/{id}/cancel: ``cancelled`` is false when no run was in flight. */
+export interface CronCancelResult {
+ cancelled: boolean
+ detail?: string
+ execution_id?: null | string
+ job_id: string
+}
+
export interface CronJobCreatePayload {
+ catch_up?: boolean
deliver?: string
model?: string
name?: string
@@ -1083,6 +1103,7 @@ export interface CronJobSchedule {
}
export interface CronJobUpdates {
+ catch_up?: boolean | null
deliver?: string
enabled?: boolean
model?: null | string
diff --git a/hermes_cli/web_models.py b/hermes_cli/web_models.py
index b2b395cf978..1cdaf300f2e 100644
--- a/hermes_cli/web_models.py
+++ b/hermes_cli/web_models.py
@@ -346,6 +346,8 @@ class CronJobCreate(BaseModel):
# Validated in cron.jobs.create_job (unknown IANA zone / out-of-range grace -> 400).
timezone: Optional[str] = None
grace_minutes: Optional[int | str] = None
+ # Missed-run policy: true runs one catch-up, false skips; omitted follows the default.
+ catch_up: Optional[StrictBool] = None
class CronJobUpdate(BaseModel):
updates: dict
diff --git a/hermes_cli/web_server_cron.py b/hermes_cli/web_server_cron.py
index b4f1047cc74..b777f511a87 100644
--- a/hermes_cli/web_server_cron.py
+++ b/hermes_cli/web_server_cron.py
@@ -281,7 +281,7 @@ def _create_cron_job_sync(body: CronJobCreate, profile: Optional[str] = None):
no_agent=no_agent,
timezone=_cron_optional_text(body.timezone),
grace_minutes=body.grace_minutes,
- **{key: getattr(body, key) for key in ("paused", "paused_reason")
+ **{key: getattr(body, key) for key in ("paused", "paused_reason", "catch_up")
if key in body.model_fields_set})
except HTTPException:
raise
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index 1dce2a3ed3c..e4a257a2003 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -1397,6 +1397,18 @@
"cron.blueprints.subtitle",
"cron.blueprints.tab",
"cron.close",
+ "cron.control.catchUpChoices.default",
+ "cron.control.catchUpChoices.run",
+ "cron.control.catchUpChoices.skip",
+ "cron.control.catchUpHint",
+ "cron.control.catchUpLabel",
+ "cron.control.failedStop",
+ "cron.control.finishedFirst",
+ "cron.control.lastCancelled",
+ "cron.control.nothingToStop",
+ "cron.control.stop",
+ "cron.control.stopped",
+ "cron.control.stopping",
"cron.count",
"cron.createAction",
"cron.createDesc",
diff --git a/tests/hermes_cli/test_web_server_cron_repeat.py b/tests/hermes_cli/test_web_server_cron_repeat.py
index f5f7739651a..05e3a80896a 100644
--- a/tests/hermes_cli/test_web_server_cron_repeat.py
+++ b/tests/hermes_cli/test_web_server_cron_repeat.py
@@ -118,3 +118,15 @@ def test_create_accepts_cli_string_repeat_forms(client, repeat, expected_times):
assert response.status_code == 200
assert response.json()["repeat"] == {"times": expected_times, "completed": 0}
+
+
+def test_create_stores_the_missed_run_policy_only_when_given(client):
+ """The editor's Missed runs choice must reach the job; omitting it keeps the default (no key)."""
+ chosen = client.post(
+ "/api/cron/jobs",
+ json={"prompt": "nightly", "schedule": "0 3 * * *", "name": "skip missed", "catch_up": False},
+ )
+ plain = client.post("/api/cron/jobs", json={"prompt": "nightly", "schedule": "0 3 * * *", "name": "default"})
+
+ assert chosen.status_code == 200 and chosen.json()["catch_up"] is False
+ assert plain.status_code == 200 and "catch_up" not in plain.json()
diff --git a/website/docs/user-guide/features/cron.md b/website/docs/user-guide/features/cron.md
index 46483bb8dc5..7fdd8e32d81 100644
--- a/website/docs/user-guide/features/cron.md
+++ b/website/docs/user-guide/features/cron.md
@@ -345,8 +345,10 @@ The cancel is a *request*, not a kill: it is recorded against that run's executi
up at the run's next cancel check (well under a second for a script). The run then books a
`cancelled` row with its reason, so `hermes cron runs <job_id>` shows why it stopped instead of an
unexplained timeout or a bare failure. A cancelled run sends no failure notice and does not count
-toward the job's failure streak. The same stop is available as `POST /api/cron/jobs/{id}/cancel`
-and as the agent's `cronjob_manage` action `cancel`.
+toward the job's failure streak. The same stop is available as `POST /api/cron/jobs/{id}/cancel`,
+as the agent's `cronjob_manage` action `cancel`, and in the Desktop: a job with a run in flight
+shows **Stop** in its header (it reads **Stopping…** until the run has booked its `cancelled`
+row, then a *Run cancelled* toast confirms it).
**Removing a job stops its live run.** `hermes cron remove` (and the dashboard/Desktop delete or
the agent's `remove` action) cancels a run that is in flight, booked `cancelled` with the reason
@@ -1172,7 +1174,8 @@ hermes cron create "0 7 * * 1-5" "Morning brief" --catch-up off # a stale brie
hermes cron edit <job> --catch-up on # always run once on return
```
-(`cronjob_manage` takes `catch_up: true|false`.) Without it, recurring jobs follow
+(`cronjob_manage` takes `catch_up: true|false`; the Desktop job editor has the same choice as
+**Missed runs**: *Use the default*, *Run once when back*, *Skip them*.) Without it, recurring jobs follow
`cron.catch_up_missed` and one-shots keep their 120-second grace: a reminder missed by more than
that is dropped. A one-shot with `--catch-up on` instead fires once, late, when the scheduler is
back.