Skip to content

Commit 99d1303

Browse files
Galin IlievGalin Iliev
authored andcommitted
docs: clarify cron wait usage
1 parent af722c8 commit 99d1303

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Docs: https://docs.openclaw.ai
77
### Changes
88

99
- Providers/xAI: add xAI Grok OAuth login for SuperGrok subscribers, letting `xai/*` models and xAI media/tool providers authenticate without `XAI_API_KEY`.
10+
- CLI/cron: add `openclaw cron run --wait` with timeout and poll interval controls, plus exact `cron.runs --run-id` filtering so automation can block on one queued manual run. (#81929) Thanks @ificator.
1011
- Maintainer tooling: route Crabbox skill defaults through the repo brokered AWS config, leaving Blacksmith Testbox as an explicit opt-in instead of the broad-proof default.
1112
- CLI/onboarding: localize the setup wizard and bundled channel setup flows for English, Simplified Chinese, and Traditional Chinese. (#80645) Thanks @GaosCode.
1213
- Agents/skills: cache hydrated `resolvedSkills` across warm gateway turns while keying reuse by the redacted effective config, reducing redundant skill snapshot rebuilds without crossing config-gated skill boundaries. (#81451) Thanks @solodmd.

‎docs/automation/cron-jobs.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ openclaw cron edit <jobId> --message "Updated prompt" --model "opus"
373373
openclaw cron run <jobId>
374374

375375
# Force run a job now and wait for its terminal status
376-
openclaw cron run <jobId> --wait --wait-timeout 10m
376+
openclaw cron run <jobId> --wait --wait-timeout 10m --poll-interval 2s
377377

378378
# Run only if due
379379
openclaw cron run <jobId> --due
@@ -392,6 +392,8 @@ openclaw cron add --name "Ops sweep" --cron "0 6 * * *" --session isolated --mes
392392
openclaw cron edit <jobId> --clear-agent
393393
```
394394

395+
`openclaw cron run <jobId>` returns after enqueueing the manual run. Use `--wait` for shutdown hooks, maintenance scripts, or other automation that must block until the queued run finishes. Wait mode polls the exact returned `runId`; it exits `0` for status `ok` and non-zero for `error`, `skipped`, or a wait timeout.
396+
395397
<Note>
396398
Model override note:
397399

‎docs/cli/cron.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,23 @@ Note: cron job definitions live in `jobs.json`, while pending runtime state live
100100

101101
### Manual runs
102102

103-
`openclaw cron run` returns as soon as the manual run is queued. Successful responses include `{ ok: true, enqueued: true, runId }`. Use `openclaw cron runs --id <job-id>` to follow the eventual outcome, or add `--wait` to keep the CLI open until that queued run records a terminal status.
103+
`openclaw cron run <job-id>` force-runs by default and returns as soon as the manual run is queued. Successful responses include `{ ok: true, enqueued: true, runId }`. Use the returned `runId` to inspect the later result:
104+
105+
```bash
106+
openclaw cron run <job-id>
107+
openclaw cron runs --id <job-id> --run-id <run-id>
108+
```
109+
110+
Add `--wait` when a script should block until that exact queued run records a terminal status:
104111

105112
```bash
106113
openclaw cron run <job-id> --wait --wait-timeout 10m --poll-interval 2s
107114
```
108115

109-
With `--wait`, the command exits `0` only when the run finishes with `ok`; `error`, `skipped`, or a wait timeout exit non-zero. `openclaw cron runs --id <job-id> --run-id <run-id>` filters history to one exact run.
116+
With `--wait`, the CLI still calls `cron.run` first, then polls `cron.runs` for the returned `runId`. The command exits `0` only when the run finishes with status `ok`. It exits non-zero when the run finishes with `error` or `skipped`, when the Gateway response does not include a `runId`, or when `--wait-timeout` expires. `--poll-interval` must be greater than zero.
110117

111118
<Note>
112-
`openclaw cron run <job-id>` force-runs by default. Use `--due` to keep the older "only run if due" behavior.
119+
Use `--due` when you want the manual command to run only if the job is currently due. If `--due --wait` does not enqueue a run, the command returns the normal non-run response instead of polling.
113120
</Note>
114121

115122
## Models
@@ -233,6 +240,7 @@ openclaw cron show <job-id>
233240
openclaw cron run <job-id>
234241
openclaw cron run <job-id> --due
235242
openclaw cron run <job-id> --wait --wait-timeout 10m
243+
openclaw cron run <job-id> --wait --wait-timeout 10m --poll-interval 2s
236244
openclaw cron runs --id <job-id> --limit 50
237245
openclaw cron runs --id <job-id> --run-id <run-id>
238246
```

‎docs/gateway/protocol.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ enumeration of `src/gateway/server-methods/*.ts`.
460460

461461
<Accordion title="Automation, skills, and tools">
462462
- Automation: `wake` schedules an immediate or next-heartbeat wake text injection; `cron.get`, `cron.list`, `cron.status`, `cron.add`, `cron.update`, `cron.remove`, `cron.run`, `cron.runs` manage scheduled work.
463-
- `cron.runs` accepts an optional `runId` filter so clients can follow one queued manual run without racing against other history entries for the same job.
463+
- `cron.run` remains an enqueue-style RPC for manual runs. Clients that need completion semantics should read the returned `runId` and poll `cron.runs`.
464+
- `cron.runs` accepts an optional non-empty `runId` filter so clients can follow one queued manual run without racing against other history entries for the same job.
464465
- Skills and tools: `commands.list`, `skills.*`, `tools.catalog`, `tools.effective`, `tools.invoke`.
465466

466467
</Accordion>

0 commit comments

Comments
 (0)