Repository navigation
docs: document the after_tool_call event payload on the tool policy page - #149377
Conversation
The tool policy page documents every before_tool_call event field and the full BeforeToolCallResult type, but never mentions after_tool_call, so its payload is not published anywhere in docs/plugins. The hook catalog in the hook reference carries one descriptive row and no fields. Adds a Tool call observation section with the event shape declared in src/plugins/hook-types.ts, the observation execution contract, and a note that result and error are both optional, so an event carrying neither is not evidence of success. Documents the declared type rather than the observed payload: what result carries for exec and bash-family tools is open in openclaw#102961 and is left to that issue. Closes openclaw#149376
|
🦞👀 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 October 6, 2026, 10:09 PM ET / October 7, 2026, 02:09 UTC (Revision 4). ClawSweeper reviewWhat this changesDocuments the after_tool_call observation hook’s event fields, optional outcomes, context availability, and execution rules on the tool policy page. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still lacks the payload documentation, and the added wording accurately describes the existing contract without deciding the separate runtime-payload question. No blocking defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s plugin hooks let plugins gate tool execution and observe completed calls. Harnesses supply completion events to the hook runner, which dispatches them to registered plugin handlers. flowchart LR
A[Tool arguments] --> B[Before-call policy]
B --> C[Tool execution]
C --> D[Harness completion event]
D --> E[Observation hook runner]
E --> F[Plugin outcome records]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceDocs +46. Total +46 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the observation contract beside tool policy guidance while leaving runtime result-format changes to the separately tracked work. Do we have a high-confidence way to reproduce the issue? Not applicable to a runtime defect; direct inspection confirms that current main’s tool policy page lacks this payload section. Is this the best way to solve the issue? Yes. Documenting the existing type and observation rules on the existing policy page is a focused solution that avoids promising a particular harness result format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 07e9a2519420. 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 (3 earlier review cycles) |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 2ba33cb. Thanks @arpanghoshal! We verified every field against |
…age (openclaw#149377) Document the after_tool_call event fields, their types and semantics, and the hook context, as emitted by the embedded runner and harness hook helpers. Fixes openclaw#149376. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #149376
What Problem This Solves
The tool policy page tells plugin authors how to gate a tool call but never documents
after_tool_call, so the payload a plugin receives when that call finishes is not published anywhere indocs/plugins.User Impact
Plugin developers writing tool policy can read the
after_tool_callevent fields on the same page asbefore_tool_call, and are told thatresultanderrorare both optional, so a handler does not infer success from an absenterror. No behavior change.Why This Change Was Made
docs/plugins/hooks/tool-policy.mdlists everybefore_tool_callfield and the fullBeforeToolCallResulttype.after_tool_callis the other half of that pair for any plugin that records what a gated call did, and its only published description is one row in the hook catalog:An author who pairs the two hooks has to open
src/plugins/hook-types.tsto find the field names. Guessing them fails quietly: a handler that tests the wrong property records every call as successful.The new section documents the type as declared, the observation execution contract already stated in the hook reference, and the optionality of
resultanderror. It deliberately does not describe whatresultcarries at runtime for exec and bash-family tools, because that is open in #102961 withneeds-product-decision; it links there instead, so this page does not have to change again when that lands.Evidence
Verified against
mainat1349c4c:src/plugins/hook-types.tsL754-L762before_tool_callreceives,PluginHookToolContext:src/plugins/hook-types.tsL1302-L1305after_tool_calloccurs indocs/plugins/**only inhooks/reference.md(2 table rows),codex-harness-runtime/hooks.md,codex-harness-runtime/v1-support-contract.mdandcopilot.md, and in none of them as an event-field list. It does not occur inhooks/tool-policy.mdat all.Docs-only change: one new
### Tool call observationsection and one addedread_whenline. No code, no config, no tests affected.Maintainer verification: No overlap with Pash/Sarah changes.
Verified all event fields against current main
src/plugins/hook-types.ts:585-593and emitterssrc/agents/embedded-agent-subscribe.handlers.tools.completion.ts:640-658andsrc/agents/harness/hook-helpers.ts:26-57. Clarified context type versus available fields and optional-error wording. Scoped Oxfmt and MDX checks passed; standard link audit checked 13,788 links with zero broken. Optional whole-tree anchor audit found 54 pre-existing broken anchors outside this page. Stale-base merge-tree is clean; main changes in the page concern unrelated policy examples.git diff --checkpassed.