Skip to content

fix(cron): reject blank automation working directories - #129714

Merged
steipete merged 1 commit into
mainfrom
codex/qa-cron-create-command-cwd-validation-20260825
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-cron-create-command-cwd-validation-20260825

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes automation creation accepting an explicitly empty or whitespace-only working directory and silently using the default directory.

User Impact

add and create reject blank --command-cwd, --on-exit-cwd, and --stream-cwd values before any Gateway request. Omitted and valid paths keep their existing behavior, and blank stream-directory edits still clear the configured directory. Errors retain the current human and JSON formats.

Why This Change Was Made

A small validation step belongs at the existing creation boundary. It uses CronCliError and the shared string normalizer while leaving edit normalization and numeric/zero-timeout handling intact. The CLI docs now explain creation rejection and stream-edit clearing.

Compatibility decision: accepting explicitly blank creation paths as errors is intentional. Scripts that expand an unset variable into one of these flags must omit the flag to use the default directory. The prevalence of scripts relying on the former silent coercion is unknown; that tradeoff is accepted to prevent creating an automation in an unintended directory. Existing automations and blank stream-directory edits keep their behavior.

Evidence

The registered-Commander baseline produced 17 intended blank-input failures while 49 controls and existing cases passed. After the repair, all 589 focused tests across eight files passed, covering creation flags, omitted/valid paths, both aliases, positional schedules, JSON error classification, edit clearing, scheduling, and numeric validation. Independent P2 review found no actionable issues. The tests use a mocked Gateway transport; no live automation was created. The final options file also passed all 66 cases. Final selected checks passed against the pinned base, including core and test typechecking, lint, formatting, and repository guards. git diff --check passed.

@clawsweeper

clawsweeper Bot commented Aug 26, 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: S maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 9:16 AM ET / 13:16 UTC (Revision 5).

ClawSweeper review

What this changes

Reject blank working-directory arguments when creating automations, preserve stream-directory clearing during edits, and document and test those behaviors.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful: current main still accepts blank creation directories, and the merged edit fix does not cover creation. No actionable patch defects were found. The PR body explicitly accepts the compatibility tradeoff raised in the previous review.

Priority: P2
Reviewed head: b2b130c1eb3be8dfe7023019bb021710e57df5cb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary coverage, an explicit compatibility disposition, and no actionable correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Evidence exercises the registered creation owner with mocked Gateway transport; it does not claim live automation execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Evidence exercises the registered creation owner with mocked Gateway transport; it does not claim live automation execution.
Evidence reviewed 8 items Introduced creation guard: The pinned introduced patch adds validation at the start of the creation action, before schedule resolution, script reads, and Gateway requests. It uses the existing normalizer and CLI error owner.
Current main still needs the change: Comparing the creation and schedule owners against fetched main shows precisely the new nine-line guard in the creation owner and no schedule-owner difference. Main still normalizes blank command directories to undefined; the schedule owner similarly omits blank on-exit and stream directories.
Latest release comparison: The creation owner at the supplied v2026.9.4 release SHA also lacks the creation guard and normalizes commandCwd directly. The requested rejection is not already present in that release.
Findings None None.
Security None None.

How this fits together

The automation CLI turns command-line arguments into Gateway requests that create scheduled jobs. This change rejects invalid directory arguments before a request can create a job using an unintended default directory.

flowchart TD
  A[Automation add or create] --> B[Check supplied directories]
  B -->|Blank| C[Local CLI error]
  B -->|Omitted or valid| D[Build schedule and payload]
  D --> E[Gateway creates automation]
  F[Automation edit] --> G[Existing directory clearing behavior]
Loading

Before merge

  • Resolve merge risk (P2) - Existing creation scripts that pass an empty variable as a cwd argument will fail after upgrading; how many scripts rely on the former fallback is unknown. The PR explicitly accepts this tradeoff and documents omitting the flag.
Agent review details

Security

None.

PR surface

Source +9, Tests +162, Docs +5. Total +176 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 0 +9
Tests 1 162 0 +162
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 176 0 +176

Review metrics

Metric Value Why it matters
Validation implementation and coverage Production +9 lines; tests +162 lines covering 32 added cases The small creation-boundary guard is justified by explicit-input validation, while coverage protects aliases, error formats, and preserved edit behavior.

Merge-risk options

Maintainer options:

  1. Retain the accepted blank-input rejection (recommended)
    Proceed with the documented tradeoff: scripts seeking the default directory must omit the cwd flag.

Technical review

Best possible solution:

Keep validation at the creation boundary, honoring the accepted compatibility decision while preserving omitted defaults and stream-edit clearing.

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

Yes, from source: current-main creation normalizes explicit blank cwd arguments into omitted directories. Registered-command regression cases cover the path, but this review did not run them.

Is this the best way to solve the issue?

Yes. A creation-only guard reuses existing normalization and error handling without changing the shared edit contract; the intentional compatibility change is documented and accepted.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded automation CLI validation repair with no demonstrated urgent outage.
  • merge-risk: 🚨 compatibility: Creation scripts passing blank cwd arguments will now fail instead of using the default directory, an explicitly accepted behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Evidence exercises the registered creation owner with mocked Gateway transport; it does not claim live automation execution.

Evidence

What I checked:

  • Introduced creation guard: The pinned introduced patch adds validation at the start of the creation action, before schedule resolution, script reads, and Gateway requests. It uses the existing normalizer and CLI error owner. (src/cli/cron-cli/register.cron-add.ts:105, b2b130c1eb3b)
  • Current main still needs the change: Comparing the creation and schedule owners against fetched main shows precisely the new nine-line guard in the creation owner and no schedule-owner difference. Main still normalizes blank command directories to undefined; the schedule owner similarly omits blank on-exit and stream directories. (src/cli/cron-cli/register.cron-add.ts:104, e14de8fe613e)
  • Latest release comparison: The creation owner at the supplied v2026.9.4 release SHA also lacks the creation guard and normalizes commandCwd directly. The requested rejection is not already present in that release. (src/cli/cron-cli/register.cron-add.ts:232, 3a9d69db306c)
  • Boundary regression coverage: The added 32 table-expanded cases exercise registered Commander commands: both creation aliases, three directory flags, omitted/empty/whitespace/valid values, JSON classification, positional schedules, and existing stream-edit clearing. Gateway transport is mocked. The body reports 589 focused tests passing; this read-only review did not execute tests. (src/cli/cron-cli/register.cron-options.test.ts:55, b2b130c1eb3b)
  • Edit semantics remain separate: Stream edits distinguish omitted cwd from explicit blank input and clear only the latter. The patch leaves this owner unchanged and adds regression coverage for it. (src/cli/cron-cli/schedule-options.ts:125, b2b130c1eb3b)
  • Compatibility disposition and review continuity: The captured complete PR body explicitly accepts rejecting blank creation directories, explains that scripts must omit empty flags, and preserves existing automations and edit clearing. A live read confirmed the same body and pinned head. The previous review retained no findings or rank-up moves; its compatibility warning is addressed by this explicit disposition. (b2b130c1eb3b)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • DasX: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (4 earlier review cycles)
  • reviewed 2026-08-26T00:42:21.626Z sha 99e0c9a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T01:24:35.160Z sha 99e0c9a :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T14:46:48.054Z sha 99e0c9a :: blocked before merge. :: none
  • reviewed 2026-09-18T12:36:16.216Z sha b2b130c :: blocked before merge. :: none

Validate explicitly supplied command, on-exit, and stream directories
before creating an automation. Preserve omitted defaults, valid paths,
and intentional blank stream-directory edits.
@steipete
steipete force-pushed the codex/qa-cron-create-command-cwd-validation-20260825 branch from 99e0c9a to b2b130c Compare September 18, 2026 12:28
@steipete steipete self-assigned this Sep 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 18, 2026
@steipete
steipete merged commit 014d72f into main Sep 18, 2026
106 checks passed
@steipete
steipete deleted the codex/qa-cron-create-command-cwd-validation-20260825 branch September 18, 2026 14:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Validate explicitly supplied command, on-exit, and stream directories
before creating an automation. Preserve omitted defaults, valid paths,
and intentional blank stream-directory edits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant