Repository navigation
fix(agents): preserve tool authority through hook rebuilds - #159532
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: needs maintainer review before merge. Reviewed September 27, 2026, 5:12 AM ET / 09:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch preserves caller, cancellation, activity, and run-lifetime wrappers when agent tool hooks are rebuilt, and adds regression tests and Code Mode maintainer guidance. Merge readiness✅ Ready for maintainer review Keep open. Current main and the latest release still lack the wrapper replay needed for this reported path. The branch is a focused fix with regression coverage through catalog dispatch and the Gateway environment handler; this review found no actionable patch defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw assembles agent tools, wraps them with hooks and run authority, and exposes them directly or through Tool Search. The Gateway uses the resulting caller authority to decide whether an environment can be created and shown beside a conversation. flowchart LR
A[Agent run] --> B[Tool assembly]
B --> C[Hook rebuild]
C --> D[Tool Search call]
D --> E{Caller and run authorized?}
E -- Yes --> F[Environment and UI command]
E -- No --> G[Denied result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +67, Tests +317, Docs +6. Total +390 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one metadata-owned wrapper chain so direct, catalog, and plugin-view calls retain their admitted caller and reject revoked work before effects or result delivery. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main rebuilds a hook around the source execute function without replaying outer wrappers, and the submitted catalog regression targets the resulting missing-authority error. This read-only review did not execute the tests or a live Gateway. Is this the best way to solve the issue? Yes. Recording and replaying the existing wrappers at their metadata owner repairs the lost authority path while the Gateway keeps its final authorization checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1ea49e6030aa. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Fixes Crabbox create-and-show requests failing with
Environment screen has no matching captured tool authoritybefore a machine is provisioned.User Impact
Agents can open an authorized Crabbox portal or desktop beside the conversation. Captured permission denials, cancellation, and live-run authority remain enforced throughout the call.
Why This Change Was Made
Rebuilding
before_tool_callhooks restored the original tool body and dropped the surrounding caller and lifetime wrappers. Preserve those wrappers in their original order through the existing metadata owner, and retain the final source-execution guard through catalog rebuilding and plugin views. This also prevents effects or result delivery after the admitted run ends during preparation or finalization.Evidence
OPENCLAW_E2E_SKIP_BUILD=1route after default setup refused to rebuild artifacts associated with an active local Gateway.node scripts/check-changed.mjsandgit diff --checkpass, including core/test typechecks, lint, import-cycle and dead-export checks.pnpm test <file> --maxWorkers=1: metadata regression file 99.44 s wall including cold shared worker compilation (under 0.1 s test execution); host delegation file 31.65 s wall (about 8.2 s test execution). The latter uses the real environment and UI-dispatch owners with isolated SQLite state to cover the composition the previous helper tests missed. Exact-head CI passed in 837 s overall (including all selected jobs).