-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
cron: systemEvent on main session silently ignores shell commands in payload text #63107
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Problem
Cron jobs configured with
sessionTarget: "main"+payload.kind: "systemEvent"+wakeMode: "next-heartbeat"fire successfully (status: ok,durationMs: 1–8ms) but never actually execute shell commands contained in the payload text.For example, a job with
payload.text: "run: python3 /path/to/script.py"will be recorded asokbut the script will never run. The system event is dispatched to the main agent session, but the agent's systemEvent handler only acknowledges the event — it does not parse or execute shell commands from system event text.There is no documentation warning, no validation error at job creation time, and no indication in the run log that the command was not executed.
Working workaround: Use
sessionTarget: "isolated"+payload.kind: "agentTurn"+wakeMode: "now"to actually run scripts.Root Cause
executeMainSessionCronJobinsrc/cron/service/timer.tscallsenqueueSystemEvent(text, ...)and immediately returns{ status: "ok" }. System events on the main session are intended for lightweight agent notifications/context injections, not for executing arbitrary commands. The payload text is passed as-is to the agent's system event queue, and the main agent does not treat system event text as executable instructions.Users who read the docs or examples for
--system-eventmay reasonably assume the text will be executed as a command if it contains shell syntax (python3,bash,uv run, etc.).Proposed Fix
Add a validation warning at
cron add/cron edittime insrc/cli/cron-cli/register.cron-add.tsandsrc/cli/cron-cli/register.cron-edit.ts:When
sessionTarget === "main"(or inferred) +payload.kind === "systemEvent"and the payload text contains shell command heuristics (python3,bash,node,uv run,sh,./, etc.), print a warning to stderr:This is a non-blocking warning (the job is still created), not a hard error.
Files to change
src/cli/cron-cli/register.cron-add.ts— add warning after payload + sessionTarget are resolvedsrc/cli/cron-cli/register.cron-edit.ts— add same warning when--system-event+--session mainare both setAcceptance Criteria
cron add --system-event "python3 foo.py" --session mainprints a warning to stderrcron add --system-event "hello world"(no shell heuristic) does not warncron add --message "run python3 foo.py" --session isolateddoes not warn--jsonmode