Repository navigation
feat(anthropic): enforce --safe-mode on all claude-cli subprocess launches - #92070
ElliotDrel wants to merge 1 commit into
Conversation
…nches OpenClaw manages its own skills, CLAUDE.md, memory, and hooks. Any user-level Claude Code customizations on the host are redundant and can silently interfere with OpenClaw-managed sessions — injecting unexpected context, skills, or hook side-effects into turns that OpenClaw controls. This mirrors how --setting-sources user is already enforced: added to the default args in cli-backend.ts and enforced unconditionally via a new normalizeClaudeSafeModeArgs normalizer in cli-shared.ts, which is wired into the normalizeClaudeBackendConfig pipeline for both fresh and resumed sessions. Even if a user removes --safe-mode from their agents.defaults.cliBackends.claude-cli config override, normalization re-applies it. Requires Claude Code CLI >= 2.1.169 (2026-06-08), which introduced --safe-mode / CLAUDE_CODE_SAFE_MODE. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed August 11, 2026, 9:12 PM ET / August 12, 2026, 01:12 UTC. ClawSweeper reviewWhat this changesThis PR adds Merge readiness⛔ Blocked until real behavior proof is added - 6 items remain Do not merge this PR: its global Priority: P1 Review scores
Verification
How this fits togetherThe Anthropic plugin turns OpenClaw agent configuration into Claude Code subprocess arguments, then applies per-run tool restrictions before launch. Those arguments preserve normal MCP tool access while isolating restricted or side-question runs. flowchart LR
A[Agent configuration] --> B[Claude CLI backend]
B --> C[Backend normalization]
C --> D[Per-run tool policy]
D --> E[Claude Code subprocess]
E --> F[OpenClaw MCP tools]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +13. Total +13 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Do we have a high-confidence way to reproduce the issue? Yes, from source: normal Claude CLI configuration would receive Is this the best way to solve the issue? No. Current main isolates only restricted and side-question runs while preserving exact MCP access; a global config-time flag is the wrong boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff73a14f5ae7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
closing as superseded. @ElliotDrel's customization-leak observation is valid: host-level Claude customizations can interfere with OpenClaw-managed sessions. the blanket current
the existing head is conflicting. it adds no tests, provides no fresh/resumed MCP real-behavior proof, and has five failed the replacement implementations were independently authored, so there is no co-author transfer. |
Summary
OpenClaw manages its own skills, CLAUDE.md, memory, and hooks. Any user-level Claude Code customizations on the host are redundant in this context and can silently interfere with OpenClaw-managed sessions — injecting unexpected context, skills, or hook side-effects into turns that OpenClaw controls.
This PR enforces
--safe-modeon every Claude Code CLI subprocess OpenClaw launches, using the same pattern already established for--setting-sources user:argsandresumeArgsincli-backend.tsnormalizeClaudeSafeModeArgsnormalizer incli-shared.ts, wired into thenormalizeClaudeBackendConfigpipelineThis means even if a user removes
--safe-modefrom theiragents.defaults.cliBackends.claude-cliconfig override, normalization re-applies it — matching the behavior of--setting-sources user.Changes
extensions/anthropic/cli-backend.ts: add--safe-modeto defaultargsandresumeArgsextensions/anthropic/cli-shared.ts: addCLAUDE_SAFE_MODE_ARGconstant,normalizeClaudeSafeModeArgsfunction, and wire it intonormalizeClaudeBackendConfigRequirements
Requires Claude Code CLI >= 2.1.169 (2026-06-08), which introduced
--safe-mode/CLAUDE_CODE_SAFE_MODE.Test plan
--safe-modein the subprocess args--resume) include--safe-mode--safe-modefromagents.defaults.cliBackends.claude-cli.argsstill gets it re-applied by normalization--setting-sources userenforcement is unaffected🤖 Generated with Claude Code