Skip to content

fix(tools): honor workspaceOnly for file tools - #174740

Merged
steipete merged 2 commits into
mainfrom
fix/workspaceonly-file-tools
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/workspaceonly-file-tools

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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: true use 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

  • Regression tests failed before their corresponding fixes.
  • Core production and agent test types, targeted core type-aware lint, formatting, and diff checks passed.
  • The extension correction passed formatting and commit-hook lint. Local extension type-aware lint could not complete: SDK declaration preparation reached its 300-second timeout, and the following package typecheck reported missing SDK declarations. Final-head PR CI passed and supplies the extension static proof.
  • Independent review is clean at P0–P2.
  • Final-head PR CI passed for 93b6f473c00df485dfafbddf22a9f2bf1cb642ce; the required CI gate is green.
  • All 32 focused tests passed: 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.
  • The five Anthropic tool-authority projection tests passed after the new question-tool regression failed before its fix.
  • Coverage includes workspace reads/writes/edits, outside-path and symlink rejection, policy overrides, exact tool selection, backend requirements, and internal tool-free controls.

Scope: 29 production lines added, 7 removed; 208 test lines added. Filesystem checks remain with the existing OpenClaw tool owners.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 22:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T22:12:54.572332Z 83e60fa Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 93b6f473c00df485dfafbddf22a9f2bf1cb642ce
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/cli-runner/prepare-tool-policy.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Route 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.

  • Before: Native CLI file tools can admit the outside-workspace operation.
  • After: Native file tools are disabled and the scoped OpenClaw file tool rejects the path.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The repair is focused and the prior question-capability defect is fixed, but authority proof and existing-setting upgrade evidence remain incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: CLI-backed agents can access files outside their workspace despite an enabled workspace-only restriction.
Reason: The documented restriction has concrete user value, and the maintainer-authored direction selects existing filesystem enforcement with explicit backend requirements.

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
Reviewed head: 93b6f473c00df485dfafbddf22a9f2bf1cb642ce

Before merge

  • Add real behavior proof - Authority-chain proof required: supplied tests run real OpenClaw filesystem tools behind a substituted backend and grant lifecycle, rather than a real CLI client through MCP; provide redacted terminal output or logs showing allowed workspace operations, outside and distinct-agent workspace rejection, and revoked or replaced grants rejected before I/O, removing credentials, IPs, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Explain recovery when workspace-only execution is refused (P3) - When workspaceOnly is enabled on a backend without bundled MCP or exact selection, or on a node-hosted session, preparation now stops with only “cannot enforce workspace-only tool policy.” The user cannot tell which requirement failed or how to resume safely. Preserve the refusal, identify the unsupported requirement, and name a supported recovery such as selecting a backend with bundled MCP and exact tool selection. This prior P3 finding remains unresolved.
  • Resolve security concern: Verify workspace identity and grant retirement - The mediation path carries an execution workspace alongside a potentially different policy identity and can transfer authority onto a reusable CLI process bearer; supplied tests substitute the grant lifecycle and cannot establish isolation or revocation at the final filesystem effect.
  • Resolve merge risk - Workspace isolation now depends on MCP grant scoping and current authority across CLI process reuse, including runs whose execution and policy agents differ.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P3] Explain recovery when workspace-only execution is refused — src/agents/cli-runner/prepare-tool-policy.ts:105-106
  • [medium] Verify workspace identity and grant retirement — src/agents/cli-runner/prepare.ts:318

Tests

  • Missing end-to-end proof: Supply real-client MCP filesystem results, nearest-forbidden workspace and revoked-grant rejection before I/O, and a latest-stable upgrade run preserving existing settings and session data.
Agent review details

How this fits together

CLI 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]
Loading

Technical review

Best 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:

  • [P3] Explain recovery when workspace-only execution is refused — src/agents/cli-runner/prepare-tool-policy.ts:105-106
    When workspaceOnly is enabled on a backend without bundled MCP or exact selection, or on a node-hosted session, preparation now stops with only “cannot enforce workspace-only tool policy.” The user cannot tell which requirement failed or how to resume safely. Preserve the refusal, identify the unsupported requirement, and name a supported recovery such as selecting a backend with bundled MCP and exact tool selection. This prior P3 finding remains unresolved.
    Confidence: 0.98

Overall correctness: patch is correct
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9828bcfff7e9.

Merge-risk options

Maintainer options:

  1. Validate the existing grant boundary (recommended)
    Demonstrate that the mediated execution workspace remains authoritative across differing agent identities and CLI process reuse, with retired grants rejected before filesystem I/O.

Provenance checked

  • CLI completion and restricted-turn mediation keeps the original intent (72f5840: Restore policy-filtered completion tools through MCP because native CLI tools cannot enforce captured restrictions.)
  • Sender and delegated execution restrictions keeps the original intent (5e0066b: Keep inherited restrictions and explicit delegated authority enforced during CLI execution.)
  • Anthropic native capability projection keeps the original intent (82d2c99: Translate equivalent observed native capabilities into canonical authority for scheduled work.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete introduced bypass was established, but the changed grant boundary still needs final-effect authority evidence.

Evidence

Security concerns:

  • [medium] Verify workspace identity and grant retirement — src/agents/cli-runner/prepare.ts:318
    The mediation path carries an execution workspace alongside a potentially different policy identity and can transfer authority onto a reusable CLI process bearer; supplied tests substitute the grant lifecycle and cannot establish isolation or revocation at the final filesystem effect.
    Confidence: 0.95

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 82d2c99 adds extensions/anthropic/cli-backend.ts:63 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 82d2c992a25b; files: extensions/anthropic/cli-backend.ts)
  • Stronggenetics: Raw commit 72f5840 adds src/agents/cli-runner/prepare-tool-policy.ts:68 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 72f5840c1192; files: src/agents/cli-runner/prepare-tool-policy.ts)

PR surface

Source +22, Tests +208, Docs +5. Total +235 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 29 7 +22
Tests 3 208 0 +208
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 242 7 +235

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This restores a configured filesystem restriction on CLI-backed turns without evidence of a broader runtime outage.
  • merge-risk: 🚨 compatibility: Existing workspace-only configurations on unsupported or node-hosted backends now refuse execution; the maintainer-authored direction explicitly accepts this restriction.
  • merge-risk: 🚨 security-boundary: File operations move from native CLI execution to run-bound MCP authority, making workspace identity and grant retirement security-relevant.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof through a real CLI client for the nearest unauthorized workspace and verify revocation invalidates the grant before I/O.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-16T22:24:35.280Z sha 83e60fa :: needs real behavior proof before merge. :: [P2] Preserve exact non-file native capabilities | [P3] Explain recovery when workspace-only execution is refused

Reviewed October 16, 2026, 6:34 PM ET / 22:34 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@steipete
steipete enabled auto-merge (squash) October 16, 2026 22:36
@steipete
steipete merged commit b10a19d into main Oct 16, 2026
126 checks passed
@steipete
steipete deleted the fix/workspaceonly-file-tools branch October 16, 2026 22:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Oct 17, 2026
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.
obviyus added a commit that referenced this pull request Oct 17, 2026
## 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* fix(tools): honor workspaceOnly for file tools

* fix(tools): preserve mediated question capability
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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]>
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: anthropic gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant