Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 29, 2026, 8:52 PM ET / September 30, 2026, 00:52 UTC (Revision 12). ClawSweeper reviewWhat this changesThe Anthropic plugin adds memory-exclusion settings to ordinary fresh and resumed Claude CLI runs, with documentation and argument-normalization tests. Merge readiness⛔ Blocked before merge - 6 items remain This PR addresses a gap still present on current main, but its documented operator override is unreachable through the supported configuration path. The default change also needs a maintainer decision, and the supplied proof stops before an installed Claude Code process demonstrates the result. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's Anthropic plugin supplies launch arguments for the installed Claude Code CLI. The CLI backend resolver prepares those arguments for fresh or resumed agent runs, and Claude Code then constructs the agent's context. flowchart LR
A[Agent turn] --> B[Anthropic CLI backend]
B --> C[Normalize launch arguments]
C --> D{Restricted run?}
D -->|No| E[Ordinary settings]
D -->|Yes| F[Restricted settings]
E --> G[Claude Code process]
F --> G
Decision needed
Why: Either choice changes which instructions existing users' agents receive; the PR itself calls out the default-policy tradeoff, and its proposed escape hatch is unreachable. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +30, Tests +215, Docs +11. Total +256 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the current default until a maintainer chooses the isolation policy; if isolation is optional, expose one supported Anthropic-owned setting that reaches fresh and resumed runs, then prove both choices with an installed Claude Code process. Do we have a high-confidence way to reproduce the issue? Not applicable as a policy change. Source shows the current-main ordinary path lacks memory-exclusion settings, but no installed Claude Code before-and-after behavior was observed for this PR. Is this the best way to solve the issue? No. The shared argument normalizer is a plausible owner for the payload, but the proposed unconditional default and unreachable override do not provide a safe upgrade path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec9f4865045b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
8dd90c0 to
6306e72
Compare
CI note:
|
Follow-up: the retrigger hit a different flake in the same shardThe rebase cleared
So across two retriggers this branch has hit two different flaky tests in that one shard, and no failure has ever pointed at the change itself. I am going to stop re-pushing rather than keep re-rolling a ~170-job matrix; a maintainer re-run of the failed job is the cheap fix. All authored gates remain green on this commit: 🤖 Generated with Claude Code |
6ab030d to
399672a
Compare
ef687b1 to
bde528d
Compare
9fd7c70 to
c0dc13b
Compare
…runs Claude Code loads its own memory surfaces into every run: project CLAUDE.md / CLAUDE.local.md / .claude/rules files and its auto-memory. On this backend those land in an agent context OpenClaw did not compose and does not account for in its context budget -- they address Claude Code as a coding assistant, not the agent the operator configured. Only one payload in the tree turns them off, and today it reaches almost nothing. `CLAUDE_RESTRICTED_SETTINGS` is pushed solely by the restricted argv builder, which runs only when `context.toolAvailability` is set -- and just two production callers set it (isolated completions, and opted-in embedded CLI dispatch). Ordinary conversation turns take the `: executionArgs` branch, so they pass no `--settings` at all and both keys stay unset. `--setting-sources user` does not close this: it bounds which *settings files* load, while CLAUDE.md and auto-memory are separate mechanisms. Normalize an isolation payload onto every claude-cli invocation instead, fresh and resumed. `--settings` takes "a JSON string to load additional settings from", so this layers onto user settings rather than replacing them. Scope is deliberately narrower than the restricted profile: memory keys only. Hooks and plugins are operator-owned customization that does not feed the model's context, so ordinary runs leave them alone. Both profiles are now built from one field set so they cannot drift into expressing different memory policies -- the restricted string is byte-identical to before, which its three existing assertions pin. An operator who supplies their own `--settings` owns the whole payload and OpenClaw appends nothing, which is the escape hatch for anyone who deliberately wants their workspace CLAUDE.md read. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BjsHL4YEa67pAiPpSY3svm
`tsconfig.extensions.test.json` typechecks extension tests as its own project, so the direct `as Parameters<...>[0]` assertion on a partial context failed there (TS2352) while core typechecking stayed green. Build the real context shape the other tests in this file already use. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BjsHL4YEa67pAiPpSY3svm
c0dc13b to
a99ce79
Compare
|
Adding a real-world report in support of fixing this. Environment: OpenClaw 2026.9.8 (fc23bc8), Ubuntu 22.04, systemd user service, Claude Code 2.1.282, On ordinary channel turns (no The documented alternative, a separate On the policy question in the review: an opt-in setting would fully solve this for us, as long as it is a supported switch that reaches both fresh and resumed runs. |
|
Hi @zijunl, thanks for this PR and for working out the shared memory field set with the restricted profile. I opened #166073, which builds on your approach. It started as the opt-in the review suggested, but it now follows your original direction: ordinary claude-cli runs exclude Claude Code's memory by default, fresh and resumed. It adds the piece the review found missing, a reachable override: Edited 2026-10-07: updated after #166073 moved from opt-in to default-on. Happy to fold anything from your branch back into it, or to close mine if you would rather update this PR instead. Whatever works best for you. |
|
Thanks for picking this up, @hannnnn-l — happy for #166073 to be the vehicle. It implements exactly what the review recommended (keep today's default, add a supported opt-in that reaches fresh and resumed runs), and the shared field set is already carried over with credit. Nothing on my branch needs folding back in. Closing this one as superseded by #166073. |
What Problem This Solves
Claude Code loads its own memory surfaces into every run: project
CLAUDE.md/CLAUDE.local.md/.claude/rulesfiles, and its auto-memory. On theclaude-clibackend those land in the agent context OpenClaw composed, which never accounted for them — they address Claude Code as a coding assistant, not the agent the operator configured, and they consume a context budget OpenClaw is separately managing.Exactly one payload in the tree turns them off, and today it reaches almost nothing:
It is pushed only by
resolveClaudeCliRestrictedExecutionArgs, and that builder runs only whencontext.toolAvailabilityis set:Only two production callers set
cliToolAvailability:src/agents/isolated-completion.tsandsrc/agents/embedded-agent-runner/cli-backend-dispatch.ts. An ordinary conversation turn is neither, so it passes no--settingsand both keys stay unset.--setting-sources userdoes not close this. It bounds which settings files load (user/project/local);CLAUDE.mdand auto-memory are separate mechanisms that only these two keys control.Approach
Normalize an isolation payload onto every
claude-cliinvocation, fresh and resumed. Perclaude --help,--settings <file-or-json>loads "additional settings", so this layers onto the user's settings rather than replacing them.Scope is deliberately narrower than the restricted profile — memory keys only. Hooks and plugins are operator-owned customization that does not feed the model's context, so ordinary runs leave them alone; the restricted profile remains the place both are also shut off.
Both profiles are now built from one shared field set so they cannot drift into expressing different memory policies. The restricted string is byte-identical to before, which its three existing assertions pin.
This is a default-behavior change. Anyone who deliberately wants their workspace
CLAUDE.mdread by aclaude-cli-backed agent loses that unless they opt back in. The escape hatch is in this PR: an operator who supplies their own--settingsin the backendargsowns the whole payload, and OpenClaw appends nothing. Documented indocs/gateway/cli-backends.md. I flagged this as the reviewer's call rather than mine — if you would rather it be config-gated than default-on, say so and I will convert it.Evidence
The two behavior tests fail against unfixed source rather than merely passing — removing the append block yields
expected -1 to be greater than or equal to 0on both.End-to-end probe through the real shipped descriptor (not a fixture), confirming
normalizeConfigactually reaches execution viaresolveCliBackendConfig:Gates run locally:
pnpm check:test-typesexit 0 (all three projects),tsgo:coreexit 0,pnpm check:docsexit 0,oxlint/oxfmtclean,deadcode:knipclean.extensions/anthropicsuite: 469 passed. The one failure there,session-catalog > re-stats only the changed project directory on the next poll, reproduces on cleanmainand is unrelated to this change.Tests
extensions/anthropic/cli-shared.arg-normalization.test.ts— 55 passing, covering:--settingsis left alone, in both split and=forms, with no second flag appended;--settingsand no leak of the ordinary default.cli-shared.test.tswas already near the 1000-line cap, so the argv-normalization describes moved into that new file alongside the new ones; the moved blocks are unchanged except for the added expectations.Limits
Verified on the OpenClaw side: which flags are and are not passed on each path. What Claude Code then does with the absence of those flags is its own default behavior, which I could not verify from this repo.
Relationship to #137134
This supersedes #137134, which fixed the same class of problem against
extensions/anthropic/agent-sdk.runtime.ts. #138707 deleted that file, so that PR's diff no longer applies. Its settings payload was already adopted upstream asCLAUDE_RESTRICTED_SETTINGS— this PR closes the remaining half, the ordinary run.🤖 Generated with Claude Code
https://claude.ai/code/session_01BjsHL4YEa67pAiPpSY3svm