Skip to content

fix(cron): warn when --system-event on main session contains shell commands#63112

Open
liaoandi wants to merge 7 commits into
openclaw:mainfrom
liaoandi:fix/63107-cron-systemevent-main-warning
Open

fix(cron): warn when --system-event on main session contains shell commands#63112
liaoandi wants to merge 7 commits into
openclaw:mainfrom
liaoandi:fix/63107-cron-systemevent-main-warning

Conversation

@liaoandi

@liaoandi liaoandi commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cron add --system-event "./run.sh" --session main and similar commands used to create or edit the job silently even though main-session system events do not execute shell commands.
  • Adds a shared looksLikeShellCommand() helper for common runtimes and relative script paths such as ./run.sh.
  • Emits a non-blocking warning before cron.add / cron.update when the effective session target is main, the payload is systemEvent, and the text looks like a shell command.

Fixes #63107

Root Cause

System events on the main session are dispatched as context notifications to the agent. They are not executed as shell commands, so shell-looking --system-event payloads on --session main were silently non-functional.

Changes

  • src/cli/cron-cli/shared.ts: Adds the shared shell-command heuristic.
  • src/cli/cron-cli/register.cron-add.ts: Warns before the cron.add RPC for main-session shell-looking system events.
  • src/cli/cron-cli/register.cron-edit.ts: Warns before the cron.update RPC for explicit main-session edits and existing-main jobs edited without --session.
  • src/cli/cron-cli.test.ts and src/cli/cron-cli/shared.test.ts: Cover add/edit warning paths, non-matches, existing-main edit fallback, paginated existing-job lookup, and relative script paths.

Real behavior proof

Behavior or issue addressed: Main-session cron --system-event payloads that look like shell commands now warn before the gateway RPC, so ./run.sh is no longer accepted silently as if it would execute.

Real environment tested: Local checkout of current PR head 5715fb72a2a1f4bde8339a8cd2b805b407e69454 on 2026-05-29, running the OpenClaw source CLI through node --import tsx src/entry.ts with isolated OPENCLAW_HOME and OPENCLAW_STATE_DIR, bundled plugins disabled, and a redacted gateway token.

Exact steps or command run after this patch: Rebased onto current upstream/main, ran focused cron CLI/shared regression tests, ran git diff --check upstream/main...HEAD, then ran real source CLI commands for both cron add and explicit-main cron edit against a deliberately closed local gateway endpoint to observe the pre-RPC warning.

Evidence after fix: copied terminal output from the current-head real CLI path for both cron add and explicit-main cron edit.

$ node scripts/run-with-env.mjs OPENCLAW_HOME=/private/tmp/openclaw-pr63112-proof OPENCLAW_STATE_DIR=/private/tmp/openclaw-pr63112-proof OPENCLAW_DISABLE_BUNDLED_PLUGINS=1 -- node --import tsx src/entry.ts cron add --name proof-shell-warning --every 1h --session main --system-event ./run.sh --url ws://127.0.0.1:9 --token proof-redacted --timeout 1000
Warning: --system-event on --session main does not execute shell commands.
  The text is dispatched as a notification to the main agent session only.
  To run a script, use: --message "..." --session isolated --wake now
GatewayTransportError: gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:9
Source: cli --url
Config: /private/tmp/openclaw-pr63112-proof/openclaw.json
$ node scripts/run-with-env.mjs OPENCLAW_HOME=/private/tmp/openclaw-pr63112-proof OPENCLAW_STATE_DIR=/private/tmp/openclaw-pr63112-proof OPENCLAW_DISABLE_BUNDLED_PLUGINS=1 -- node --import tsx src/entry.ts cron edit proof-job --session main --system-event ./deploy.sh --url ws://127.0.0.1:9 --token proof-redacted --timeout 1000
Warning: --system-event on --session main does not execute shell commands.
  The text is dispatched as a notification to the main agent session only.
  To run a script, use: --message "..." --session isolated --wake now
GatewayTransportError: gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:9
Source: cli --url
Config: /private/tmp/openclaw-pr63112-proof/openclaw.json

Observed result after fix: Both real CLI commands print the shell-command warning before the gateway RPC fails, proving the changed user-visible behavior runs on the current source CLI path.

What was not tested: A successful cron.add or cron.update against a live authenticated gateway was not required because the changed behavior is the pre-RPC warning path. The focused regression suite covers the live RPC parameter paths around this warning.

Test plan

  • node scripts/run-vitest.mjs src/cli/cron-cli.test.ts src/cli/cron-cli/shared.test.ts - 2 files passed, 110 tests passed
  • git diff --check upstream/main...HEAD
  • Current-head real CLI proof above shows cron add and explicit-main cron edit print the warning before the gateway RPC.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Apr 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ad38b55aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/cron-cli/register.cron-edit.ts Outdated
// are never executed — the text is only dispatched as a context notification.
if (
hasSystemEventPatch &&
opts.session === "main" &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check effective session before suppressing shell warning

The new warning in cron edit only runs when opts.session === "main", so it is skipped for the common patch flow where users edit just --system-event and leave session unchanged. For an existing main-session job, cron edit <id> --system-event "python3 foo.py" still updates silently with no warning, which reintroduces the exact confusion this fix is meant to prevent. Determine the effective session target (including existing job state when --session is omitted) before applying this guard.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a non-blocking stderr warning in both cron add and cron edit when --system-event + --session main are combined with text that looks like a shell invocation, addressing a silent no-op footgun. The approach is straightforward and the warning is correctly emitted before the RPC call.

Confidence Score: 5/5

Safe to merge — all findings are P2 style/improvement suggestions that don't affect correctness of the warning or job creation.

The feature itself is non-blocking by design and works correctly for its primary use case (explicit --session main + --system-event with common runtimes). The three findings are: a broken ./ regex alternative that only affects an edge case, a warning gap in cron edit when --session is omitted, and code duplication. None of these cause incorrect behavior or data loss.

Both files share the ./ regex issue and the code duplication; register.cron-edit.ts additionally has the session-inference gap.

Vulnerabilities

No security concerns identified. The warning logic reads user-supplied CLI option text through a regex and writes to stderr — no external input is executed or forwarded unsafely.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-add.ts
Line: 22

Comment:
**`./` pattern won't match real path invocations**

The trailing `(?:\s|$)` anchor means `./script.sh` (no space after `./`) never matches. The `\.\/` alternative is only useful for the bare string `./` followed by a space — practically never written. Consider replacing it with a broader path token so invocations like `./run.sh` and `./deploy.sh` are actually caught.

```suggestion
const SHELL_COMMAND_PATTERN =
  /(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/\S+)(?:\s|$)/m;
```

Same fix applies to the identical pattern in `register.cron-edit.ts`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-edit.ts
Line: 327-330

Comment:
**Warning silently skipped when editing existing main-session job without `--session`**

The guard `opts.session === "main"` only fires when the user explicitly passes `--session main`. A user who edits only the payload of an already-main-session job — `cron edit <id> --system-event "python3 foo.py"` — gets no warning, even though the job will still dispatch to the main session and never execute the script.

The simplest improvement is to fetch the existing job (the schedule-patch path already does this) and fall back to `existing.sessionTarget`:

```ts
if (
  hasSystemEventPatch &&
  (opts.session === "main" || (!opts.session && existing?.sessionTarget === "main")) &&
  looksLikeShellCommand(String(opts.systemEvent))
) {
```

This is a best-effort heuristic so it's non-blocking, but the current gap defeats the purpose for incremental edits.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-edit.ts
Line: 17-27

Comment:
**Duplicated helper — move to `shared.ts`**

`SHELL_COMMAND_PATTERN` and `looksLikeShellCommand` are copy-pasted verbatim into both files. Extracting them to `src/cli/cron-cli/shared.ts` and importing them removes the synchronization risk (a future tweak to the pattern in one file won't silently diverge from the other).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(cron): warn on cron edit when --syst..." | Re-trigger Greptile

Comment thread src/cli/cron-cli/register.cron-add.ts Outdated
@@ -18,6 +18,18 @@ import {
warnIfCronSchedulerDisabled,
} from "./shared.js";

const SHELL_COMMAND_PATTERN =
/(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/)(?:\s|$)/m;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 ./ pattern won't match real path invocations

The trailing (?:\s|$) anchor means ./script.sh (no space after ./) never matches. The \.\/ alternative is only useful for the bare string ./ followed by a space — practically never written. Consider replacing it with a broader path token so invocations like ./run.sh and ./deploy.sh are actually caught.

Suggested change
/(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/)(?:\s|$)/m;
const SHELL_COMMAND_PATTERN =
/(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/\S+)(?:\s|$)/m;

Same fix applies to the identical pattern in register.cron-edit.ts.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-add.ts
Line: 22

Comment:
**`./` pattern won't match real path invocations**

The trailing `(?:\s|$)` anchor means `./script.sh` (no space after `./`) never matches. The `\.\/` alternative is only useful for the bare string `./` followed by a space — practically never written. Consider replacing it with a broader path token so invocations like `./run.sh` and `./deploy.sh` are actually caught.

```suggestion
const SHELL_COMMAND_PATTERN =
  /(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/\S+)(?:\s|$)/m;
```

Same fix applies to the identical pattern in `register.cron-edit.ts`.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +327 to +330
if (
hasSystemEventPatch &&
opts.session === "main" &&
looksLikeShellCommand(String(opts.systemEvent))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Warning silently skipped when editing existing main-session job without --session

The guard opts.session === "main" only fires when the user explicitly passes --session main. A user who edits only the payload of an already-main-session job — cron edit <id> --system-event "python3 foo.py" — gets no warning, even though the job will still dispatch to the main session and never execute the script.

The simplest improvement is to fetch the existing job (the schedule-patch path already does this) and fall back to existing.sessionTarget:

if (
  hasSystemEventPatch &&
  (opts.session === "main" || (!opts.session && existing?.sessionTarget === "main")) &&
  looksLikeShellCommand(String(opts.systemEvent))
) {

This is a best-effort heuristic so it's non-blocking, but the current gap defeats the purpose for incremental edits.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-edit.ts
Line: 327-330

Comment:
**Warning silently skipped when editing existing main-session job without `--session`**

The guard `opts.session === "main"` only fires when the user explicitly passes `--session main`. A user who edits only the payload of an already-main-session job — `cron edit <id> --system-event "python3 foo.py"` — gets no warning, even though the job will still dispatch to the main session and never execute the script.

The simplest improvement is to fetch the existing job (the schedule-patch path already does this) and fall back to `existing.sessionTarget`:

```ts
if (
  hasSystemEventPatch &&
  (opts.session === "main" || (!opts.session && existing?.sessionTarget === "main")) &&
  looksLikeShellCommand(String(opts.systemEvent))
) {
```

This is a best-effort heuristic so it's non-blocking, but the current gap defeats the purpose for incremental edits.

How can I resolve this? If you propose a fix, please make it concise.

Comment thread src/cli/cron-cli/register.cron-edit.ts Outdated
Comment on lines +17 to +27
const SHELL_COMMAND_PATTERN =
/(?:^|\s)(?:python3?|bash|sh|node|bun|deno|uv run|npx|tsx|ts-node|ruby|perl|php|make|cargo|go run|java|dotnet|\.\/)(?:\s|$)/m;

/**
* Returns true when the system-event text looks like it contains a shell
* command invocation. Used to warn users that systemEvent payloads on the
* main session do not execute shell commands.
*/
function looksLikeShellCommand(text: string): boolean {
return SHELL_COMMAND_PATTERN.test(text);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicated helper — move to shared.ts

SHELL_COMMAND_PATTERN and looksLikeShellCommand are copy-pasted verbatim into both files. Extracting them to src/cli/cron-cli/shared.ts and importing them removes the synchronization risk (a future tweak to the pattern in one file won't silently diverge from the other).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/cron-cli/register.cron-edit.ts
Line: 17-27

Comment:
**Duplicated helper — move to `shared.ts`**

`SHELL_COMMAND_PATTERN` and `looksLikeShellCommand` are copy-pasted verbatim into both files. Extracting them to `src/cli/cron-cli/shared.ts` and importing them removes the synchronization risk (a future tweak to the pattern in one file won't silently diverge from the other).

How can I resolve this? If you propose a fix, please make it concise.

@clawsweeper

clawsweeper Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 3:50 PM ET / 19:50 UTC.

Summary
The PR adds shared shell-command detection plus cron add/edit stderr warnings and regression tests for main-session systemEvent payloads that look like shell commands.

PR surface: Source +74, Tests +127, Docs +1. Total +202 across 6 files.

Reproducibility: yes. Source inspection shows current main still queues main-session systemEvent text through enqueueSystemEvent while actual command execution is handled by payload.kind command; I did not run a live gateway in this read-only review.

Review metrics: 1 noteworthy metric.

  • Warning remediation sites: 2 added. Both new user-facing warning messages need to match the current supported script-execution path before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #63107
Summary: This PR is the open candidate fix for the canonical main-session systemEvent shell-command warning issue; command cron is a related merged execution path but does not add the requested warning.

Members:

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

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Update both warning messages and tests to point at command cron.
  • Resolve current-main conflicts without losing command cron behavior.
  • [P1] Add redacted terminal proof from the live PR head.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes relevant terminal output, but it names older head 5715fb7 while the live PR head is 57253e3; add redacted current-head terminal proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging as-is would tell script users to use model-backed isolated message cron instead of the current command-cron path for deterministic scripts.
  • [P1] The live PR is conflicting with current main, so conflict resolution must preserve current command cron and cron edit behavior.
  • [P1] The PR body’s real-behavior proof names older head 5715fb7 while the live head is 57253e3, so exact-head proof still needs refresh.

Maintainer options:

  1. Update warning guidance to command cron (recommended)
    Change both warning strings and their assertions to recommend --command or --command-argv for deterministic scripts before merge.
  2. Accept isolated-message guidance intentionally
    Maintainers could keep the older isolated-message workaround, but that would make this diagnostic inconsistent with current command-cron docs.
  3. Pause for branch refresh
    Because the branch is currently conflicting and proof is stale, maintainers can wait for the contributor to refresh before deeper merge work.

Next step before merge

  • [P1] This active contributor PR needs author or maintainer refresh for conflicts, current-head proof, and warning text; a separate automated repair branch would duplicate the linked fix path.

Security
Cleared: The diff adds CLI warning text, a regex helper, tests, and changelog text; it does not add dependencies, permissions, secrets handling, or a new execution surface.

Review findings

  • [P2] Point script guidance at command cron — src/cli/cron-cli/register.cron-add.ts:397
  • [P3] Drop the release-owned changelog edit — CHANGELOG.md:2401
Review details

Best possible solution:

Refresh the branch so both warnings and tests point at --command or --command-argv, resolve current-main conflicts, and add redacted terminal proof from the live PR head.

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

Yes. Source inspection shows current main still queues main-session systemEvent text through enqueueSystemEvent while actual command execution is handled by payload.kind command; I did not run a live gateway in this read-only review.

Is this the best way to solve the issue?

No, not as written. A CLI warning is the right layer, but the warning should point to command cron now that the supported command payload path exists.

Full review comments:

  • [P2] Point script guidance at command cron — src/cli/cron-cli/register.cron-add.ts:397
    Current main supports --command and --command-argv for deterministic scripts, but this warning sends users to model-backed --message "..." --session isolated --wake now. Please update both add/edit warnings and their assertions to point at command cron instead.
    Confidence: 0.91
  • [P3] Drop the release-owned changelog edit — CHANGELOG.md:2401
    CHANGELOG.md is generated for releases in this repo, and normal PR release-note context belongs in the PR body or squash message. Please remove this entry before merge.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a320f775f0f3.

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority cron CLI footgun fix with limited blast radius and an open linked implementation PR.
  • merge-risk: 🚨 other: The diff adds operator guidance that could direct script users to the wrong cron mode even when tests pass.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes relevant terminal output, but it names older head 5715fb7 while the live PR head is 57253e3; add redacted current-head terminal proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +74, Tests +127, Docs +1. Total +202 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 82 8 +74
Tests 2 127 0 +127
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 210 8 +202

What I checked:

  • Repository policy read: Root AGENTS.md was read fully and applied to the PR review, especially whole-surface review, changelog ownership, real-behavior proof, and CLI compatibility guidance. (AGENTS.md:29, c5afa92c1f8a)
  • Current command cron support: Current main exposes --command and --command-argv on cron add, making command cron the supported deterministic script path. (src/cli/cron-cli/register.cron-add.ts:116, c5afa92c1f8a)
  • Current docs command path: The cron CLI docs tell users to use --command for deterministic shell-style jobs that should run inside OpenClaw cron without starting an isolated agent/model run. Public docs: docs/cli/cron.md. (docs/cli/cron.md:37, c5afa92c1f8a)
  • Main-session systemEvent runtime behavior: Current main routes sessionTarget main jobs through executeMainSessionCronJob, enqueues the text with enqueueSystemEvent, requests heartbeat, and can return ok; it does not execute shell text. (src/cron/service/timer.ts:1990, c5afa92c1f8a)
  • Command execution runtime path: Detached cron jobs with payload.kind command call the command runner, separating real command execution from main-session systemEvent notifications. (src/cron/service/timer.ts:2114, c5afa92c1f8a)
  • Current main lacks the proposed warning: Targeted search found no looksLikeShellCommand helper or proposed systemEvent shell warning in current cron CLI source/docs. (src/cli/cron-cli, c5afa92c1f8a)

Likely related people:

  • mbelinky: Authored the merged command-cron PR that established the current supported script-execution path this warning should reference. (role: command-cron feature author; confidence: high; commits: b8adc11977ab, 1b97e65681ec; files: src/cli/cron-cli/register.cron-add.ts, src/cli/cron-cli/register.cron-edit.ts, src/cron/service/timer.ts)
  • vincentkoc: Merged the command-cron PR and authored several follow-up commits around cron command process handling. (role: command-cron merger and recent cron contributor; confidence: high; commits: b8adc11977ab, 1fa471349f8a, 0f802edc2b37; files: src/cron/command-runner.ts, src/cron/service/timer.ts, src/process/exec.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-03T06:07:35.359Z sha 57253e3 :: needs real behavior proof before merge. :: [P2] Point script guidance at command cron | [P3] Drop the release-owned changelog edit

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

Adds a shared shell-command detector and non-blocking stderr warnings to cron add/edit for main-session systemEvent payloads that look like shell commands, plus CLI/shared tests.

Maintainer follow-up before merge:

This is an active contributor PR tied to open #63107, so the next action is normal maintainer PR review and validation rather than a separate automated repair branch.

Review details

Best possible solution:

Land a narrow cron CLI fix that warns before the gateway RPC for both add and edit, including existing-main edits where --session is omitted, with tests for matching and non-matching payloads and no change to cron runtime execution semantics.

Acceptance criteria:

  • pnpm test src/cli/cron-cli.test.ts src/cli/cron-cli/shared.test.ts
  • pnpm check:changed in Testbox before merge

What I checked:

Likely related people:

  • Peter Steinberger: Blame and -S history in the available main checkout attribute the current cron CLI add/edit and main-session timer behavior to the same maintainer commit. (role: recent maintainer and current-main history owner; confidence: medium; commits: a972c9ec4547; files: src/cli/cron-cli/register.cron-add.ts, src/cli/cron-cli/register.cron-edit.ts, src/cli/cron-cli/shared.ts)

Remaining risk / open question:

  • The PR branch was not executed in this read-only review; maintainers still need focused cron CLI tests and the changed gate before merge.
  • The warning is heuristic by design, so maintainers should confirm the false-positive/false-negative tradeoff and wording are acceptable.

Codex review notes: model gpt-5.5, reasoning high; reviewed against acae48b790fa.

@openclaw-barnacle openclaw-barnacle Bot added size: M channel: discord Channel integration: discord channel: line Channel integration: line channel: slack Channel integration: slack app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling channel: feishu Channel integration: feishu and removed size: S labels Apr 30, 2026
@liaoandi
liaoandi force-pushed the fix/63107-cron-systemevent-main-warning branch from 5a53091 to 9a192dc Compare May 8, 2026 10:58
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed channel: discord Channel integration: discord channel: line Channel integration: line channel: slack Channel integration: slack app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling channel: feishu Channel integration: feishu labels May 8, 2026
@liaoandi
liaoandi force-pushed the fix/63107-cron-systemevent-main-warning branch from 9a192dc to df5e878 Compare May 8, 2026 11:10
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: zalo Channel integration: zalo gateway Gateway runtime scripts Repository scripts commands Command implementations agents Agent runtime and tooling labels Jun 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: L and removed size: M proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jun 1, 2026
liaoandi and others added 7 commits June 9, 2026 18:02
…mmand

When a user creates a cron job with --system-event <text> on
--session main, and the text looks like a shell command (python3,
bash, node, uv run, etc.), print a warning to stderr explaining that
systemEvent payloads are dispatched as notifications to the main agent
session and do not execute shell commands.

Add looksLikeShellCommand() helper with a SHELL_COMMAND_PATTERN regex
and emit the warning in registerCronAddCommand before the gateway RPC.

Fixes openclaw#63107
…h shell command

Mirror the shell-command warning from registerCronAddCommand into
registerCronEditCommand: when --system-event is being patched and
--session main is explicitly passed and the new text matches
SHELL_COMMAND_PATTERN, print a warning to stderr.

Fixes openclaw#63107
…rget

- Extract SHELL_COMMAND_PATTERN + looksLikeShellCommand to shared.ts (P2)
- Fix `./script.sh` regex: `\.\/` → `\.\/\S` so paths match without
  trailing space (P2)
- In cron edit: when --session is omitted, fetch existing job to check
  sessionTarget before suppressing warning (P2)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@liaoandi thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: blank-template Candidate: PR template appears mostly untouched.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cron: systemEvent on main session silently ignores shell commands in payload text

1 participant