Skip to content

fix(cron): reject blank script paths before mutations - #148787

Merged
obviyus merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-cron-blank-script-path
Sep 15, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-cron-blank-script-path

Conversation

@Alix-007

@Alix-007 Alix-007 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

An empty $SCRIPT_FILE silently drops a requested script replacement while other job edits succeed. Add can likewise accept another payload and ignore the blank script.

Why This Change Was Made

The existing add/edit validation owns script-argument acceptance. Each handler gains three lines to reject explicit blanks before any Gateway request. This state has one writer: the existing Gateway cron service.

Growth accepted under the owner's standing acceptance (2026-09-15).

User Impact

Invalid input reports --script must not be blank. Omitted scripts and exact nonblank filenames remain valid.

Evidence

On a disabled job in an isolated Gateway:

SCRIPT_FILE=""; openclaw cron edit "$JOB" --script "$SCRIPT_FILE" --display-name Replacement

Main exits 0, changes the label, and retains the old script. The fix exits 1 with the diagnostic, zero connections, and unchanged job readback. Whitespace and blank-plus-message add cases show the same repair.

Omitted-script edits, spaced filenames with a distinct trimmed decoy, stdin, and empty/missing files passed. Local static checks passed.

Persistence was checked after stopping the actual Gateway process, confirming that its children exited and its port closed, then starting a new Gateway. The new listener belonged to the new launcher and had the intended database open before the saved-job readback. The job was unchanged across that restart. Main-created state was also reopened with the candidate. The earlier restart observations were excluded because they reached the original process.

The four CLI suites passed all 421 tests on merge commit 84bdc1b42e01d13434a531edb25dc809e2ee7399, with parents 63f2d06f1178aa41aefabf679049c0dd86280871 and aa688090a4cddbca64abe8bad3b8f778cca8eb4d. The tests add four registered-command cases and retain every existing assertion. Scheduled execution and delivery were not exercised.

Compatibility

No new options, schema, migration, or execution changes. Scheduled execution and delivery were not exercised.

Consumers

cron/automations add/create and edit share the repaired registration.

Invalidation

No cache or stored-state change.

Tests

Four new command regressions; existing sibling controls retained.

@clawsweeper

clawsweeper Bot commented Sep 15, 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 Sep 15, 2026
@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 3:31 AM ET / 07:31 UTC (Revision 2).

ClawSweeper review

What this changes

Reject empty or whitespace-only script paths in automation add and edit commands before Gateway access, with command-level regression coverage.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main still silently ignores explicit blank script paths. The focused repair has relevant real Gateway observations and no actionable correctness findings.

Priority: P2
Reviewed head: 84bdc1b42e01d13434a531edb25dc809e2ee7399

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant real Gateway observations, meaningful command regressions, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.
Evidence reviewed 7 items Current main still needs the repair: Comparing the inspected production handlers and payload helper against fetched main shows only the two new rejection guards; main still treats a blank script path as absent.
Early rejection preserves the existing owner: The edit guard precedes existing-job reads and patch construction. The existing payload helper otherwise omits blank scripts while allowing unrelated fields to reach cron.update; the repair adds no alternate state writer.
Regression coverage targets observable behavior: The added registered-command cases cover empty and whitespace inputs. Edit combines the invalid script with display-name and pacing changes and asserts exit 1 without any Gateway call; add combines it with an otherwise valid message payload. Existing literal-filename controls remain intact. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

The automation CLI converts command arguments and local script files into Gateway requests that create or update scheduled jobs. Local validation prevents invalid input from partially changing those jobs.

flowchart TD
  A[Automation command arguments] --> B[CLI input validation]
  B --> C{Explicit blank script path?}
  C -->|Yes| D[Error with no Gateway request]
  C -->|No| E[Prepare job payload or patch]
  E --> F[Gateway automation service]
  F --> G[Saved scheduled job]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +20. Total +26 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 0 +6
Tests 2 20 0 +20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 26 0 +26

Review metrics

None.

Technical review

Best possible solution:

Keep blank-path rejection in the existing CLI handlers while preserving omitted scripts, stdin, literal filenames, and Gateway-owned job persistence.

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

Yes: current source shows that an explicit blank script becomes absent while unrelated edits can proceed, matching the supplied isolated Gateway observations; this reviewer did not execute it.

Is this the best way to solve the issue?

Yes: the guards repair argument acceptance before Gateway access, reuse existing normalization, and preserve the established literal-path behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5a826aa18d3d.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.

Label justifications:

  • P2: This repairs a bounded CLI input-validation defect that can silently apply only part of an intended automation edit.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied live observations exercise the changed add/edit CLI handlers against an isolated Gateway and show rejection before connection, unchanged job readback, valid-input controls, and persistence across a verified restart; scheduled execution is outside this patch.

Evidence

What I checked:

  • Current main still needs the repair: Comparing the inspected production handlers and payload helper against fetched main shows only the two new rejection guards; main still treats a blank script path as absent. (src/cli/cron-cli/register.cron-add.ts:149, 84bdc1b42e01)
  • Early rejection preserves the existing owner: The edit guard precedes existing-job reads and patch construction. The existing payload helper otherwise omits blank scripts while allowing unrelated fields to reach cron.update; the repair adds no alternate state writer. (src/cli/cron-cli/register.cron-edit.ts:115, 84bdc1b42e01)
  • Regression coverage targets observable behavior: The added registered-command cases cover empty and whitespace inputs. Edit combines the invalid script with display-name and pacing changes and asserts exit 1 without any Gateway call; add combines it with an otherwise valid message payload. Existing literal-filename controls remain intact. Tests were inspected, not executed during this read-only review. (src/cli/cron-cli/register.cron-edit.test.ts:194, 84bdc1b42e01)
  • Real behavior evidence: The supplied complete PR body records an isolated Gateway comparison: the original edit succeeds and changes the label while retaining the old script; the candidate exits 1 with the diagnostic, zero connections, and unchanged job readback. It also records whitespace/add cases, valid filename and stdin controls, verified process replacement before restart readback, and reopening main-created state. The captured context sourceRevision is 675b89828789372c864cfcf269ec04203b02775af3d233d3fc7208b4c9fb14da. These are contributor-reported live observations, not reviewer execution. (84bdc1b42e01)
  • Related merged work preserves literal paths: GitHub verifies fix(cron): preserve literal script file paths #145673 as merged. Its patch introduces whitespace-preserving path reads, which this PR retains; it does not reject explicitly blank payload paths. (src/cli/cron-cli/register.cron-add.ts:148, 86c1a44ea6e9)
  • Release check: The latest supplied release, v2026.9.4, normalizes script paths into optional values and counts only nonblank payloads, so it also lacks the add rejection. No shipped fix is established. (src/cli/cron-cli/register.cron-add.ts:146, 3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-15T05:16:49.956Z sha 63f2d06 :: needs maintainer review before merge. :: none

@obviyus
obviyus marked this pull request as draft September 15, 2026 07:09
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-admin-merge
pr: 148787
head: 84bdc1b
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 15, 2026 07:23
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@obviyus
obviyus merged commit 7dcdb14 into openclaw:main Sep 15, 2026
186 of 188 checks passed
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Alix-007!

Proof: Empty and whitespace-only script arguments fail before any Gateway connection and leave saved jobs unchanged. Valid filenames, stdin, and metadata-only edits still work.

  • Bug: A blank script argument silently kept the old script while other edits succeeded, or allowed another payload during creation.
  • Fix: Add and edit reject the invalid argument before reading or changing a job.
Before After
Blank script input could report success and apply a partial edit. Exit 1 with --script must not be blank; no Gateway request or saved change.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '0945dabbe487213e95e84a72ad1aae3659e0e000': (115 commits)
  fix: omit automation service aliases from squash coauthors (#148883)
  test: restore services typecheck shard headroom (#148885)
  perf(trajectory): avoid native probes for truncation records (#148870)
  improve(gateway): load cron only when reload requests it (#143500)
  fix: resolve issue #146088 — [Bug]: The most recent Linux AppImage does not ship with the correct versions of libs needed to run (#148174)
  refactor(theme): share nonvirtual ANSI color lookup (#148717)
  perf(gateway): scope exact session row topology reads (#148836)
  improve(memory): reduce vector replacement overhead (#148201)
  fix(i18n): keep HTTP headers out of native translations (#147119)
  refactor(plugins): share source-root display formatting (#148646)
  fix(cron): reject blank script paths before mutations (#148787)
  refactor(config): share audit positional scanning (#148643)
  fix(test): restore infrastructure typecheck shard headroom (#148861)
  fix(release): harden package validation fallbacks (#148729)
  refactor(config): share leaf and descendant unset pruning (#148216)
  test: reuse prepared runtime for pristine preflight (#148858)
  fix(ui): settle global model drafts across agent switches (#148843)
  fix(queue): avoid repeated scans when cancelling backlogs (#148754)
  fix(logging): orphaned \\\\?\\ path markers corrupt redacted Windows diagnostics (#147542)
  refactor(hooks): share optional reply metadata projection (#148641)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
## What Problem This Solves

An empty `$SCRIPT_FILE` silently drops a requested script replacement while other job edits succeed. Add can likewise accept another payload and ignore the blank script.

## Why This Change Was Made

The existing add/edit validation owns script-argument acceptance. Each handler gains three lines to reject explicit blanks before any Gateway request. This state has one writer: the existing Gateway cron service.

Growth accepted under the owner's standing acceptance (2026-09-15).

## User Impact

Invalid input reports `--script must not be blank`. Omitted scripts and exact nonblank filenames remain valid.

## Evidence

On a disabled job in an isolated Gateway:

`SCRIPT_FILE=""; openclaw cron edit "$JOB" --script "$SCRIPT_FILE" --display-name Replacement`

Main exits 0, changes the label, and retains the old script. The fix exits 1 with the diagnostic, zero connections, and unchanged job readback. Whitespace and blank-plus-message add cases show the same repair.

Omitted-script edits, spaced filenames with a distinct trimmed decoy, stdin, and empty/missing files passed. Local static checks passed.

Persistence was checked after stopping the actual Gateway process, confirming that its children exited and its port closed, then starting a new Gateway. The new listener belonged to the new launcher and had the intended database open before the saved-job readback. The job was unchanged across that restart. Main-created state was also reopened with the candidate. The earlier restart observations were excluded because they reached the original process.

The four CLI suites passed all 421 tests on merge commit `84bdc1b42e01d13434a531edb25dc809e2ee7399`, with parents `63f2d06f1178aa41aefabf679049c0dd86280871` and `23a4c20ecd38eb72af26d7327cb54a86e44ae65c`. The tests add four registered-command cases and retain every existing assertion. Scheduled execution and delivery were not exercised.

## Compatibility

No new options, schema, migration, or execution changes. Scheduled execution and delivery were not exercised.

## Consumers

`cron`/`automations` add/create and edit share the repaired registration.

## Invalidation

No cache or stored-state change.

## Tests

Four new command regressions; existing sibling controls retained.

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.

2 participants