openclaw - 💡(How to fix) Fix Plugins initialized twice per gateway restart (duplicate register/load cycle) [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#60620Fetched 2026-04-08 02:49:04
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Code Example

09:02:29 [gateway] [lcm] Plugin loaded (enabled=true, ...)
09:02:29 [gateway] [lcm] Compaction summarization model: ...
09:02:29 [gateway] openclaw-mem0: registered (...)
09:02:32 [plugins] openclaw-mem0: registered (...)

-- 7 seconds later, full duplicate cycle --

09:02:36 [gateway] [lcm] Plugin loaded (enabled=true, ...)  # DUPLICATE
09:02:36 [gateway] [lcm] Compaction summarization model: ...  # DUPLICATE
09:02:36 [gateway] openclaw-mem0: registered (...)  # DUPLICATE
09:02:38 [plugins] openclaw-mem0: registered (...)  # DUPLICATE
RAW_BUFFERClick to expand / collapse

Bug

On gateway restart, the entire plugin stack is initialized twice, causing every plugin to run its registration logic and log output in duplicate.

Evidence

From gateway logs on a clean restart (OC 3.28, f9b1079):

09:02:29 [gateway] [lcm] Plugin loaded (enabled=true, ...)
09:02:29 [gateway] [lcm] Compaction summarization model: ...
09:02:29 [gateway] openclaw-mem0: registered (...)
09:02:32 [plugins] openclaw-mem0: registered (...)

-- 7 seconds later, full duplicate cycle --

09:02:36 [gateway] [lcm] Plugin loaded (enabled=true, ...)  # DUPLICATE
09:02:36 [gateway] [lcm] Compaction summarization model: ...  # DUPLICATE
09:02:36 [gateway] openclaw-mem0: registered (...)  # DUPLICATE
09:02:38 [plugins] openclaw-mem0: registered (...)  # DUPLICATE

Both LCM (lossless-claw) and mem0 go through the same double-init. The two cycles are logged under different subsystems (gateway then plugins), suggesting two separate plugin discovery/init passes.

Additionally, 2-3 more registered calls appear seconds after boot, likely from per-session before_agent_start hooks firing as agents reconnect.

Impact

  • Functional: Low — plugins are idempotent, no data corruption observed.
  • Operational: Noisy logs, confusing for debugging. A single restart produces 4-6 registration log lines per plugin instead of 1.
  • Potential risk: Non-idempotent plugins could break (e.g., duplicate event listeners, double resource allocation).

Expected Behavior

Each plugin should be initialized exactly once per gateway restart.

Environment

  • OpenClaw 3.28 (f9b1079)
  • macOS 26.3.1 (arm64), Node 25.8.1
  • Plugins: lossless-claw (v0.6.0), openclaw-mem0 (v1.0.3)
  • Plugin installed via plugins.entries + plugins.installs (npm)

extent analysis

TL;DR

The plugin initialization issue can be addressed by reviewing and adjusting the plugin discovery and initialization logic to ensure each plugin is initialized only once per gateway restart.

Guidance

  • Investigate the plugin discovery mechanism to identify why two separate initialization passes are occurring under different subsystems (gateway and plugins).
  • Review the before_agent_start hooks to understand why additional registered calls are being made seconds after boot and consider implementing a mechanism to prevent duplicate registrations.
  • Examine the plugins.entries and plugins.installs configurations to ensure that plugins are not being loaded or initialized multiple times.
  • Consider implementing a flag or cache to track initialized plugins and prevent duplicate initialization.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The provided information suggests that the issue is related to the plugin discovery and initialization logic, but without more details about the implementation, it is difficult to provide a precise solution. The guidance provided is intended to help the developer investigate and address the issue.

Recommendation

Apply workaround: Implement a flag or cache to track initialized plugins and prevent duplicate initialization, as the root cause of the issue is not immediately clear and may require further investigation.

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 - 💡(How to fix) Fix Plugins initialized twice per gateway restart (duplicate register/load cycle) [1 participants]