Repository navigation
fix(claude-cli): also disable native background Bash and Monitor in --print runs - #95008
Conversation
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Codex review: needs maintainer review before merge. Reviewed June 20, 2026, 6:09 PM ET / 22:09 UTC. Summary PR surface: Source 0, Tests +11. Total +11 across 2 files. Reproducibility: yes. Source inspection shows current main omits the new deny entries in the exact argv arrays consumed by the runner, and the PR body provides terminal/live-output proof that patched argv denies background Bash and hides Monitor. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the owner-plugin deny-list update if maintainers accept unsupported native background callbacks should fail closed; keep custom escape hatches or on-exit cron policy as separate work. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main omits the new deny entries in the exact argv arrays consumed by the runner, and the PR body provides terminal/live-output proof that patched argv denies background Bash and hides Monitor. Is this the best way to solve the issue? Yes for the bundled default path. The change belongs in the Anthropic provider-owned CLI backend and is narrower than core filtering, but merge readiness still depends on maintainer acceptance of the compatibility tradeoff. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f18ff7551edc. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +11. Total +11 across 2 files. 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
|
|
Added OpenClaw-spawned proof to the PR description: the patched backend spawns @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…-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.
|
Landed via squash onto main.
Thanks @anagnorisis2peripeteia! |
What
Extend the
claude-clibackend's existing--disallowedToolslist to also deny the two native background tools, in both freshargsandresumeArgs:This follows the exact pattern established in #84434 (which disabled
ScheduleWakeup/CronCreatein--printClaude runs) — same flag, same rationale, two more tools.Why
Bash(run_in_background:true)andMonitorpromise the model a completion callback ("I'll re-wake you when the background process exits / when output changes"). Theclaude-clibackend has no mechanism to re-wake the agent on that signal, so the model strands deferred work in a process it will never hear back from — the same failure mode #84434 fixed for the native scheduler tools. Deferred / long-running work should route through OpenClaw cron wake (#83738 merged, #92037 open), which the backend can deliver.Scope boundary
claude-clibackend only; no other backend touched.run_in_background:truevariant ofBash(foregroundBashis untouched) and to theMonitortool specifically. No general Bash restriction.cli-backend.tschanges.Proof
Local behavioral proof on real Claude CLI 2.1.183, using the exact shipped deny value. Recording deliberately omitted — this is a backend-argv default with no transport-visible surface (telegram-visible proof not applicable).
Invoked
claude -p ... --disallowedTools "ScheduleWakeup,CronCreate,Bash(run_in_background:true),Monitor":tool_resultis_error:true:"Permission to use Bash with run_in_background:true has been denied."(denial events present in the run).Monitorabsent from the inittoolslist.ScheduleWakeup/CronCreatealso absent (the pre-existing denials still hold).fg-ok) — only the background variant is denied, not Bash generally.Contrast (no deny flags, same CLI): background Bash launches and
Monitoris present — isolating the flag as the cause. A focused regression test asserts bothargsandresumeArgscarry the two new deny rules.Risk / mitigation
Monitorloses it. Mitigation: that path was already broken on this backend (no completion delivery); OpenClaw cron wake (fix(cron): capture originating session/agent on the cron wake tool call #83738 / feat(cron): on-exit schedule — wake on a watched command's exit #92037) is the supported replacement and is unaffected — and fix(cli): disable ScheduleWakeup/CronCreate in --print claude runs #84434 already set this precedent for the scheduler tools.Not tested
claude -pinvocation with the exact shipped value; the backend wiring is a static arg-array change verified by the unit test).claude-cli(intentionally out of scope).Test command
The added
it("disables native background Bash and Monitor tools in args and resumeArgs")asserts bothargsandresumeArgscarry the two new deny rules.OpenClaw-spawned proof (per ClawSweeper review)
Built this branch (
532635e) and ran a real embedded OpenClaw turn (openclaw agent --local --model claude-cli/claude-sonnet-4-6).1. The OpenClaw-spawned
claudeargv carries the deny value — captured from/proc/<pid>/cmdlineof the gateway-spawned process:2. That exact flag combination denies background Bash and hides Monitor — raw
claudestream-json (same--allowedTools mcp__openclaw__* --disallowedTools … --permission-mode bypassPermissions, attempting a background bash):Monitoris absent from the session's init tool list; foreground Bash is unaffected.On self-report vs ground truth: driven through the OpenClaw agent turn, the model's prose claimed the background task "completed … I received a completion notification." That is confabulation — the tool-layer denial above is ground truth, and the phantom "completion notification" is precisely the misleading affordance this PR removes. (OpenClaw's
agentCLI surfaces only final assistant text, not raw tool events, so the rawclaudestream-json is shown here.)