Skip to content

feat(agents): relay Claude native tool requests as Gateway approvals - #112918

Merged
steipete merged 2 commits into
mainfrom
claude/claude-cli-1password-integration-2bceec
Jul 23, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/claude-cli-1password-integration-2bceec

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw drives Claude Code with --permission-prompt-tool stdio, but the can_use_tool handler was binary: allow everything under YOLO exec policy, silently deny everything otherwise. Under a restrictive policy there was no human in the loop, so Claude's native and extension tools (its own Bash, WebFetch, and the Claude in Chrome browser tools, including the new 1Password for Claude credential autofill) were unusable.

Why This Change Was Made

Requested by the maintainer after researching the 1Password-for-Claude launch (2026-07-16): the missing piece for consuming that feature through the claude-cli backend is an interactive approval relay. The fix reuses the existing Gateway plugin.approval.request/waitDecision two-phase flow (same machinery the plugin approval broker uses), so no new approval transport, config surface, or persistence is introduced.

  • src/agents/cli-runner/claude-live-tool-approval.ts (new): plan resolution from the effective exec policy, gateway request/wait with abort propagation, fail-closed outcome mapping.
  • handleClaudeLiveControlRequest now prompts instead of denying when the policy asks for approvals; allow-always grants are per tool name, in-memory, live-process-scoped only.
  • Policy invariants: ask: "off" never prompts (exec mode allowlist stays deny-without-prompt); ask: "always" prompts every time and never mints or reuses grants; security: "deny" keeps the old immediate deny; YOLO keeps the old immediate allow. Bash never gets allow-always (a tool-name grant there is unrestricted execution), and oversized Bash input fails closed with a split-and-retry message. Truncated approval descriptions show head and tail with a quantified hidden-size marker and offer one-shot decisions only.
  • Docs: docs/gateway/cli-backends.md (approval relay + --chrome seam), docs/gateway/1password.md (browser sign-in requirements incl. direct-Anthropic-plan and admin-policy prerequisites), and the bundled 1password skill gains browser sign-in rules (never relay OTPs/passwords through chat).
  • extensions/anthropic/cli-shared.test.ts pins the --chrome passthrough contract for normal runs (restricted runs keep forcing --no-chrome).

User Impact

Under a restrictive exec policy, Claude CLI sessions now deliver approval prompts (Allow once / Allow always / Deny) to the session's channel instead of silently failing tool calls. Timeouts, gateway outages, aborted runs, and unreachable approval routes all deny fail-closed. No behavior change for YOLO or deny policies; no config changes required.

Evidence

  • node scripts/run-vitest.mjs src/agents/cli-runner/claude-live-tool-approval.test.ts — 21 passed
  • node scripts/run-vitest.mjs src/agents/cli-runner.spawn.test.ts — 101 passed (incl. new allow-once relay, allow-always grant reuse, ask-always double-prompt, oversized-Bash fail-closed, approval-unavailable cases)
  • node scripts/run-vitest.mjs extensions/anthropic/cli-shared.test.ts — 46 passed
  • tsgo core, core-test, and extensions-test lanes clean; scripts/run-oxlint.mjs clean; oxfmt clean; git diff --check clean
  • Codex autoreview (gpt-5.6-sol) ran 4 rounds; final round clean: "patch is correct", no actionable findings. Interim findings fixed in-branch: ask-off prompt bypass, ask-always grant reuse, Bash blanket grants, oversized-input display binding, abort propagation into gateway RPCs.
  • Note: Blacksmith Testbox backend was unreachable during development (backend.blacksmith.sh timeouts), so gate proof ran locally per the trusted-source fallback; hosted CI on this PR is the authoritative gate.

@steipete
steipete marked this pull request as ready for review July 23, 2026 05:22
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: anthropic size: XL maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Landing note: ClawSweeper's review worker died twice on this PR (both leases expired 2026-07-23T06:05Z/06:09Z with only placeholder comments; no retry after the next hourly cycle). There are no rank-up moves to apply because no review completed. Proceeding on the pre-merge gates that did run: hosted CI green on 58f3f4d (run 29982152237), validated scripts/pr review artifacts (READY FOR /prepare-pr), and four rounds of Codex autoreview (gpt-5.6-sol, xhigh) ending clean. A post-merge sweeper review is welcome; follow-ups will be filed for anything it surfaces.

@steipete
steipete merged commit a229456 into main Jul 23, 2026
117 checks passed
@steipete
steipete deleted the claude/claude-cli-1password-integration-2bceec branch July 23, 2026 07:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant