Repository navigation
fix(policy): align tool requirements with core vocabulary - #140628
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: blocked before merge. Reviewed September 7, 2026, 7:29 AM ET / 11:29 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -77, Tests +55, Docs +32, Other +2. Total +12 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
e9badb3 to
68348dd
Compare
bbdd877 to
e3ae964
Compare
1b5aa91 to
ba01401
Compare
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.
ba01401 to
9a2b60a
Compare
|
Merged via squash.
|
* 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) ...
…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.
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 omittedsecrets, and scheduler/image names had drifted from core.Why This Change Was Made
Policy now uses core group expansion and matching through one typed
toolPolicyobject on the existing publicopenclaw/plugin-sdk/agent-harness-runtimeentrypoint. Its conformance adapter uses deny-only matching so an empty coverage list remains false andwritedoes not coverapply_patch. Existing input validation removes or rejects blank requirements before expansion.One public object is offset by retiring the two unused deprecated
infra-runtimemode 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:fsincludesls,group:runtimeincludessecrets,cronresolves toautomations, and the image-understanding tool isview_image. Required deny groups must cover every current member. Config syntax and store semantics are unchanged.Evidence
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).pnpm buildpassed in 7m23.1s, including 91 plugins and public declarations (3,472,928/5,315,536 bytes).node scripts/check-changed.mjspassed five typecheck lanes, SDK/ratchet guards, three dead-export scans and core lint, then hit only the permitted nested-worktree extension-lintDeclaration input escapes checkoutlimitation.docs/plugins/sdk-runtime/config-and-utilities.md; runtime sources and SDK counts are byte-identical to the previously validated revision.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
resolveExecModeFromPolicyandresolveExecPolicyForModeexports. 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.resolveExecModePolicyfacade 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, includingopenclaw/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 140628completed successfully on unchanged9a2b60a85138b7a612e4e633b433788170145b3c; 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.