Repository navigation
feat(audit): record generic tool action decisions - #130358
Conversation
|
@clawsweeper review |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:27 PM ET / 23:27 UTC. ClawSweeper reviewWhat this changesAdds private, bounded audit receipts for generic filesystem, process, memory, and OpenClaw tool actions while retaining owner-native plugin-hook and approval receipts. Merge readinessKeep open for protected maintainer review. Available source shows the prior matcher-scope concern is addressed, but the PR explicitly relies on a Codex dynamic-tool contract that could not be directly inspected because the required sibling checkout is absent and network resolution is unavailable. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherAgent tools are assembled with identity-backed metadata, then pass through the before-tool-call policy wrapper before execution. The wrapper either preserves an owner-native decision receipt or writes a generic bounded receipt to the lifecycle-owned audit writer. flowchart LR
A[Assembled agent tools] --> B[Action descriptor binding]
B --> C[Before-tool-call wrapper]
C --> D{Owner-native hook or approval receipt?}
D -->|yes| E[Owner-native decision receipt]
D -->|no| F[Generic bounded audit receipt]
E --> G[Execution audit writer]
F --> G
Decision needed
Why: The PR explicitly bases scope and proof on that external runtime contract, but the required sibling source was unavailable to this review. Before merge
Agent review detailsSecurityNone. PR surfaceSource +165, Tests +523, Other 0. Total +688 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the closed descriptor and canonical audit-writer path, then verify the claimed Codex dynamic-tool boundary from source and land only after exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Yes for the local behavior: the new test describes the matched-void and matcher-miss execution paths, though this read-only review did not execute the branch. Is this the best way to solve the issue? Unclear: the OpenClaw owner boundary is coherent in available source, but the PR's Codex-dependent scope claim still needs direct contract verification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b17930af5432. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
* feat(audit): record generic tool action decisions * fix(audit): bind OpenClaw action descriptors * fix(audit): keep decision routing private * fix(audit): avoid duplicate void-hook decisions * fix(audit): scope plugin hook ownership * docs(agents): preserve decision audit FIFO ownership
Summary
kindmetadata; generic plugin tools remaintool/openclawArchitecture
The closed private action descriptor carries only
familyand broadoperationthrough the existing identity-backed tool metadata path. The wrapper records through the existingrecordExecutionDecisionWorksink, which shares the canonicalAuditEventWriterFIFO in Gateway and direct-local modes. Receipt authority is revalidated immediately before each enqueue after asynchronous policy, approval, and preparation work.Ordinary execution is attribution-only. Only an exact trusted generic policy veto is
enforced. Execution errors remain lifecycle-owned, pre-launch disposal records suppression, missing/stale authority emits no fact, and plugin-hook/approval owners remain authoritative.Browser plugins remain generic
tool/openclaw: the current generic manifest/registry contract has no canonical browser capability kind. This PR does not invent a public SDK or manifest surface.Proof
before_tool_callhook that emits exactly one owner-native allow receipt and zero generic decision work, plus a matcher-miss case that emits zero owner receipts and one generic attributioncreateOpenClawTools({ wrapBeforeToolCallHook: false })Gateway-shaped path (zero decision work before the fix). Binding descriptors once at the final OpenClaw assembly boundary makes the same path emit one boundedtool/openclawattribution receipt; OpenClaw registration 60/60, Gateway resolution 32/32, and skill-runtime dispatch 5/5 remain green.genericDecisionwidenedHookOutcome. The unchanged test is the fail-before (1/23 failed); both generic veto producers now use the canonical non-enumerable private-marker owner shared withownerDecision, and embedded-mode plus decision tests pass 38/38.node scripts/check-changed.mjs --staged: greennode scripts/check-changed.mjs: greenb83f4b9found a valid P1: a void hook already emittedplugin_hook_allowed, but the undefined aggregate result omitted the private owner marker and allowed a duplicate generic attribution. Fail-before was 1/16 at the exact zero-generic-work assertion; the repair preserved non-enumerability and owner-native routing for handlers returning void. Pass-after: decision 16/16, embedded-mode 23/23, plugin-hook owner 29/29.9beee70efound a valid matcher-scope P1: global hook registration suppressed generic attribution even when anexec-only hook did not match adata/readtool and emitted no owner receipt. Fail-before was 1/17 at the exact one-generic-work assertion. The hook owner now invokesreceipt.markOwnerDecisiononly fromonHandlerResult/onHandlerError; the policy closure suppresses generic attribution only when marked or when final approval exists, without duplicating matcher logic. Pass-after: decision + embedded-mode + plugin-hook owner 69/69; proportionalcheck-changedgreen.tbx_01m0zn9jctv1tvrtgsw52rkncp, Actions run 32999895022;check:changed, all builds, C02 14/14, approval/plugin ownership, Gateway/CLI siblings, and browser privacy 10/10 passed. The broad sweep then exited nonzero from unrelated worker OOM/exits, timing-sensitive UI/doctor failures, stale Codex fixtures, and a missingdist/control-uiartifact; none intersects the 11 changed C02 paths.01a04059-bf6b-7651-af35-3f9d59cd0055Test audit
The new table-driven tests own behavior rather than implementation shape: the void-return row proves an owner-native allow remains singular even when the aggregate hook result is undefined; the matcher-miss row proves an unrelated registered hook cannot suppress generic attribution; arbitrary tool names and plugin IDs prove metadata ownership; allow/deny/failure/suppression/missing/stale authority exercise distinct boundaries; owner-native hook and approval receipts prove nonduplication; privacy assertions reject raw inputs/results/paths/prose. The Gateway-shaped regression uses the production final assembly path, credibly failed at its receipt assertion before the owner fix, and adds no test-only production seam or duplicate Gateway/UI mapping test.
LOC / best fix
Positive production growth is the private capability/ownership boundary: a closed descriptor and its identity-preserving copy path, fixed decision composition at the recorder owner, assembly bindings for filesystem/process, process-stable manifest-kind carriage for memory, and nonduplication markers at the policy owner. Repeated wrapper metadata copies were consolidated into one narrow helper. No schema, protocol, config, SDK, or public display surface changed.
Alternatives were rejected: tool-name/argument inference is unstable and private-data-prone; hardcoded plugin IDs violate plugin-agnostic core architecture; widening the public plugin contract solely for browser classification exceeds C02; the runtime-action owner does not provide the required post-await authority-adjacent enqueue on this wrapper path.
Dependency contract
Direct Codex inspection confirmed dynamic tool calls route by name through the runtime registry and handler, then execute through the same dispatcher/parallel machinery; unsupported wholly Codex-native actions therefore produce no inferred OpenClaw fact. Checked
codex-rs/core/src/tools/registry.rs,handlers/dynamic.rs,router.rs, andparallel.rsat sibling headf1087ff151b06e781ecb086068d45fcc62d02da3.