openclaw - ✅(Solved) Fix webhooks plugin register() fires 2-3 times per inbound message — unexpected plugin registry reload [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#67879Fetched 2026-04-17 08:29:08
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
commented ×1cross-referenced ×1

Root Cause

Hypothesis: Something in the inbound message handling path is triggering loadOpenClawPlugins() or a plugin-registry rebuild/cache miss, causing register(api) to re-run per message. Not caused by session resets and not related to active-memory cleanup cycle.

Fix Action

Fixed

PR fix notes

PR #67941: fix(plugins): enforce synchronous registration

Description (problem / solution / changelog)

Summary

  • enforce synchronous plugin registration in both runtime and CLI metadata loads
  • move webhooks secret resolution to request auth so registration stays synchronous

Validation

  • pnpm test src/plugins/loader.test.ts -t "rejects async register functions"
  • pnpm test src/plugins/loader.cli-metadata.test.ts -t "rejects async plugin registration when collecting CLI metadata"
  • pnpm test extensions/webhooks/src/config.test.ts extensions/webhooks/index.test.ts extensions/webhooks/src/http.test.ts
  • pnpm tsgo
  • pnpm build

Related

  • #67879
  • #67891
  • #67899
  • #67900
  • #64937
  • #65183
  • Supersedes #64640

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/active-memory/index.test.ts (modified, +30/-31)
  • extensions/comfy/comfy.live.test.ts (modified, +1/-1)
  • extensions/device-pair/index.test.ts (modified, +1/-1)
  • extensions/memory-wiki/cli-metadata.test.ts (modified, +1/-1)
  • extensions/memory-wiki/index.test.ts (modified, +1/-1)
  • extensions/openai/index.test.ts (modified, +1/-1)
  • extensions/phone-control/index.test.ts (modified, +1/-1)
  • extensions/talk-voice/index.test.ts (modified, +1/-1)
  • extensions/thread-ownership/index.test.ts (modified, +4/-4)
  • extensions/voice-call/index.test.ts (modified, +2/-2)
  • extensions/webhooks/index.test.ts (added, +66/-0)
  • extensions/webhooks/index.ts (modified, +42/-40)
  • extensions/webhooks/runtime-api.ts (modified, +1/-0)
  • extensions/webhooks/src/config.test.ts (modified, +26/-25)
  • extensions/webhooks/src/config.ts (modified, +11/-33)
  • extensions/webhooks/src/http.test.ts (modified, +87/-18)
  • extensions/webhooks/src/http.ts (modified, +30/-5)
  • src/context-engine/registry.ts (modified, +10/-0)
  • src/plugins/bundled-capability-runtime.ts (modified, +1/-1)
  • src/plugins/cli-registry-loader.ts (modified, +5/-67)
  • src/plugins/cli.test.ts (modified, +0/-52)
  • src/plugins/loader.cli-metadata.test.ts (modified, +6/-5)
  • src/plugins/loader.test.ts (modified, +122/-0)
  • src/plugins/loader.ts (modified, +170/-11)
  • src/plugins/registry.ts (modified, +49/-2)
  • src/plugins/types.ts (modified, +3/-5)
  • src/test-utils/plugin-registration.ts (modified, +4/-4)
  • test/helpers/media-generation/bundled-provider-builders.ts (modified, +1/-1)
  • test/helpers/plugins/provider-registration.ts (modified, +2/-2)
RAW_BUFFERClick to expand / collapse

Version: OpenClaw v2026.4.15 Component: extensions/webhooks

Description: The webhooks plugin register(api) function runs multiple times per inbound message, causing duplicate registered route log entries. replaceExisting: true makes this functionally idempotent but the repeated registration points to unexpected plugin registry rebuilds/reloads.

Log evidence (single inbound WhatsApp message): [webhooks] registered route ai-news on /plugins/webhooks/ai-news for session agent:main:main [webhooks] registered route ai-news on /plugins/webhooks/ai-news for session agent:main:main [webhooks] registered route ai-news on /plugins/webhooks/ai-news for session agent:main:main

Config: Single route configured: plugins.entries.webhooks.config.routes.ai-news.sessionKey: agent:main:main

Expected: register(api) runs once at gateway boot. Actual: Runs 2-3 times per inbound message.

Code pointers:

  • extensions/webhooks/index.ts:10 (register function)
  • extensions/webhooks/index.ts:27-48 (route registration loop + log)
  • extensions/webhooks/index.ts:43 (replaceExisting: true hardcoded)
  • src/plugins/runtime/runtime-taskflow.ts (bindSession confirmed as thin binder only, not session-reset listener)

Hypothesis: Something in the inbound message handling path is triggering loadOpenClawPlugins() or a plugin-registry rebuild/cache miss, causing register(api) to re-run per message. Not caused by session resets and not related to active-memory cleanup cycle.

Impact: Harmless due to replaceExisting: true but indicates unexpected plugin registry churn on every inbound message.

Setup: Docker on Windows 11, single-agent config, Telegram + WhatsApp channels.

extent analysis

TL;DR

Investigate and refactor the inbound message handling path to prevent unnecessary plugin registry rebuilds or cache misses that trigger the register(api) function multiple times.

Guidance

  • Review the code in extensions/webhooks/index.ts and src/plugins/runtime/runtime-taskflow.ts to understand how the plugin registry is loaded and rebuilt, focusing on potential triggers from inbound message handling.
  • Verify that the loadOpenClawPlugins() function or similar mechanisms are not being called unnecessarily during message processing, potentially due to cache misses or other optimization issues.
  • Consider adding logging or debugging statements around the register(api) function to better understand the call stack and identify the root cause of the repeated registrations.
  • Evaluate the impact of the replaceExisting: true setting on the plugin registry and whether it can be leveraged to mitigate the issue without fully resolving the underlying cause.

Example

No specific code example can be provided without further information on the loadOpenClawPlugins() function or the exact mechanisms of the plugin registry. However, a potential debugging approach could involve adding a unique identifier to the log messages to track the execution path:

console.log(`[webhooks] registered route ${route} on ${path} for session ${sessionKey} (call ${counter})`);

Notes

The provided information suggests that the issue is harmless due to the replaceExisting: true setting but indicates a potential performance or optimization problem. The root cause may lie in how the plugin registry is managed during inbound message processing, and resolving this could require deeper changes to the message handling or plugin loading mechanisms.

Recommendation

Apply a workaround by optimizing the plugin registry loading and rebuilding process to minimize unnecessary calls to register(api), as upgrading to a fixed version is not mentioned as an option in the provided context. This approach aims to mitigate the performance impact of the repeated registrations without fully addressing the underlying issue, which may require further investigation and changes to the core message handling or plugin management code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix webhooks plugin register() fires 2-3 times per inbound message — unexpected plugin registry reload [1 pull requests, 1 comments, 1 participants]