feat(cron): default scheduler enabled

main
Peter Steinberger 2025-12-13 03:49:29 +00:00
parent eace21dcae
commit 772b5fdf0f
4 changed files with 10 additions and 6 deletions

View File

@ -118,7 +118,7 @@ Cron is a Gateway-owned scheduler for wakeups and scheduled jobs. See `docs/cron
| Key | Type | Default | Description | | 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`) | | `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"`) | | `maxConcurrentRuns` | number | `1` | Max concurrent isolated cron runs (command-queue lane `"cron"`) |

View File

@ -100,12 +100,14 @@ The scheduler should never require additional configuration for the base directo
## Enabling ## Enabling
Cron execution should be opt-in via config: Cron execution is enabled by default inside the Gateway.
To disable it, set:
```json5 ```json5
{ {
cron: { cron: {
enabled: true, enabled: false,
// optional: // optional:
store: "~/.clawdis/cron.json", store: "~/.clawdis/cron.json",
maxConcurrentRuns: 1 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 ## Scheduler design
### Ownership ### Ownership
@ -344,7 +348,7 @@ Suggested log events:
- Respect existing allowlists/routing rules: delivery defaults should not send to arbitrary destinations unless explicitly configured. - Respect existing allowlists/routing rules: delivery defaults should not send to arbitrary destinations unless explicitly configured.
- Provide a global “kill switch”: - 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. - `gateway method set-heartbeats` already exists; cron should have similar.
- Avoid persistence of sensitive payloads unless requested; job text may contain private content. - Avoid persistence of sensitive payloads unless requested; job text may contain private content.

View File

@ -15,7 +15,7 @@ async function warnIfCronSchedulerDisabled(opts: GatewayRpcOpts) {
defaultRuntime.error( defaultRuntime.error(
[ [
"warning: cron scheduler is disabled in the Gateway; jobs are saved but will not run automatically.", "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}` : "", store ? `store: ${store}` : "",
] ]
.filter(Boolean) .filter(Boolean)

View File

@ -387,7 +387,7 @@ export async function startGatewayServer(
}); });
const deps = createDefaultDeps(); const deps = createDefaultDeps();
const cronEnabled = 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({ const cron = new CronService({
storePath: cronStorePath, storePath: cronStorePath,
cronEnabled, cronEnabled,