feat(cron): support command jobs#89712
Conversation
|
Codex review: found issues before merge. Reviewed June 7, 2026, 10:51 PM ET / 02:51 UTC. Summary PR surface: Source +1091, Tests +776, Docs +78. Total +1945 across 45 files. Reproducibility: not applicable. as a bug reproduction; this is a feature PR. Source inspection confirms current main lacks a command cron payload variant and rejects non-agentTurn isolated cron payloads. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land only after maintainer security/upgrade review accepts the admin command-execution boundary and the doctor migration heuristic, with the small Control UI i18n cleanup addressed or explicitly deferred. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR. Source inspection confirms current main lacks a command cron payload variant and rejects non-agentTurn isolated cron payloads. Is this the best way to solve the issue? Mostly yes, but not fully merge-ready. CLI/API-first command payloads are a bounded core solution for deterministic cron work, while the security boundary and doctor conversion heuristic need maintainer acceptance and the new Control UI labels should use the i18n source strings. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 4780546c124d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1091, Tests +776, Docs +78. Total +1945 across 45 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
d38c43b to
732cead
Compare
Summary
What problem does this PR solve?
Scheduled shell-style cron work currently has to go through an isolated agent/model run, which adds setup pressure and makes simple command jobs more expensive and more fragile than they need to be.
Why does this matter now?
Gateway cron pressure is visible in production-style scheduled workloads. Staggering existing schedules is still the right immediate load-reduction step, but OpenClaw also needs a first-class path for jobs that are command execution rather than agent reasoning.
What is the intended outcome?
Command cron jobs can be stored, edited, and executed by the gateway scheduler as command payloads, with stdout/stderr capture, timeout handling, output limits, failure reporting, and
NO_REPLYsuppression.openclaw doctor --fixcan convert exact legacy command-template agent jobs only when they already had shell-capable tool access, and it warns on mixed shell-style agent prompts that still need manual conversion.What is intentionally out of scope?
Command authoring remains CLI-first in this PR. The UI preserves and displays existing command cron jobs, but it does not add a full command-job authoring flow. This PR also does not rewrite arbitrary natural-language agent cron prompts into commands.
What does success look like?
Existing agent cron jobs keep working, command cron payloads round-trip through schema/store/CLI/UI surfaces, the gateway cron runner executes command jobs without starting an isolated agent/model run, and doctor does not silently turn restricted agent prompts into gateway shell execution.
What should reviewers focus on?
Cron payload compatibility, command execution boundaries, output suppression semantics, timeout/error behavior, doctor migration safety, and whether the CLI/API surface is narrow enough for this first step.
Linked context
Which issue does this close?
No closing issue yet. Candidate canonical tracker is #18160, but this PR leaves it as related until maintainers decide whether CLI/API-first command jobs are enough to close the broader direct-exec cron request.
Which issues, PRs, or discussions are related?
Related #18160, #62789, #64598, #69455, #61152, #63107, #82662, #84567, #86893, #89055, #89442.
Was this requested by a maintainer or owner?
Owner/maintainer requested in response to production cron pressure and the need to run shell-style scheduled work inside OpenClaw instead of as separate OS cron jobs.
Real behavior proof (required for external PRs)
NO_REPLYsuppression. Doctor also distinguishes safe exact command-template conversion from unresolved shell-style agent prompts.git diff --check origin/main...HEAD;node scripts/run-vitest.mjs src/commands/doctor/cron/store-migration.test.ts src/commands/doctor/cron/index.test.ts src/cron/command-runner.test.ts src/cron/normalize.test.ts;AUTOREVIEW_AUTO_TESTS=0 .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt 'Only report P0/P1 correctness, data-loss, security, or production-breakage findings. Omit P2/P3 findings entirely. Focus on command cron execution boundaries, doctor migration false positives/false negatives, delivery semantics, and whether unresolved shell-style agentTurn jobs are handled safely.'; deployed gatewayopenclaw cron run --waiton representative command cron jobs that cover silentNO_REPLY, announced media output, and delivery suppression.git diff --check origin/main...HEADpassed. P0/P1-scoped autoreview reportedautoreview clean: no accepted/actionable findings reported. Deployed command cron runs returnedstatus: okfor silentNO_REPLYjobs and for an announced media-output job; the announced run delivered successfully, while silent runs were not delivered.Tests and validation
Which commands did you run?
git diff --check origin/main...HEADnode scripts/run-vitest.mjs src/commands/doctor/cron/store-migration.test.ts src/commands/doctor/cron/index.test.ts src/cron/command-runner.test.ts src/cron/normalize.test.tsAUTOREVIEW_AUTO_TESTS=0 .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt 'Only report P0/P1 correctness, data-loss, security, or production-breakage findings. Omit P2/P3 findings entirely. Focus on command cron execution boundaries, doctor migration false positives/false negatives, delivery semantics, and whether unresolved shell-style agentTurn jobs are handled safely.'Deployed gateway
openclaw cron run --waiton representative command cron jobs covering silent output, media output, and delivery suppression.What regression coverage was added or updated?
Protocol cron validators, cron store/normalization, command runner, gateway cron execution, CLI cron add/edit behavior, agent cron tool rejection of command payloads, UI cron controller preservation/display coverage, and doctor migration coverage for exact command-template conversion versus unresolved shell-style agent prompts. Follow-up coverage pins command timeout/no-output/abort failures as cron errors, keeps delivery-only / timeout-only CLI edits from corrupting existing command payloads, prevents restricted agent prompts from being auto-converted into gateway shell commands, and warns on omitted/wildcard shell-capable tool allowlists.
What failed before this fix, if known?
Command cron payloads were not a supported first-class scheduled job type, so the gateway cron runner could not execute shell-style work directly as a cron command payload. Legacy shell-style agent prompts could also remain model-mediated and fail in isolated cron sessions without shell/process tools.
If no test was added, why not?
N/A. Focused regression coverage was added/updated across the touched surfaces.
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes. CLI/API cron jobs can now include command payloads, existing command jobs are preserved/displayed by the UI, and doctor can repair or flag legacy shell-style cron payloads.
Did config, environment, or migration behavior change? (
Yes/No)Yes.
openclaw doctor --fixnow performs bounded command-cron payload repair for exact legacy templates and reports unresolved shell-style agent prompts that require manual conversion.Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)Yes. This adds a first-class scheduled command execution path inside the gateway cron runner.
What is the highest-risk area?
Command execution semantics and migration safety: command jobs must be explicit command payloads, bounded by timeout/output limits, and doctor must not silently escalate restricted agent prompts into gateway shell execution.
How is that risk mitigated?
The implementation keeps command authoring CLI/API scoped, rejects command payloads from the agent cron tool, runs commands through bounded command-runner coverage, caps output, records stderr/stdout, reports failures, preserves
NO_REPLYsuppression behavior, converts only exact command-template legacy jobs with shell-capable tool access, and warns rather than auto-converting ambiguous shell-style agent prompts.Current review state
What is the next action?
Maintainer review and GitHub CI. The PR remains draft because this touches command execution and migration behavior and should get explicit maintainer review before being marked ready.
What is still waiting on author, maintainer, CI, or external proof?
Waiting on CI for the refreshed head and maintainer judgment on the command execution boundary. No known P0/P1 autoreview findings remain.
Which bot or reviewer comments were addressed?
P0/P1-scoped autoreview initially found two doctor migration safety issues: restricted command-shaped prompts could be auto-converted, and omitted/wildcard tool allowlists were not reported as shell-capable. Both were fixed with regression tests, and the final P0/P1-scoped autoreview run was clean.