Skip to content

fix(policy): align tool requirements with core vocabulary - #140628

Merged
steipete merged 6 commits into
mainfrom
steipete/dedup-policy-exec-0906
Sep 7, 2026
Merged

steipete merged 6 commits into
mainfrom
steipete/dedup-policy-exec-0906

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Policy requirements used a stale copy of core's tool groups, aliases and wildcard matching. Operators could receive incorrect conformance results: the copied filesystem group omitted ls, the runtime group omitted secrets, and scheduler/image names had drifted from core.

Why This Change Was Made

Policy now uses core group expansion and matching through one typed toolPolicy object on the existing public openclaw/plugin-sdk/agent-harness-runtime entrypoint. Its conformance adapter uses deny-only matching so an empty coverage list remains false and write does not cover apply_patch. Existing input validation removes or rejects blank requirements before expansion.

One public object is offset by retiring the two unused deprecated infra-runtime mode projections. Canonical counts/max: 152/152 public entrypoints, 4446/4446 exports, 2629/2629 callables, 1135/1138 deprecated exports, 50/50 wildcards. The exact export/callable caps shrink from 4447/2631 to 4446/2629. No entrypoint or budget is added. Production -77 lines; tests +55; documentation +32; tooling +2.

User Impact

Policy requirements now use the same vocabulary as core: group:fs includes ls, group:runtime includes secrets, cron resolves to automations, and the image-understanding tool is view_image. Required deny groups must cover every current member. Config syntax and store semantics are unchanged.

Evidence

  • Rebased onto main 9c960ad683b4a16302ecf8ab15372d72cb3256e5, including worker-transfer repair fix(node-host): honor umask in Git transfer mode assertions #140771 and the separate Telegram lint repair fix(telegram): unblock PR lint checks for progress-update tests #141148. Current head: 9a2b60a85138b7a612e4e633b433788170145b3c.
  • node scripts/run-vitest.mjs extensions/policy/src/tool-policy-conformance.test.ts extensions/policy/src/doctor/register.test.ts src/agents/tool-policy.test.ts src/agents/tool-catalog.test.ts src/plugins/doctor-contract-closure-guard.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts test/scripts/plugin-sdk-surface-report.test.ts: 406 tests passed in 142.75s (332 Policy, 41 core policy/catalog, 19 package contracts, four closure guards, ten SDK surface tests).
  • Canonical SDK export synchronization, export check, surface report and surface check passed. Exact-count and growth-rejection tests passed after the shrink-only cap update; no generated baseline was hand-edited.
  • Both staged-candidate and committed-branch Codex autoreviews are clean through P2. Lead inspection and an independent source audit verified the core matcher, group expansion and caller validation; no material core/caller drift was found.
  • pnpm build passed in 7m23.1s, including 91 plugins and public declarations (3,472,928/5,315,536 bytes).
  • node scripts/check-changed.mjs passed five typecheck lanes, SDK/ratchet guards, three dead-export scans and core lint, then hit only the permitted nested-worktree extension-lint Declaration input escapes checkout limitation.
  • CI https://github.com/openclaw/openclaw/actions/runs/34114675324 was superseded after main split the runtime documentation. The rebase preserves the new index and places the migration note in docs/plugins/sdk-runtime/config-and-utilities.md; runtime sources and SDK counts are byte-identical to the previously validated revision.
  • The 406-test run and full build above are from ba01401f444. After the documentation-only rebase, all 29 SDK/package contract tests, canonical SDK checks, targeted documentation changed checks, and fresh Codex review through P2 passed. The rebased repair commit also carries the corrected 406-test count. Exact-head CI and native preparation subsequently passed on the same rebased head, as recorded below.

Compatibility audit

Repository and completed global/organization consumer searches found no actual consumers of the retired deprecated resolveExecModeFromPolicy and resolveExecPolicyForMode exports. Ambiguous import-source candidates were read and use their own core implementations. This unused-export retirement is maintainer-approved under that audit requirement; no positive external consumer is ignored.

Existing core implementations and the private exec-approvals-runtime.resolveExecModePolicy facade remain available. That official JavaScript runtime facade has no packaged TypeScript declarations or equivalent typed third-party replacement; the migration limitation is documented. Indexed searches cannot establish absence of private or unindexed consumers.

Final CI and review follow-through

Exact-head CI https://github.com/openclaw/openclaw/actions/runs/34116376057 passed on attempt 2 at unchanged 9a2b60a85138b7a612e4e633b433788170145b3c, including openclaw/ci-gate. Attempt 1 failed only the unchanged CLI 1,000 ms validation fixture; the single permitted failed-job rerun passed. No source, timeout, baseline, or assertion changed for the retry.

Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 140628 completed successfully on unchanged 9a2b60a85138b7a612e4e633b433788170145b3c; no extra remote-gate flags were used.

The current-head ClawSweeper review reports no actionable patch defects. Its residual private/unindexed-consumer risk is accepted under the explicit maintainer direction for the completed zero-consumer audit and remains documented above.

@clawsweeper

clawsweeper Bot commented Sep 7, 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 scripts Repository scripts extensions: policy size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 02:06
@steipete
steipete marked this pull request as draft September 7, 2026 02:08
@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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 7:29 AM ET / 11:29 UTC.

ClawSweeper review

What this changes

The Policy plugin reuses core tool vocabulary for conformance checks, adds regression coverage and documentation, and retires two deprecated SDK exports.

Merge readiness

⛔ Blocked before merge - 1 item remains

The repair remains necessary on current main and v2026.9.2. No actionable patch defects remain after accounting for the recorded maintainer acceptance of the SDK retirement.

Priority: P2
Reviewed head: 9a2b60a85138b7a612e4e633b433788170145b3c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused canonical-owner repair with useful regression coverage and a documented, accepted SDK compatibility tradeoff.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its Policy adapter has focused regression and build evidence; no real CLI run is claimed, and no material authority change requires final-effect proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its Policy adapter has focused regression and build evidence; no real CLI run is claimed, and no material authority change requires final-effect proof.
Evidence reviewed 9 items Current main still needs the repair: The pinned main implementation retains the copied groups that omit ls and secrets and use cron and image. It also retains its separate alias and wildcard implementation.
Latest release retains the old behavior and exports: Inspection of v2026.9.2 confirms the stale Policy vocabulary and both deprecated infra-runtime exports are present in the latest supplied release.
Canonical matching preserves restrictive coverage: The core matcher checks expanded deny patterns first. Negating a deny-only matcher therefore leaves empty coverage false and does not apply the allow-side write/apply_patch compatibility. The inspected implementations are OpenClaw-owned; this change does not depend on the Codex runtime contract.
Findings None None.
Security None None.

How this fits together

The Policy plugin compares operator-authored requirements with configured OpenClaw settings and reports drift through policy checks and Doctor. Shared tool matching determines whether configured deny lists cover the required tools.

flowchart LR
  A[Authored requirements] --> C[Policy conformance]
  B[Configured tool lists] --> C
  D[Core tool vocabulary] --> E[Shared SDK matcher]
  E --> C
  C --> F[Policy and Doctor findings]
Loading

Before merge

  • Resolve merge risk (P1) - Private or unindexed plugins importing either retired infra-runtime helper can fail after upgrade, with no equivalent typed third-party replacement. The captured maintainer disposition accepts this residual compatibility risk.
Agent review details

Security

None.

PR surface

Source -77, Tests +55, Docs +32, Other +2. Total +12 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 8 85 -77
Tests 2 56 1 +55
Docs 3 32 0 +32
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 2 +2
Total 9 100 88 +12

Review metrics

Metric Value Why it matters
Public SDK contract 1 object added; 2 deprecated exports removed; 0 new entrypoints The smaller export count includes a real compatibility tradeoff for existing third-party imports.

Merge-risk options

Maintainer options:

  1. Retain the accepted retirement (recommended)
    Proceed under the recorded consumer audit and maintainer acceptance, retaining the documented limitation for third-party plugins.

Technical review

Best possible solution:

Keep Policy on core's canonical vocabulary and retain the explicit migration limitation for the maintainer-approved SDK retirement.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main's copied filesystem and runtime groups omit ls and secrets, producing incorrect coverage results compared with core. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing core expansion and deny matching removes the drift source while preserving restrictive coverage; the separate SDK retirement has an explicit accepted disposition.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 99415ced11be.

Labels

Label justifications:

  • P2: This fixes bounded, source-proven errors in operator-facing Policy conformance results.
  • merge-risk: 🚨 compatibility: Removing two exports shipped in v2026.9.2 can break undiscovered third-party consumers despite the accepted consumer audit.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its Policy adapter has focused regression and build evidence; no real CLI run is claimed, and no material authority change requires final-effect proof.

Evidence

What I checked:

  • Current main still needs the repair: The pinned main implementation retains the copied groups that omit ls and secrets and use cron and image. It also retains its separate alias and wildcard implementation. (extensions/policy/src/tool-policy-conformance.ts:2, 99415ced11be)
  • Latest release retains the old behavior and exports: Inspection of v2026.9.2 confirms the stale Policy vocabulary and both deprecated infra-runtime exports are present in the latest supplied release. (src/plugin-sdk/infra-runtime.ts:147, 3928bad9badf)
  • Canonical matching preserves restrictive coverage: The core matcher checks expanded deny patterns first. Negating a deny-only matcher therefore leaves empty coverage false and does not apply the allow-side write/apply_patch compatibility. The inspected implementations are OpenClaw-owned; this change does not depend on the Codex runtime contract. (src/agents/tool-policy-match.ts:14, 9a2b60a85138)
  • Conformance boundary and input validation: Required-deny findings expand each requirement and inspect every resulting tool; strictness comparison uses the same adapter. Both input readers remove blank entries. The policy CLI documentation explicitly describes reporting drift rather than enforcing tool execution. (extensions/policy/src/doctor/tool-findings.ts:302, 9a2b60a85138)
  • Compatibility disposition and re-review continuity: The supplied PR body records completed consumer searches and maintainer-approved retirement, while acknowledging private or unindexed consumers. The previous completed review records that this residual risk was accepted and contains no findings. The current documentation explicitly discloses the absence of an equivalent typed third-party replacement; the historical warning is not a new action request. Public docs: docs/plugins/sdk-runtime/config-and-utilities.md. (docs/plugins/sdk-runtime/config-and-utilities.md:60, 9a2b60a85138)
  • Introduced changes and merge boundary verified: The locally inspected test-merge commit has the exact pinned main parent followed by the exact PR head. Its comparison against main contains only the nine introduced paths; browser, session, and UI base-branch work is not removed by this PR. (469a3b1f5ee4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-07T04:19:38.109Z sha bbdd877 :: blocked before merge. :: [P1] Preserve the shipped SDK helpers through their migration window
  • reviewed 2026-09-07T04:52:26.392Z sha e3ae964 :: blocked before merge. :: [P1] Preserve the shipped SDK helpers through their migration window
  • reviewed 2026-09-07T05:02:29.585Z sha e3ae964 :: blocked before merge. :: none
  • reviewed 2026-09-07T06:04:17.412Z sha e3ae964 :: blocked before merge. :: none
  • reviewed 2026-09-07T07:15:25.514Z sha 1b5aa91 :: blocked before merge. :: none
  • reviewed 2026-09-07T08:28:35.319Z sha 1b5aa91 :: blocked before merge. :: none
  • reviewed 2026-09-07T11:10:45.411Z sha ba01401f4440307cb08f104b8225495ec827a505 :: blocked before merge. :: none
  • reviewed 2026-09-07T11:19:25.831Z sha ba01401f4440307cb08f104b8225495ec827a505 :: blocked before merge. :: none

@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906 branch from e9badb3 to 68348dd Compare September 7, 2026 03:55
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 03:57
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906 branch from bbdd877 to e3ae964 Compare September 7, 2026 04:46
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906 branch from 1b5aa91 to ba01401 Compare September 7, 2026 11:03
Use core group expansion and deny matching through a narrow SDK seam; preserve restrictive coverage semantics. Regression proof: 26 expected failures before repair; 332 conformance/doctor tests pass after, alongside 52 core tests and the remaining policy suites.
Keep core vocabulary canonical without growing the SDK budget; retire two unused deprecated projections. Proof: SDK export/surface checks and 33 policy/doctor boundary tests pass; autoreview clean.
Document first-seen order across entries and catalog order within each group. Proof: formatting and independent review pass.
Keep the typed entrypoint guide limited to typed public package exports. Proof: 19 SDK package contract tests, formatting, and autoreview pass.
Retain the approved export removals while disclosing that the private runtime facade has no packaged TypeScript replacement.
Proof: node scripts/check-changed.mjs -- docs/plugins/sdk-runtime.md.
Keep Policy conformance on core vocabulary and deny matching through one typed toolPolicy object on the existing public harness entrypoint. The two unused deprecated mode projections remain retired after the consumer audit.

Shrink the exact SDK export cap from 4447 to 4446 and the callable cap from 2631 to 2629, matching canonical source counts. No new entrypoint or budget increase. Proof: 406 focused and SDK contract tests pass; staged Codex review is clean through P2. Proof commands: pnpm plugin-sdk:check-exports; pnpm plugin-sdk:surface:check; pnpm build. Changed checks reached only the permitted nested-worktree extension declaration boundary. Runtime proof is unchanged by the documentation-only rebase.
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906 branch from ba01401 to 9a2b60a Compare September 7, 2026 11:23
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts and removed plugin: file-transfer labels Sep 7, 2026
@steipete
steipete merged commit bd8754f into main Sep 7, 2026
318 of 320 checks passed
@steipete
steipete deleted the steipete/dedup-policy-exec-0906 branch September 7, 2026 11:57
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 7, 2026
* commit 'b07b7d8bd1293c4e70ece7281b9cb8422318ae5a': (30 commits)
  fix(ui): keep reopened select menus visible (#141047)
  test(ui): fix dashboard gallery client fixtures (#141203)
  refactor(links): remove unused understanding results (#141200)
  refactor(plugins): share manifest contribution projection (#141193)
  refactor(logging): share portable redaction pattern mechanics (#140742)
  chore(ui): refresh control ui locales (#141208)
  refactor(minimax): reuse generated video asset downloader (#141094)
  fix(test): await Telegram loopback prompt reception (#141204)
  refactor(acp): remove unused in-memory event ledger (#141145)
  improve(models): reduce overhead in catalog discovery (#141154)
  refactor(channels): share approval reaction settlement (#140645)
  chore(i18n): refresh native locales (#141089)
  refactor: share one-shot tickets and WebSocket helpers across desktop, node, and browser streams (#141185)
  refactor(google-meet): share browser open and recovery setup (#140972)
  refactor(plugins): share npm version queries (#141166)
  refactor(http): share bounded response byte consumption (#140654)
  refactor(whatsapp): share prompt selection (#141195)
  fix: bound temporary storage for terminal upload batches (#141116)
  perf(markdown): reuse image parser configuration (#141126)
  fix(policy): align tool requirements with core vocabulary (#140628)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…40628)

* fix(policy): align tool requirements with core vocabulary

Use core group expansion and deny matching through a narrow SDK seam; preserve restrictive coverage semantics. Regression proof: 26 expected failures before repair; 332 conformance/doctor tests pass after, alongside 52 core tests and the remaining policy suites.

* refactor(policy): reuse existing SDK policy entrypoint

Keep core vocabulary canonical without growing the SDK budget; retire two unused deprecated projections. Proof: SDK export/surface checks and 33 policy/doctor boundary tests pass; autoreview clean.

* docs(plugin-sdk): clarify tool expansion order

Document first-seen order across entries and catalog order within each group. Proof: formatting and independent review pass.

* docs(plugin-sdk): place exec migration in runtime guide

Keep the typed entrypoint guide limited to typed public package exports. Proof: 19 SDK package contract tests, formatting, and autoreview pass.

* docs(plugin-sdk): scope tool policy migration guidance

Retain the approved export removals while disclosing that the private runtime facade has no packaged TypeScript replacement.
Proof: node scripts/check-changed.mjs -- docs/plugins/sdk-runtime.md.

* refactor(policy): group shared tool helpers in one SDK object

Keep Policy conformance on core vocabulary and deny matching through one typed toolPolicy object on the existing public harness entrypoint. The two unused deprecated mode projections remain retired after the consumer audit.

Shrink the exact SDK export cap from 4447 to 4446 and the callable cap from 2631 to 2629, matching canonical source counts. No new entrypoint or budget increase. Proof: 406 focused and SDK contract tests pass; staged Codex review is clean through P2. Proof commands: pnpm plugin-sdk:check-exports; pnpm plugin-sdk:surface:check; pnpm build. Changed checks reached only the permitted nested-worktree extension declaration boundary. Runtime proof is unchanged by the documentation-only rebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: policy maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant