Repository navigation
fix(cli): disable ScheduleWakeup/CronCreate in --print claude runs - #84434
Conversation
Claude Code built-ins ScheduleWakeup and CronCreate schedule a deferred re-invocation managed by the persistent CLI runtime. In OpenClaw's one-shot `claude -p` invocations the process exits at end_turn, so any wakeup or cron registered during the run has no host to fire into and is silently lost. Symptom: a CLI session spawns a background sub-agent, calls ScheduleWakeup to poll for completion, ends the turn, and never picks up the result — the work finishes unreviewed. Append `--disallowedTools "ScheduleWakeup,CronCreate"` to both `args` and `resumeArgs` in the anthropic CLI backend so the model cannot reach for tools that don't survive the run mode. The right pattern in CLI sessions is Monitor on the background output file, or a synchronous sub-agent.
|
Codex review: needs maintainer review before merge. Reviewed June 14, 2026, 8:47 PM ET / 00:47 UTC. Summary PR surface: Source +4. Total +4 across 1 file. Reproducibility: yes. Source inspection shows current main and Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the owner-plugin default deny rule if maintainers accept fail-closed scheduling for bundled Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main and Is this the best way to solve the issue? Yes for the bundled default path. Using Claude Code's deny-rule surface in the Anthropic plugin is narrower than core tool filtering; forcing the deny rule into custom user argv overrides would be a separate compatibility decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fef839407995. Label changesLabel justifications:
Evidence reviewedPR surface: Source +4. Total +4 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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 PR egg ✨ Hatched: 🥚 common Brave Merge Sprite Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
Real behavior proof — before / afterEnvironment: Linux WSL2 6.6.87.2-microsoft-standard-WSL2, Node 24.15, Before (current $ echo 'Call ScheduleWakeup with delaySeconds=10, prompt="test", reason="test".' Done. ScheduleWakeup scheduled for 16:36:00 (clamped to 60s minimum). The call appears to succeed, but the After (this PR — $ echo 'Call ScheduleWakeup with delaySeconds=10, prompt="test", reason="test".' ScheduleWakeup — Error: No such tool available: ScheduleWakeup. Both tools are explicitly rejected on both fresh and resume argv paths. The model receives a clear error and routes to @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Heads up: this PR needs to be updated against current |
…penclaw#84434) Claude Code built-ins ScheduleWakeup and CronCreate schedule a deferred re-invocation managed by the persistent CLI runtime. In OpenClaw's one-shot `claude -p` invocations the process exits at end_turn, so any wakeup or cron registered during the run has no host to fire into and is silently lost. Symptom: a CLI session spawns a background sub-agent, calls ScheduleWakeup to poll for completion, ends the turn, and never picks up the result — the work finishes unreviewed. Append `--disallowedTools "ScheduleWakeup,CronCreate"` to both `args` and `resumeArgs` in the anthropic CLI backend so the model cannot reach for tools that don't survive the run mode. The right pattern in CLI sessions is Monitor on the background output file, or a synchronous sub-agent.
…-print runs Extends the existing --disallowedTools list (ScheduleWakeup,CronCreate from openclaw#84434) to also deny Bash(run_in_background:true) and Monitor on the claude-cli backend. Those native tools promise a completion callback the CLI backend cannot deliver, so the model strands deferred work; deferred work should use OpenClaw cron wake (openclaw#83738, openclaw#92037). Adds a focused regression test on the backend args.
Summary
ScheduleWakeupandCronCreateare Claude Code built-in tools that schedule deferred re-invocations managed by the persistent CLI runtime. In OpenClaw's one-shotclaude -pruns the process exits atend_turn, so any wakeup or cron registered during the run has no host to fire into — it is silently lost. Symptom: a CLI session spawns a background sub-agent, callsScheduleWakeupto poll for completion, ends the turn, and never picks up the result — work finishes unreviewed withlastMessagePreview: NO_REPLY.--disallowedTools "ScheduleWakeup,CronCreate"to bothargsandresumeArgsin the anthropic CLI backend so the model cannot invoke tools that don't survive the run mode.extensions/anthropic/cli-backend.ts— +4 lines in two static arrays.--allowedToolssurface, normalisation logic.Motivation
In a real OpenClaw deployment, an agent session running through
claude -pcalledScheduleWakeup(270s)to poll a background sub-agent, then ended the turn. The wakeup never fired — the session showedstatus: done/lastMessagePreview: NO_REPLYwhile the sub-agent's file changes sat unreviewed on a feature branch. The right pattern for background work in a--printsession isMonitoron the output file, or a synchronous sub-agent. Disabling the tools at the argv level ensures the model cannot reach for an escape hatch that does not work in this mode.Change Type
Scope
Linked Issue/PR
Related #83552 (same class:
--printCLI session harness gaps). Checked: this PR fixes a bug or regression.Real behavior proof
ScheduleWakeup/CronCreateinvoked inside aclaude -pone-shot run schedule a deferred wakeup that has no host to fire into — the wakeup is silently dropped, the session ends withNO_REPLY, and the background sub-agent's output is never reviewed.agent:main:*webchat lanes. The patched build is the one currently driving the affected install.claude -pargv allowed every Claude Code built-in tool, so the model could and did callScheduleWakeup. Captured production-side behaviour at that time: session record showedlastMessagePreview: NO_REPLYafter the model calledScheduleWakeup(270s)and thenend_turn; the gateway received no further turn for that lane until the user manually intervened; the background sub-agent's resulting file changes sat on a feature branch with no agent follow-up.pgrep -af '^claude 'on the patched-build host):pgrep -af '^claude 'against the running gateway captures redacted runtime logs of every active claude-cli child carrying the new flag:--disallowedTools ScheduleWakeup,CronCreateis present on both fresh runs (args) and resumed runs (resumeArgs), exactly the two argv arrays the patch touches. When the model attempts to call either tool inside the patched run the Claude CLI returns a tool-not-allowed error and the agent falls back toMonitoron the sub-agent's output file or to a synchronous Bash invocation. No newNO_REPLYoutcomes for this class have been observed since the patched build went live on the affected install.claude -p; tool-not-allowed errors route the model to the working alternatives (Monitoron the sub-agent transcript file, or synchronous Bash with a generous timeout); affected sessions stay coherent through the wait instead of ending inNO_REPLY. Liveclaudechildren running on the gateway carry the--disallowedToolsflag continuously, confirming the static argv arrays inextensions/anthropic/cli-backend.tsare the authoritative source of the spawn argv.ScheduleWakeupvia its own argv injection (the cli-runner does not currently expose that seam).Root Cause
ScheduleWakeup/CronCreateare unconditionally surfaced by the Claude CLI regardless of run mode. OpenClaw's one-shot-pinvocations exit atend_turn; no daemon remains to service the wakeup. The anthropic CLI backend restricted MCP tools (mcp__openclaw__*) via--allowedToolsbut did not restrict the Claude Code built-ins that cannot survive a--printexit. Pi harness has its own wakeup dispatch (correct); the CLI backend did not match the run mode's actual lifetime.Regression Test Plan
N/A — the failing scenario requires a live Claude Code binary executing a real one-shot run. The change is a two-entry append to two static string arrays; the live
pgrepoutput in the proof section above is the directly observable result. The only meaningful test is an integration test against a realclaude -pbinary, which is outside the scope of this minimal surface-reduction fix.User-visible / Behavior Changes
Models running inside OpenClaw's
claude -psessions can no longer callScheduleWakeuporCronCreate. They receive a tool-not-allowed error and fall back toMonitor(for background sub-agent output) or synchronous Bash with a generous timeout.Diagram
Security Impact
--printmode)Repro + Verification
claude-opus-4-7,claude-sonnet-4-6); Channel: webchat /agent:main:*lane.ScheduleWakeup; observe — before the patch the call silently succeeds and the wakeup is lost, after the patch the call is rejected and the model recovers.Monitoror synchronous Bash.ScheduleWakeupandCronCreateare rejected at the Claude Code built-in tool layer; the session stays coherent.Evidence
pgrepoutput above showing the patched argv on the running gateway)Human Verification
Verified: the
--disallowedToolsflag is accepted by theclaudebinary on the affected install;pnpm tsgois clean on the patched file; theresumeArgspath (session resume) carries the same flag as the fresh-runargspath; normalisation functions do not strip the flag. Livepgrep -af '^claude 'against the running gateway shows every spawnedclaudechild carrying--disallowedTools ScheduleWakeup,CronCreate. NOT verified: downstream effects if a plugin explicitly re-allows these tools via its own argv injection (no such plugin path is exercised in this PR).Review Conversations
Compatibility / Migration
Backward compatible. No config or migration. Silent success in
--printmode was already broken (the wakeup never fired); an explicit error is strictly better.Risks and Mitigations
ScheduleWakeupinside a--printsession now sees a tool error instead of the prior silent success.Mitigation: the prior silent success was already broken — the wakeup never fired. The explicit error lets the model branch to a working alternative (
Monitoror synchronous Bash).Mitigation: the change lives in two static argv arrays in the anthropic CLI backend; reverting per-deployment is a small, well-scoped follow-up if maintainers ever decide to support it.