Repository navigation
Description
Bug: lossless-claw context engine fails with "Engine initialization is disabled during read-only plugin registration" on v2026.6.10
Environment
- OpenClaw: 2026.6.10 (aa69b12)
- lossless-claw: 0.13.1
- OS: macOS (arm64)
- Node: v25.8.0
Description
After upgrading to OpenClaw 2026.6.10, the lossless-claw context engine fails to initialize during the read-only plugin registration phase. The plugin itself loads successfully, but the context engine slot falls back to the built-in legacy engine.
This appears to be a regression introduced by a new plugin registration lifecycle in v2026.6.10 where context engine factories are called during a read-only phase that rejects initialization.
Observed behavior
At boot, the gateway logs show the plugin loading successfully:
[plugins] lossless-claw: Plugin loaded (enabled=true, db=~/.openclaw/lcm.db, threshold=0.75)
[plugins] lossless-claw: Engine initialized for db=~/.openclaw/lcm.db duration=300ms
Then immediately after, the context engine factory fails:
[context-engine] Context engine "lossless-claw" owner=plugin:lossless-claw failed during factory: [lcm] Engine initialization is disabled during read-only plugin registration; quarantining it for this process and falling back to default engine "legacy".
The plugin continues to function for data collection (afterTurn maintenance, LCM grep/recall tools all work), but the context engine slot uses legacy instead of lossless-claw, meaning context assembly and compaction use the built-in sliding-window engine rather than DAG-based summarization.
Expected behavior
The lossless-claw context engine should be registered and activated as the active context engine, as it was on v2026.6.9 and earlier.
Impact
- Context assembly uses legacy sliding-window compaction instead of lossless DAG summarization
- LCM data collection and recall tools still work (lcm_grep, lcm_expand_query, afterTurn maintenance)
- The core lossless compaction feature is effectively disabled
Root cause hypothesis
v2026.6.10 appears to introduce a "read-only plugin registration" phase (possibly related to #94545 "trusted policies survive hook composition" or the plugin registry refresh in #95792). During this phase, context engine factories are called but initialization is blocked. The engine factory receives a signal that it's in a read-only registration context and fails with the error above.
The plugin's registerContextEngine() call succeeds during the normal writable registration, but the context engine slot resolution happens against the read-only registry, which doesn't have the registered engine.
Suggested fixes
-
Defer context engine factory calls to the writable registration phase: Ensure that
plugins.slots.contextEngineresolution only happens after all plugins have completed their writable registration, not during the read-only phase. -
Skip context engine quarantine on read-only phase: Instead of quarantining the engine and falling back to legacy, defer the factory call to the next writable registration opportunity or to post-registration bootstrap.
-
Allow context engines to register during read-only phase: If the read-only phase is meant for metadata collection only, context engine factories should be allowed to register (but not initialize stateful resources) during this phase, with actual initialization deferred to the writable phase.
-
Add a lifecycle hook for post-registration context engine activation: Provide a
afterAllPluginsRegisteredhook that context engine plugins can use to finalize their initialization after all plugins have been registered.
Workaround
None currently. Setting plugins.slots.contextEngine to "legacy" avoids the error but loses lossless functionality.
Related issues
- Plugin context engines can resolve before plugin registration (Lossless Claw / contextEngine slot) #40232: Plugin context engines can resolve before plugin registration (2026.3.7)
- Published 2026.3.7 build splits context-engine registry across bundle chunks #40096: Context-engine registry splits across bundle chunks (2026.3.7)
- OpenClaw v2026.4.14 causes repeated context engine errors and breaks usability #66601: v2026.4.14 causes repeated context engine errors (info.id mismatch)
These are different root causes but share the same symptom pattern: plugin loads successfully but context engine slot doesn't activate.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 24, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 24, 2026, 4:37 AM ET / 08:37 UTC.
Summary
This issue should stay open: current main still registers read-only discovery context-engine factories and immediately invokes the selected factory during resolution, while the latest lossless-claw package intentionally rejects engine initialization in read-only registration. I found no merged/current-main fix or canonical newer issue that covers this v2026.6.10 regression.
Reproducibility: no. live high-confidence reproduction was run in this read-only review. Source inspection is reproducible: OpenClaw invokes the selected factory during context-engine resolution, and lossless-claw 0.13.1 throws the reported error when that factory runs in read-only registration.
Ways to help us reproduce this
Next step
A focused repair PR is plausible because the bug boundary is the interaction between read-only plugin registration and context-engine factory resolution, with clear source and package evidence.
Review details
Best possible solution:
Keep this as the active bug and fix OpenClaw so read-only discovery can collect context-engine registrations without constructing stateful plugin engines, while full gateway/agent runtime resolution still selects
lossless-clawafter normal plugin activation.Do we have a high-confidence way to reproduce the issue?
No live high-confidence reproduction was run in this read-only review. Source inspection is reproducible: OpenClaw invokes the selected factory during context-engine resolution, and lossless-claw 0.13.1 throws the reported error when that factory runs in read-only registration.
Is this the best way to solve the issue?
Unclear until a fix PR traces the exact startup path, but the narrow direction is to separate read-only registration from stateful context-engine factory initialization. Adding a new config option or telling users to select
legacywould not be the best fix because the existing context-engine slot contract should keep working.AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against a2725b6a24c8.
Label changes
Label changes:
P1: A shipped release appears to disable the configured context engine and downgrade context assembly/compaction for affected users.impact:session-state: The affected behavior is context assembly and compaction state, where the selected context engine is replaced by legacy behavior.issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state selects this label.Label justifications:
P1: A shipped release appears to disable the configured context engine and downgrade context assembly/compaction for affected users.impact:session-state: The affected behavior is context assembly and compaction state, where the selected context engine is replaced by legacy behavior.Evidence reviewed
Acceptance criteria:
What I checked:
plugins.slots.contextEngine, calls the registered factory, and records a factory quarantine before falling back to the default engine when a non-default factory throws. (src/context-engine/registry.ts:906, a2725b6a24c8)discoveryandtool-discoveryas capability-handler modes, which includes theregisterContextEnginehandler path used by native plugins. (src/plugins/registry.ts:382, a2725b6a24c8)discoveryas read-only capability discovery andtool-discoveryas tool capability discovery, matching the mode names lossless-claw treats as read-only. (src/plugins/types.ts:2389, a2725b6a24c8)plugins.slots.contextEngineas the way to pick the active context engine plugin id, so this is an existing behavior contract rather than a new feature request. Public docs:docs/gateway/configuration-reference.md. (docs/gateway/configuration-reference.md:363, a2725b6a24c8)cli-metadata,discovery, andtool-discoveryas read-only, registers the context engine factory, and throws the exact reported error when that factory waits for engine initialization while startup maintenance is disabled. (Martian-Engineering/lossless-claw/src/plugin/index.ts:554, 790f88b714aa)v2026.6.10ataa69b12d0086b631b139c1435c9621a5783e3a40; current main isa2725b6a24c85f921f813b8255fbc3c0eae8188fand still contains the resolver behavior above. (a2725b6a24c8)Likely related people:
src/context-engine/registry.ts,src/context-engine/types.ts,src/agents/embedded-agent-runner/run.ts)src/context-engine/registry.ts,src/context-engine/quarantine-health.ts,src/status/status-plugin-health.ts)src/context-engine/registry.ts,src/plugins/loader.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.snowzlmbot commentedon Jun 24, 2026
The public npm registry doesn't have lossless-claw@0.13.1 available? Can you provide the download link