Repository navigation
docs(hooks): clarify setup and execution contracts - #130734
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 27, 2026, 1:54 AM ET / 05:54 UTC. ClawSweeper reviewWhat this changesThe PR reorganizes documentation for internal hooks, typed plugin hooks, and HTTP webhook ingress, and updates related CLI, configuration, bundled-hook, and Codex reference pages. Merge readinessKeep this protected maintainer PR open: its hook documentation work is useful, but it regresses current Codex runtime documentation from the managed 0.150.1 release to 0.149.1. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Gateway supports internal event scripts, plugin lifecycle hooks, and inbound HTTP hooks. These docs tell operators which surface to use and how the selected surface reaches a Gateway action or agent run. flowchart LR
A[Operator or plugin author] --> B[Hooks documentation]
B --> C[Internal event scripts]
B --> D[Plugin lifecycle hooks]
B --> E[HTTP hook ingress]
C --> F[Gateway event handling]
D --> F
E --> F
F --> G[Agent run or recorded outcome]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceDocs +951. Total +951 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain the hook documentation overhaul, but restore the current 0.150.1 Codex version and picker information from main before merge. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible: current main’s package and runtime version owner declare 0.150.1, while this branch documents 0.149.1. Is this the best way to solve the issue? No—the hooks documentation direction is sound, but retaining the current 0.150.1 Codex references is necessary for an accurate, maintainable update. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42ce03e72e34. 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
|
ClawSweeper finding and rank-up resolutionThe reported Codex version downgrade is not part of this PR. It comes from comparing an older branch tip directly with newer I fetched GitHub's actual merge ref and verified:
The merge-base-to-head diff is empty for all four cited Codex guides ( Disposition: reject the downgrade finding and its derived merge-risk claim. Skip the rank-up move to restore those files because the merge already retains them. There is no source correction requiring another commit or a rebase solely for main drift. The stored-data warning is also not a schema or migration change: only Markdown prose changed, and both edited bundled The read-only review environment's inability to rerun docs commands is disclosed, not evidence of a failing check. The PR body records the completed local docs/source-loader checks and 64 passing focused tests; exact-head CI run 33043650526 is successful. Native review artifacts have also validated with no accepted actionable findings. No live mail/channel proof is claimed for this docs-only change. |
|
Land-ready for reviewed head Scope remains 18 Markdown files; production +0/-0, tests +0/-0, and bundled Completed local proof commands (full results are in the PR body): git diff --check e2e030e2b0ae59580422ef8f20bdccc149862536 b6412d780c2633638fb34f71100a522ae00834d9
node scripts/run-vitest.mjs src/hooks/configured.test.ts src/hooks/internal-hooks.test.ts src/hooks/loader.test.ts src/hooks/policy.test.ts src/hooks/hooks-status.test.ts src/hooks/workspace.test.ts
pnpm docs:list
pnpm docs:check-mdx
pnpm docs:check-links
pnpm docs:check-config-examples
pnpm docs:check-i18n-glossary
pnpm docs:check-links:anchorsThe focused suite passed 64 tests in six files. The ClawSweeper finding and rank-up resolution is independently confirmed by the actual merge-result blobs; no restoration or rebase is needed. No live Gateway, provider, email or channel execution is claimed. Proceeding through native prepare/merge with the approved head unchanged. |
|
Merged via squash.
|
Additional instructions
Keep Allow edits from maintainers enabled so maintainers can update the branch when needed.
What Problem This Solves
Operators and plugin authors could follow the hooks docs and still end up with a handler that never runs, a reply that never reaches chat, or an HTTP success mistaken for completed work. The pages mixed internal
HOOK.mdevents, typedapi.on(...)hooks, and HTTP ingress; several activation, payload, timeout, and delivery claims had drifted from their implementations.This is a maintainer-requested, source-audited documentation overhaul. No runtime behavior is changed.
Why This Change Was Made
Make each hook system understandable from its own setup and execution contract. The internal guide now provides a complete enable/restart/trigger/verify/disable flow and a working custom hook. The typed plugin reference includes a complete local-plugin example, all 42 hook names, permission gates, execution kinds, and actual merge/error/timeout semantics. The HTTP guide keeps the common workflow while the configuration reference owns exhaustive routing, mapping, replay, and fan-out contracts.
The audit covered hook discovery/loading, registries/runners, event producers, CLI/config owners, bundled handlers, HTTP dispatch and downstream admission/delivery, Gmail/IMAP, and TaskFlow webhook routes. Runtime-specific statements were checked against their adapters and relevant upstream contracts. Related pages and packaged hook documentation were aligned rather than retaining conflicting copies.
User Impact
workspace.dirsetup advice, correctsBOOT.mdworkspace deduplication, and consolidates the bundled catalog.agents.entriesreference.Public guides: Internal hooks, Plugin hooks, Webhooks, and Hooks configuration.
Evidence
HOOK.mdruntime frontmatter is byte-for-byte unchanged.node scripts/run-vitest.mjs src/hooks/configured.test.ts src/hooks/internal-hooks.test.ts src/hooks/loader.test.ts src/hooks/policy.test.ts src/hooks/hooks-status.test.ts src/hooks/workspace.test.ts— 6 files, 64 tests passed across 2 shards.HOOK.mdand JavaScript example through real source discovery/loading in isolated temporary state: enable, new/reset replies, unrelated-event non-outcome, and disable passed.node_modules/.bin/oxfmt --check --threads=1andgit diff --check— passed.pnpm docs:list— passed.pnpm docs:check-mdx— 791 files passed.pnpm docs:check-links— 6,745 internal links checked, zero broken.pnpm docs:check-config-examples— 1,208 examples validated.pnpm docs:check-i18n-glossary— passed.pnpm docs:check-links:anchors— passed after repairing the existing anchor failures.No live Gateway, mail account, model provider, or chat channel was used for the example probes. These are source-loader/contract checks, not a claim of live end-to-end email or channel proof. English source docs only; localization remains downstream.
Runtime follow-ups found during the audit remain separate: linked hook-pack root discovery, repeated foreground Gmail watcher exits, and correlated webhook delivery-failure visibility. This PR documents the current limitations instead of quietly changing their behavior.
AI-assisted documentation and source audit.