Files
openclaw/src/plugins
Yuval Dinodia c17a81b470 fix(plugins): roll back cleared runtime registrations when an activating reload aborts (#103812)
* fix(plugins): roll back cleared runtime registrations when an activating reload aborts

loadOpenClawPlugins clears the process-global agent-harness, plugin-command,
compaction, detached-task, interactive-handler, embedding, memory-embedding,
and memory stores up front on an activating load and only re-registers them at
the end via activatePluginRegistry. The body has a finally with no catch, so a
throw during discovery or manifest load (a corrupted or half-written plugin
manifest mid-upgrade) leaves the previously active registry marked active while
its runtime stores are gone process-wide; the gateway reload driver only logs
and swallows the error.

Snapshot the process-global stores before the clear with the existing
snapshotPluginProcessGlobalState helper and restore them on any throw before
activation. clearActivatedPluginRuntimeState moves next to the snapshot and
restore helpers it pairs with in plugin-registration-transaction.ts, which
already owns atomic plugin registration state and imports from every module the
clear touches; loader.ts re-exports it so existing callers are unchanged.

* fix(plugins): make reload rollback activation-safe

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-18 18:11:16 -07:00
..