Repository navigation
fix(gateway): reload edited hook transforms - #107875
Conversation
89417d3 to
17f6c6b
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 9:27 PM ET / July 28, 2026, 01:27 UTC. ClawSweeper reviewWhat this changesThe branch clears cached gateway hook-transform functions after an accepted hooks reload and cache-busts the next module import so edited transform files affect later webhook deliveries without a gateway restart. Merge readinessKeep this PR open for normal maintainer review. The branch contains a focused fix with real filesystem-based proof and targeted coverage, but it remains behind Priority: P2 Review scores
Verification
How this fits togetherGateway webhook handling resolves configured hook mappings, then invokes optional transform modules before producing an agent action. This change sits between accepted configuration reloads and later webhook deliveries, where it determines whether a transform module is reused or freshly loaded. flowchart LR
Config[Edited hook configuration or transform file] --> Reload[Gateway reload preparation]
Reload --> Validate[Resolve and validate hook mappings]
Validate --> Commit[Accept new gateway state]
Commit --> Cache[Advance transform cache generation]
Webhook[Incoming webhook] --> Mapping[Match hook mapping]
Mapping --> Import[Load transform for current generation]
Import --> Action[Create agent action]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +27, Tests +332. Total +359 across 6 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase onto current Do we have a high-confidence way to reproduce the issue? No high-confidence independent current-main reproduction was run in this read-only review. The PR supplies a concrete filesystem edit-and-reload path and targeted tests, so the affected behavior is source-reproducible with medium confidence. Is this the best way to solve the issue? Yes, conditionally. Clearing the cache only after a hooks configuration has been accepted, coupled with generation-scoped imports and stale-load protection, is a narrow solution that avoids invalidating the active configuration on a rejected reload. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ae4a8fb8e24. LabelsLabel 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 (14 earlier review cycles; latest 8 shown)
|
17f6c6b to
26c0861
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
26c0861 to
42d95cd
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
42d95cd to
837d9ea
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
837d9ea to
c71d772
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
6fa15d5 to
bb6e5f5
Compare
bb6e5f5 to
601c81a
Compare
7d48e7c to
0d842ee
Compare
d7e3a63 to
076fff2
Compare
a710bfd to
4f4fd60
Compare
4f4fd60 to
fade61a
Compare
|
Merged via squash.
|
* origin/main: fix(zalo): stop provider startup after gateway shutdown (#115763) fix(agents): bound completed background process retention (#115760) fix(plugins): bound hook execution and retire stale registrations (#115695) fix(ui): collapse custodian startup error gap (#115720) fix(gateway): reload edited hook transforms (#107875) refactor: centralize channel streaming config hints (#115739) fix(msteams): finalize sent replies after dispatch (#82354) fix(cron): deliver explicitly configured failure alerts (#115762) fix(hooks): resolve inbound claim conversation once (#115491) refactor: retire legacy provider and secret paths (#115655) fix(memory): reject malformed QMD result entries (#115705) fix(diagnostics): keep internal thinking out of telemetry [AI] (#115261) fix(ui): localize remaining control surfaces (#115730) fix(gateway): prevent model owner mismatch after plugin activation (#115747) fix(agents): run reply hooks for restart recovery (#115711) fix(cron): initialize detached hook run sessions (#115765) fix(ios): keep stop available for staged voice notes (#115744) fix(doctor): preserve config includes during cleanup (#115723) fix(memory): keep dreaming consolidation within project scope (#115721) fix(discord): keep tool rows under verbose progress (#111947) # Conflicts: # ui/src/pages/custodian/custodian-surface.ts # ui/src/styles/custodian.css
…ft-ingestion * origin/main: fix(feishu): reject unsupported initial document content (#115697) feat(media): probe duration and dimensions for playback metadata (#115728) fix(sandbox): scope runtimes by workspace (#115766) fix(ui): guide users through missing or broken AI setup (#115716) fix(sessions): return direct-agent replies to their active session (#115756) fix(zalo): stop provider startup after gateway shutdown (#115763) fix(agents): bound completed background process retention (#115760) fix(plugins): bound hook execution and retire stale registrations (#115695) fix(ui): collapse custodian startup error gap (#115720) fix(gateway): reload edited hook transforms (#107875) refactor: centralize channel streaming config hints (#115739)
* fix(gateway): reload edited hook transforms * test(gateway): use auto cleanup temp dirs for hook reload tests
…ft-ingestion * origin/main: fix(feishu): reject unsupported initial document content (openclaw#115697) feat(media): probe duration and dimensions for playback metadata (openclaw#115728) fix(sandbox): scope runtimes by workspace (openclaw#115766) fix(ui): guide users through missing or broken AI setup (openclaw#115716) fix(sessions): return direct-agent replies to their active session (openclaw#115756) fix(zalo): stop provider startup after gateway shutdown (openclaw#115763) fix(agents): bound completed background process retention (openclaw#115760) fix(plugins): bound hook execution and retire stale registrations (openclaw#115695) fix(ui): collapse custodian startup error gap (openclaw#115720) fix(gateway): reload edited hook transforms (openclaw#107875) refactor: centralize channel streaming config hints (openclaw#115739)
What Problem This Solves
Fixes an issue where editing a configured hook transform could leave the gateway running the old transform function after hooks hot reload rebuilt the mapping config.
Why This Change Was Made
Hook mapping resolution now drops the process-local transform function cache when hooks config is resolved, and transform cache misses import with one cache-bust token for the current reload generation so Node does not reuse the previous module instance.
User Impact
Operators can update hook transform files and have subsequent matching webhook deliveries use the edited transform without restarting the gateway.
Evidence
Exact head:
fade61a1a9a7fb5d3a8378fa0ddc82a72140c2eepnpm exec tsx proof-live.tsnode scripts/run-vitest.mjs src/gateway/hooks-mapping.test.ts src/gateway/server-reload-handlers.test.ts: 137 passedproof-live.ts
AI-assisted: built with Codex