Repository navigation
fix(tools): honor workspaceOnly for file tools - #174740
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83e60fa702
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs real behavior proof before merge. What this changesRoute workspace-only CLI turns through scoped OpenClaw MCP tools and reject backends that cannot enforce that restriction. Example: An agent rooted at /workspace/main has tools.fs.workspaceOnly enabled and requests /workspace/other/note.txt.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: it addresses a current filesystem-policy gap, preserves question capability after the correction, and retains one actionable recovery-message defect. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCLI preparation converts configured tool restrictions into backend tool selections and run-bound MCP grants; the Gateway resolves those grants into policy-filtered tools that perform filesystem operations. flowchart TD
A[Agent configuration] --> B[CLI preparation]
B --> C[Exact tool selection]
B --> D[Run-bound MCP grant]
C --> E[CLI backend]
E --> D
D --> F[Scoped OpenClaw tools]
F --> G[Workspace filesystem]
Technical reviewBest possible solution: Keep filesystem enforcement with the existing scoped tool owners and make unsupported-backend refusals actionable. Do we have a high-confidence way to reproduce the issue? Current-main source permits ordinary native CLI file admission without applying workspaceOnly; the linked report supplies affected releases and outside-workspace read steps, but no live reproduction was run during this review. Is this the best way to solve the issue? Reusing scoped OpenClaw tools is a focused repair that avoids duplicating containment logic in native permission handlers. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9828bcfff7e9. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete introduced bypass was established, but the changed grant boundary still needs final-effect authority evidence. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +22, Tests +208, Docs +5. Total +235 across 7 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 6:34 PM ET / 22:34 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
PR #174740 intentionally requires bundled MCP and exact tool selection for workspace-only CLI turns: "Backends must support bundled MCP and exact tool selection to run workspace-only turns." The construction fixture has neither, so agent exec now refuses it before supervisor admission; its finally-block cleanup expectation masks that earlier refusal. Explicitly disable workspace confinement in this isolated synthetic config so the test reaches its unread private pipe. Preserve every existing construction, deadline, timeout, exit, and cleanup assertion. Production defaults and authority checks are unchanged. The unchanged test passes on 4453e55 (the parent of b10a19d) and fails on b10a19d. Current-main diagnostics confirmed the workspace-only refusal. The repaired construction test and both workspace-policy suites pass locally with --maxWorkers=1. Targeted tsgo, type-aware lint, formatting, and isolated P2 autoreview pass. No CI dispatches or reruns.
## What Problem This Solves Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool. Related: #174740. ## User Impact Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300. ## Why This Change Was Made `extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in #174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested. Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change. The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key. ## Evidence Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change. | Cell | Before: `25933024a1e197fa1a503e84b573a47203fc674f` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` | | --- | --- | --- | | Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | | Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed. Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `4513e9e09633a740f58b4ccf8802597968868c47`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff). Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport. - Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s. - Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass. - Candidate production build passes; declaration generation was skipped for runtime proof. - [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair #174947 is included. ## Merge Danger Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them. Co-authored-by: Ayaan Zaidi <[email protected]>
* fix(tools): honor workspaceOnly for file tools * fix(tools): preserve mediated question capability
PR openclaw#174740 intentionally requires bundled MCP and exact tool selection for workspace-only CLI turns: "Backends must support bundled MCP and exact tool selection to run workspace-only turns." The construction fixture has neither, so agent exec now refuses it before supervisor admission; its finally-block cleanup expectation masks that earlier refusal. Explicitly disable workspace confinement in this isolated synthetic config so the test reaches its unread private pipe. Preserve every existing construction, deadline, timeout, exit, and cleanup assertion. Production defaults and authority checks are unchanged. The unchanged test passes on 421b1d6 (the parent of ac71889) and fails on ac71889. Current-main diagnostics confirmed the workspace-only refusal. The repaired construction test and both workspace-policy suites pass locally with --maxWorkers=1. Targeted tsgo, type-aware lint, formatting, and isolated P2 autoreview pass. No CI dispatches or reruns.
…4951) ## What Problem This Solves Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool. Related: openclaw#174740. ## User Impact Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300. ## Why This Change Was Made `extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in openclaw#174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested. Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change. The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key. ## Evidence Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change. | Cell | Before: `964a9ea2957cdb7a6566daf3d927691ad06a8557` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` | | --- | --- | --- | | Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | | Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed. Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `01edef4f3f37deb66bf4e448ac2ff30f8b644771`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff). Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport. - Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s. - Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass. - Candidate production build passes; declaration generation was skipped for runtime proof. - [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](openclaw#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair openclaw#174947 is included. ## Merge Danger Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them. Co-authored-by: Ayaan Zaidi <[email protected]>
…4951) ## What Problem This Solves Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool. Related: openclaw#174740. ## User Impact Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300. ## Why This Change Was Made `extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in openclaw#174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested. Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change. The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key. ## Evidence Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change. | Cell | Before: `25933024a1e197fa1a503e84b573a47203fc674f` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` | | --- | --- | --- | | Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | | Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass | Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed. Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `4513e9e09633a740f58b4ccf8802597968868c47`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff). Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport. - Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s. - Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass. - Candidate production build passes; declaration generation was skipped for runtime proof. - [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](openclaw#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair openclaw#174947 is included. ## Merge Danger Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 27f8c47) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Makes configured workspace-only file access apply consistently to CLI-backed agent turns.
User Impact
CLI-backed turns with
tools.fs.workspaceOnly: trueuse scoped OpenClaw tools. Agent overrides remain effective, and unconfined turns retain their existing behavior. Backends must support bundled MCP and exact tool selection to run workspace-only turns.Why This Change Was Made
Reuse the existing MCP tool projection and filesystem policy owners, while preserving exact tool selections, native question capability through
ask_user, and internal tool-free controls. The CLI-backend documentation explains the behavior and backend requirements.Refs #173058
Evidence
93b6f473c00df485dfafbddf22a9f2bf1cb642ce; the required CI gate is green.node scripts/run-vitest.mjs src/agents/cli-runner/prepare.completion-tools.test.ts src/agents/cli-runner/prepare-tool-policy.delegation.test.ts --maxWorkers=1.Scope: 29 production lines added, 7 removed; 208 test lines added. Filesystem checks remain with the existing OpenClaw tool owners.