Skip to content

feat(plugin-sdk): derive tool target paths for hooks#79705

Merged
steipete merged 19 commits into
mainfrom
maint/75605-derived-tool-paths
May 9, 2026
Merged

feat(plugin-sdk): derive tool target paths for hooks#79705
steipete merged 19 commits into
mainfrom
maint/75605-derived-tool-paths

Conversation

@steipete

@steipete steipete commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Supersedes [plugin sdk] Derive tool target paths for hooks #75605 with the derived apply_patch target-path seam rebased onto current main.
  • Adds host-owned apply_patch path derivation for before_tool_call and trusted policy hooks, including sandbox bridge resolution and frozen derived path arrays.
  • Clears/re-derives derived paths when trusted policies rewrite params, guards parser lookup against prototype keys, and documents the additive SDK hook field.

Real behavior proof

  • Behavior addressed: plugin hooks and trusted tool policies had to re-parse apply_patch envelopes themselves to know target paths, making policy hooks inconsistent with host path resolution and sandbox path bridging.
  • Real environment tested: local OpenClaw checkout after rebase onto current main, with plugin SDK API baseline regenerated and full build completed.
  • Exact steps or command run after this patch: ran the real before_tool_call E2E path and native Codex hook relay path with apply_patch inputs using pnpm test src/agents/apply-patch-paths.test.ts src/plugins/host-tool-param-parsers.test.ts src/agents/pi-tools.before-tool-call.e2e.test.ts src/agents/harness/native-hook-relay.test.ts src/plugins/contracts/host-hooks.contract.test.ts, then pnpm build.
  • Evidence after fix: terminal output from the patched run:
[test] passed 4 Vitest shards in 12.91s
OK docs/.generated/plugin-sdk-api-baseline.sha256
Found 0 warnings and 0 errors.
[build-all] check-plugin-sdk-exports
OK: All 4 required plugin-sdk exports verified.
  • Observed result after fix: apply_patch target paths are present on before_tool_call events, trusted policy events receive re-derived paths after param rewrites, native Codex PreToolUse uses the Codex cwd for derived apply_patch paths, and the SDK API baseline/build remain consistent.
  • What was not tested: no live third-party plugin install; covered through host hook contract fixtures and real OpenClaw hook execution paths.

Verification

  • pnpm test src/agents/apply-patch-paths.test.ts src/plugins/host-tool-param-parsers.test.ts src/agents/pi-tools.before-tool-call.e2e.test.ts src/agents/harness/native-hook-relay.test.ts src/plugins/contracts/host-hooks.contract.test.ts
  • pnpm check:test-types
  • pnpm lint:core
  • pnpm plugin-sdk:api:gen
  • pnpm plugin-sdk:api:check
  • pnpm run check:no-conflict-markers
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/plugins/hooks.md docs/.generated/plugin-sdk-api-baseline.sha256 src/agents/apply-patch-paths.test.ts src/agents/apply-patch-paths.ts src/agents/harness/native-hook-relay.test.ts src/agents/harness/native-hook-relay.ts src/agents/pi-tools.before-tool-call.e2e.test.ts src/agents/pi-tools.before-tool-call.ts src/agents/pi-tools.ts src/auto-reply/reply/dispatch-from-config.test.ts src/plugins/contracts/host-hooks.contract.test.ts src/plugins/hook-types.ts src/plugins/host-tool-param-parsers.test.ts src/plugins/host-tool-param-parsers.ts src/plugins/trusted-tool-policy.ts
  • git diff --check origin/main...HEAD && git diff --check
  • pnpm build

Supersedes #75605. Replaces part of #74483 / #73384.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels May 9, 2026
@clawsweeper

clawsweeper Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(plugin-sdk): derive tool target paths for hooks This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete force-pushed the maint/75605-derived-tool-paths branch from bf6dd25 to e8842d3 Compare May 9, 2026 07:24
@steipete
steipete merged commit e4bae42 into main May 9, 2026
111 checks passed
@steipete
steipete deleted the maint/75605-derived-tool-paths branch May 9, 2026 07:31
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 maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants