Skip to content

fix(cron): reject on-exit cwd on stream metadata edits - #198588

Merged
obviyus merged 2 commits into
openclaw:mainfrom
Wang-Zephyr:fix/cron-stream-reject-on-exit-cwd
Nov 14, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
Wang-Zephyr:fix/cron-stream-reject-on-exit-cwd

Conversation

@Wang-Zephyr

Copy link
Copy Markdown
Contributor

Fixes #198587

What Problem This Solves

A stream metadata edit can succeed while silently ignoring an incompatible --on-exit-cwd flag.

User Impact

The CLI reports the invalid flag combination before it updates the automation.

Why This Change Was Made

Validate the option pair during schedule normalization, before the stream metadata branch can return.

Evidence

  • Ran the real Commander cron edit registration with --stream-cwd /new-stream --on-exit-cwd /watch against an existing stream-job RPC fixture. At 52e231b the command resolved successfully. With the fix it reports --on-exit-cwd requires --on-exit, exits with code 1, and makes no Gateway RPC.
  • 126 tests passed across trigger-options.test.ts, schedule-options.onexit.test.ts and schedule-options.positional.test.ts. Focused oxfmt and oxlint checks passed.
  • The Gateway boundary was stubbed. No external service was used. Reviewed the schedule call sites locally. Standalone autoreview was unavailable.

@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. 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. 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

Rejects --on-exit-cwd without --on-exit before stream metadata edits can bypass validation.

Example: A stream job has cwd /old; run openclaw cron edit JOB_ID --stream-cwd /x --on-exit-cwd /y.

  • Before: The command succeeds, changes cwd to /x, and silently ignores /y.
  • After: The command exits 1 with --on-exit-cwd requires --on-exit. and preserves cwd /old.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, correct repair with shipped-entry-point evidence and a reported red/green regression; broad exact-head CI remains incomplete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The collaborator’s reviewed-head proof uses the built CLI and isolated real Gateways in a secretless Node container: the invalid stream edit exits 1 and preserves stored cwd, while valid stream and on-exit edits continue working; this satisfies the previous rank-up request.
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 invalid stream metadata edit reports success and changes the job while silently ignoring an incompatible flag.
Reason: Restores an already documented requirement without adding options, changing valid edits, or introducing another validation owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current CLI validation bug with a minimal change and no actionable findings. The new Gateway proof resolves the previous review’s concern; exact-head CI is still running.

Priority: P2
Reviewed head: 5ba2528366c457d8047a6bd526892dbf9a922d63

Before merge

None.

Findings

None.

Agent review details

How this fits together

The cron CLI normalizes schedule flags before constructing Gateway updates; invalid combinations produce CLI errors instead of job mutations.

flowchart TD
  A[CLI schedule flags] --> B[Shared schedule normalization]
  B --> C[Invalid option error]
  B --> D[Schedule edit resolution]
  D --> E[Gateway cron update]
  E --> F[Stored automation]
Loading

Technical review

Best possible solution:

Keep the requirement in shared schedule normalization so every creation and edit path validates it before constructing an update.

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

Current-main source confirms the early-return bypass, and the collaborator’s real CLI/Gateway comparison records the failing input and repaired result; this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete fix: enforce the existing invariant once in the shared normalizer, remove redundant checks, and cover the bypass through the CLI registration.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • On-exit cwd requirement and expected CLI errors keeps the original intent (68bfa42: The on-exit feature ties cwd to its watched command; later error handling preserves direct operator guidance.)
  • Blank schedule and whitespace-preserving command parsing keeps the original intent (fix(cron): preserve whitespace in command cwd CLI options #172869: Blank selectors must fail, while meaningful command and cwd whitespace must survive parsing.)
  • Stream metadata edits keeps the original intent (98742bc: Allow stream metadata changes without requiring callers to restate the source command.)
  • Existing CLI rejection table keeps the original intent (e003183: Consolidate behavioral coverage and remove redundant test layers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 98742bc adds src/cli/cron-cli/schedule-options.ts:120 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 98742bc2c7f2; files: src/cli/cron-cli/schedule-options.ts)
  • Cameron Beeley: Raw commit 68bfa42 adds src/cli/cron-cli/schedule-options.ts:190 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 68bfa42b9bfc; files: src/cli/cron-cli/schedule-options.ts)
  • SunnyShu: Raw commit 8ef2b80 adds src/cli/cron-cli/schedule-options.ts:223 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8ef2b8065f39; files: src/cli/cron-cli/schedule-options.ts)

PR surface

Source -1, Tests 0. Total -1 across 2 files. Added test files: 0.

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

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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Fixes silently ignored incompatible flags in an advanced CLI edit workflow with limited blast radius.
  • 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 (1 earlier review cycle)
  • reviewed 2026-11-14T02:55:19.285Z sha d541681 :: needs real behavior proof before merge. :: none

Reviewed November 13, 2026, 10:36 PM ET / November 14, 2026, 03:36 UTC (Revision 2).

@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Proof at 5ba2528 (prod code unchanged from d541681; my commit only folds the new test into the existing edit-reject table, net test lines 0).

Setup: secretless node:24.22.1 container. Built main (52e231b, no cron-cli changes on main since) and this PR with pnpm build. Each lane ran a real openclaw gateway run on an isolated profile. The built openclaw.mjs created fresh disabled jobs (stream: --stream-command '["node","events.mjs"]' --stream-cwd /old; on-exit: --on-exit ./old.sh --on-exit-cwd /old), ran one cron edit, then read the schedule back with cron list --json --all and cron show. Two rounds per lane.

edit main r1/r2 PR r1/r2
stream job: --stream-cwd /x --on-exit-cwd /y exit 0, cwd /old -> /x, --on-exit-cwd dropped exit 1, --on-exit-cwd requires --on-exit., cwd stays /old
stream job: --stream-cwd /x (control) exit 0, cwd -> /x exit 0, cwd -> /x
on-exit job: --on-exit-cwd /y (control) exit 1, --on-exit-cwd requires --on-exit., unchanged same
on-exit job: --on-exit ./new.sh --on-exit-cwd /y (control) exit 0, ./new.sh @ /y same

The PR's stderr for the stream case is byte-identical to main's existing error for the plain on-exit case (cmp passes; --on-exit-cwd requires --on-exit.\n).

Tests: trigger-options.test.ts + schedule-options.onexit.test.ts pass on the PR (118/118). The changed reject-table row fails on main.

@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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@obviyus
obviyus merged commit d98ec68 into openclaw:main Nov 14, 2026
124 checks passed
@obviyus

obviyus commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Landed in d98ec68. Thanks @Wang-Zephyr.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 14, 2026
fix(cron): reject --on-exit-cwd without --on-exit when editing a stream automation

When editing a stream automation, the stream path returned early before the existing "--on-exit-cwd requires --on-exit." check, so openclaw cron edit <id> --stream-cwd /x --on-exit-cwd /y applied the stream change and silently dropped --on-exit-cwd. The check now runs on that path too, so the edit fails with the existing message before anything is sent and the job is unchanged. Other edits are unchanged. No new text.

Evidence: the built CLI against a real gateway on an isolated profile in a secretless node:24.22.1 container, main twice and candidate twice. On main the edit exited 0, changed the stream working directory and dropped --on-exit-cwd. With this change it exits 1 with the existing error (byte-identical to main's message) and the job keeps its old working directory. --stream-cwd alone, --on-exit-cwd alone on an on-exit job, and a valid --on-exit with --on-exit-cwd behave the same on both. One row in the existing edit-reject table fails on main, at net 0 test lines. Details: openclaw#198588 (comment).

Fixes openclaw#198587. 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 ignores --on-exit-cwd when patching stream metadata

2 participants