From 772b5fdf0fa1dabb18f79b9278f45be0d721044c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 13 Dec 2025 03:49:29 +0000 Subject: [PATCH] feat(cron): default scheduler enabled --- docs/configuration.md | 2 +- docs/cron.md | 10 +++++++--- src/cli/cron-cli.ts | 2 +- src/gateway/server.ts | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 2dd747cab..64c40c625 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -118,7 +118,7 @@ Cron is a Gateway-owned scheduler for wakeups and scheduled jobs. See `docs/cron | Key | Type | Default | Description | |-----|------|---------|-------------| -| `enabled` | boolean | `false` | Enable the cron scheduler inside the Gateway | +| `enabled` | boolean | `true` | Enable the cron scheduler inside the Gateway (set to `false` to disable) | | `store` | string | *(auto)* | Override the cron job store path (defaults to `~/.clawdis/cron/jobs.json` if present, otherwise `~/.clawdis/cron.json`) | | `maxConcurrentRuns` | number | `1` | Max concurrent isolated cron runs (command-queue lane `"cron"`) | diff --git a/docs/cron.md b/docs/cron.md index ee4f8bb6e..dee8056fb 100644 --- a/docs/cron.md +++ b/docs/cron.md @@ -100,12 +100,14 @@ The scheduler should never require additional configuration for the base directo ## Enabling -Cron execution should be opt-in via config: +Cron execution is enabled by default inside the Gateway. + +To disable it, set: ```json5 { cron: { - enabled: true, + enabled: false, // optional: store: "~/.clawdis/cron.json", maxConcurrentRuns: 1 @@ -113,6 +115,8 @@ Cron execution should be opt-in via config: } ``` +You can also disable scheduling via the environment variable `CLAWDIS_SKIP_CRON=1`. + ## Scheduler design ### Ownership @@ -344,7 +348,7 @@ Suggested log events: - Respect existing allowlists/routing rules: delivery defaults should not send to arbitrary destinations unless explicitly configured. - Provide a global “kill switch”: - - `cron.enabled: boolean` config default true (or false until enabled). + - `cron.enabled: boolean` (default `true`). - `gateway method set-heartbeats` already exists; cron should have similar. - Avoid persistence of sensitive payloads unless requested; job text may contain private content. diff --git a/src/cli/cron-cli.ts b/src/cli/cron-cli.ts index 189b9718b..3d7f2bd87 100644 --- a/src/cli/cron-cli.ts +++ b/src/cli/cron-cli.ts @@ -15,7 +15,7 @@ async function warnIfCronSchedulerDisabled(opts: GatewayRpcOpts) { defaultRuntime.error( [ "warning: cron scheduler is disabled in the Gateway; jobs are saved but will not run automatically.", - "Enable with `cron.enabled: true` in your clawdis config and restart the Gateway.", + "Re-enable with `cron.enabled: true` (or remove `cron.enabled: false`) and restart the Gateway.", store ? `store: ${store}` : "", ] .filter(Boolean) diff --git a/src/gateway/server.ts b/src/gateway/server.ts index 84b9aa30d..1cdd9ae81 100644 --- a/src/gateway/server.ts +++ b/src/gateway/server.ts @@ -387,7 +387,7 @@ export async function startGatewayServer( }); const deps = createDefaultDeps(); const cronEnabled = - process.env.CLAWDIS_SKIP_CRON !== "1" && cfgAtStart.cron?.enabled === true; + process.env.CLAWDIS_SKIP_CRON !== "1" && cfgAtStart.cron?.enabled !== false; const cron = new CronService({ storePath: cronStorePath, cronEnabled,