Skip to content

fix(cron): reject explicitly blank stagger values - #198596

Merged
obviyus merged 3 commits into
openclaw:mainfrom
Wang-Zephyr:fix/cron-explicit-blank-stagger
Nov 14, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
Wang-Zephyr:fix/cron-explicit-blank-stagger

Conversation

@Wang-Zephyr

@Wang-Zephyr Wang-Zephyr commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #198594

What Problem This Solves

cron edit silently accepts a whitespace-only --stagger and applies the schedule edit, dropping the existing explicit stagger.

Why This Change Was Made

Distinguish a blank argument from an omitted flag in the shared add/edit schedule parser so the invalid request is rejected before it can mutate the job.

Evidence

Ran the built openclaw.mjs from 897c35fb2439 on Windows with Node 24.22.1 against a real gateway run on loopback. Each lane used fresh state, no provider credentials, and a disabled cron job with 0 * * * * and --stagger 30s. For the baseline control, temporarily removed just the new guard from the built CLI chunk to restore the 52e231b703f7 edit behavior. The Gateway and remaining CLI code were identical in both lanes.

node openclaw.mjs cron add --name stagger-proof --cron '0 * * * *' --stagger 30s --session main --system-event proof --disabled --json
node openclaw.mjs cron edit JOB_ID --cron '10 * * * *' --stagger ' '
node openclaw.mjs cron list --all --json
Lane Edit exit and stderr Stored cron expression Stored staggerMs
Baseline behavior 0, empty stderr 10 * * * * absent
PR head 1, Invalid --stagger; use e.g. 30s, 1m, 5m 0 * * * * 30000

The valid control, cron edit JOB_ID --cron '20 * * * *' --stagger 45s, exited 0 and stored 20 * * * * and 45000 in both lanes. Values were read back through the CLI after each edit.

The Commander regression also fails on the original parser and passes on the PR. The trigger, positional, and on-exit files passed locally (126 focused tests), along with targeted formatting and lint. Standalone autoreview was unavailable.

OpenAI Codex assisted with the fix and verification.

Maintainer e2e proof (built CLI + isolated Gateway): #198596 (comment)

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS labels Nov 14, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Reject explicitly empty or whitespace-only --stagger arguments before creating or updating a cron job.

Example: Edit a job storing cron expression 0 * * * * and staggerMs 30000 with --cron '10 * * * *' --stagger ' '.

  • Before: The command succeeds, changes the expression, and drops the explicit stagger.
  • After: The command exits 1 with duration examples and preserves the original schedule.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful minimal fix with exact-head CLI/Gateway proof, a reported red-to-green regression, and no findings; broad CI remains incomplete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The exact-head comment records the built CLI against an isolated Gateway in a secretless Node container, showing blank-input rejection and unchanged stored values alongside valid-duration and omitted-flag controls.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An explicitly blank stagger argument succeeds while changing the schedule and losing the existing explicit stagger.
Reason: Rejecting an invalid duration restores the existing duration contract without adding options, defaults, or operator steps.

Merge readiness

✅ Ready for maintainer review

This PR fixes a distinct current-main bug with a minimal shared-parser change and no actionable findings; exact-head CI is still running.

Priority: P2
Reviewed head: 4361fd7462fef8ae15f0a005bde8bb11b683dc54

Before merge

None.

Findings

None.

Agent review details

How this fits together

Commander passes add/edit options into the shared schedule resolver, which validates them before the CLI sends job mutations to the Gateway.

flowchart LR
  A[CLI arguments] --> B[Commander add or edit]
  B --> C[Shared schedule resolver]
  C --> D[Invalid input error]
  C --> E[Gateway cron mutation]
  E --> F[Stored job schedule]
Loading

Technical review

Best possible solution:

Keep the focused supplied-versus-omitted check in the existing shared schedule resolver.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the failure path, and the supplied real CLI/Gateway comparison records the mutation before the fix and rejection afterward; this review ran no target code.

Is this the best way to solve the issue?

The change fixes the input boundary shared by add and edit, preserves omission and valid durations, and adds no competing parser or state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 94cc426fb0b4.

Provenance checked

  • Shared stagger normalization keeps the original intent (c26cf6a: Stagger controls distinguish omitted timing overrides from explicit durations and exact timing; subsequent extraction and normalization retain that contract.)
  • Blank schedule validation keeps the original intent (fix(cron): reject blank schedule values before applying edits #148271: Reject supplied blank schedule selectors before mutation while preserving omission; the earlier repair explicitly left staggering unchanged.)
  • Commander rejection coverage keeps the original intent (e003183: Consolidate repeated test setup while retaining distinct behavioral contracts; the PR extends the existing rejection table and retains blank trigger-script rejection.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 859c0de adds src/cli/cron-cli/schedule-options.ts:208 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 859c0def55b0; files: src/cli/cron-cli/schedule-options.ts)
  • ZephyrWang: Raw commit d98ec68 adds src/cli/cron-cli/schedule-options.ts:193 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d98ec68ceded; files: src/cli/cron-cli/schedule-options.ts)

PR surface

Source +3, Tests -5. Total -2 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 2 7 -5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 7 -2

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #198594
Summary: This PR implements the linked issue's blank-stagger rejection; the earlier blank-selector repair addresses adjacent inputs.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on maintainer: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A bounded CLI input-validation bug can silently replace a requested schedule and discard its explicit stagger.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-14T02:59:54.534Z sha 897c35f :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-14T03:50:25.986Z sha 897c35f :: blocked before merge. :: none

Reviewed November 13, 2026, 11:33 PM ET / November 14, 2026, 04:33 UTC (Revision 3).

@Wang-Zephyr

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added built CLI evidence against an isolated real Gateway to the PR body. The baseline behavior exits 0 and mutates the stored schedule. At 897c35fb2439, the blank edit exits 1 and leaves both the cron expression and the existing 30-second stagger intact. A valid 45-second stagger control succeeds in both runs.

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 14, 2026
@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Proof for head 4361fd7: built openclaw.mjs in a secretless node:24.22.1 container, against a real isolated gateway run (own profile, state dir and port). Each job was created with cron add --cron '0 * * * *' --stagger 30s --disabled, then edited. The schedule is read back with cron list --json.

lane=main scenario=blank-stagger cmd="cron edit <id> '--cron' '10 * * * *' '--stagger' ' '" exit=0 stderr="" before={"kind":"cron","expr":"0 * * * *","staggerMs":30000} after={"kind":"cron","expr":"10 * * * *"}
lane=pr   scenario=blank-stagger cmd="cron edit <id> '--cron' '10 * * * *' '--stagger' ' '" exit=1 stderr="Invalid --stagger; use e.g. 30s, 1m, 5m " before={"kind":"cron","expr":"0 * * * *","staggerMs":30000} after={"kind":"cron","expr":"0 * * * *","staggerMs":30000}

controls (same result on main and the PR):
stagger-45s   cmd="cron edit <id> '--cron' '10 * * * *' '--stagger' '45s'"                exit=0 after={"kind":"cron","expr":"10 * * * *","staggerMs":45000}
no-stagger    cmd="cron edit <id> '--name' 'p-no-stagger-renamed'"                        exit=0 after={"kind":"cron","expr":"0 * * * *","staggerMs":30000}
range-stagger cmd="cron edit <id> '--cron' '10 * * * *' '--stagger' '8640000000000001ms'" exit=1 stderr="Invalid --stagger; use e.g. 30s, 1m, 5m " after={"kind":"cron","expr":"0 * * * *","staggerMs":30000}

The blank-stagger error on the PR matches main's existing out-of-range error byte for byte (cmp of the two stderr files). No message text changed.

Main is 41d0dec31bfc. I merged current main into the branch because it had changed schedule-options.ts. The tests now add the blank stagger case as one row in the existing reject table, and the separate blank --trigger-script add test became a row in that table too. The new row fails on main and passes here. Focused tests: 119 passed. oxfmt and oxlint are clean.

Thanks @Wang-Zephyr for the fix and the report in #198594.

@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Nov 14, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 14, 2026
@obviyus
obviyus merged commit 009fcd9 into openclaw:main Nov 14, 2026
122 of 123 checks passed
@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Landed in 009fcd9. Thanks @Wang-Zephyr.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
fix(cron): reject a blank --stagger instead of dropping the saved stagger

openclaw cron edit treated a blank --stagger value as if the option had been left out, so an edit such as --cron '10 * * * *' --stagger ' ' succeeded and silently dropped the job's saved stagger. A blank --stagger now raises the existing "Invalid --stagger" error before anything is sent, and the job is unchanged. Valid staggers, edits without --stagger and out-of-range staggers behave as before. No new text.

Evidence: the built CLI against a real isolated gateway run in a secretless node:24.22.1 container, main once and candidate once. On main the edit exited 0, changed the schedule and removed the 30000 ms stagger. With this change it exits 1 with "Invalid --stagger; use e.g. 30s, 1m, 5m" (byte-identical to main's existing error) and the job keeps its schedule and stagger. --stagger 45s, an edit without --stagger and an out-of-range stagger behave the same on both. The blank case is a row in the existing invalid-stagger table and fails on main, at -5 net test lines. Details: openclaw#198596 (comment).

Fixes openclaw#198594. Thanks @Wang-Zephyr.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cron edit silently accepts an explicitly blank --stagger

2 participants