Skip to content

Bug: lossless-claw context engine fails with "Engine initialization is disabled during read-only plugin registration" on v2026.6.10 #96335

Closed

Description

@rrriiiccckkk

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

  1. Defer context engine factory calls to the writable registration phase: Ensure that plugins.slots.contextEngine resolution only happens after all plugins have completed their writable registration, not during the read-only phase.

  2. 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.

  3. 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.

  4. Add a lifecycle hook for post-registration context engine activation: Provide a afterAllPluginsRegistered hook 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

These are different root causes but share the same symptom pattern: plugin loads successfully but context engine slot doesn't activate.

Activity

  1. clawsweeper commented on Jun 24, 2026

    @clawsweeper
    Contributor

    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

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    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-claw after 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 legacy would 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:

    • I did not run a live OpenClaw v2026.6.10 plus lossless-claw 0.13.1 gateway reproduction in this read-only review.
    • The safest repair shape may need coordination with the external lossless-claw package contract, although the OpenClaw source path is clear enough to keep the issue open.

    Codex review notes: model internal, reasoning high; reviewed against a2725b6a24c8.

    Label changes

    Label changes:

    • add P1: A shipped release appears to disable the configured context engine and downgrade context assembly/compaction for affected users.
    • add impact:session-state: The affected behavior is context assembly and compaction state, where the selected context engine is replaced by legacy behavior.
    • add issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.
    • add 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:

    • node scripts/run-vitest.mjs src/context-engine/context-engine.test.ts src/plugins/loader.test.ts
    • Run any new focused fixture test that proves read-only discovery does not quarantine a stateful context-engine factory and full runtime activation resolves the configured plugin engine.
    • git diff --check

    What I checked:

    • Current resolver invokes and quarantines factory failures: Current main resolves the configured 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)
    • Read-only plugin modes still expose capability handlers: The plugin registry marks discovery and tool-discovery as capability-handler modes, which includes the registerContextEngine handler path used by native plugins. (src/plugins/registry.ts:382, a2725b6a24c8)
    • Plugin registration modes define discovery as read-only capability discovery: OpenClaw exposes discovery as read-only capability discovery and tool-discovery as tool capability discovery, matching the mode names lossless-claw treats as read-only. (src/plugins/types.ts:2389, a2725b6a24c8)
    • Configured context-engine slot is documented behavior: The configuration reference documents plugins.slots.contextEngine as 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)
    • lossless-claw 0.13.1 rejects read-only initialization: The upstream package source treats cli-metadata, discovery, and tool-discovery as 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)
    • Latest release and current main checked: The reported release tag is v2026.6.10 at aa69b12d0086b631b139c1435c9621a5783e3a40; current main is a2725b6a24c85f921f813b8255fbc3c0eae8188f and still contains the resolver behavior above. (a2725b6a24c8)

    Likely related people:

    • ragesaq: Authored the merged context-engine runtime-settings PR that recently changed context-engine lifecycle surfaces and tests. (role: recent context-engine contributor; confidence: medium; commits: f94a2506d218; files: src/context-engine/registry.ts, src/context-engine/types.ts, src/agents/embedded-agent-runner/run.ts)
    • jalehman: Merged/reviewed recent context-engine runtime-settings work and authored plugin/context-engine quarantine health reporting that touches this diagnostic path. (role: reviewer, merger, and adjacent area contributor; confidence: high; commits: f94a2506d218, 10a4c7c10b6a; files: src/context-engine/registry.ts, src/context-engine/quarantine-health.ts, src/status/status-plugin-health.ts)
    • vincentkoc: Recent history includes context-engine quarantine fixes and plugin-loader planning changes adjacent to this registration lifecycle surface. (role: recent context-engine and plugin-loader contributor; confidence: medium; commits: 14ce8733fe71, 417b6e72c473, de1d329e3167; files: src/context-engine/registry.ts, src/plugins/loader.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    on Jun 24, 2026
  3. snowzlmbot commented on Jun 24, 2026

    @snowzlmbot
    Contributor

    The public npm registry doesn't have lossless-claw@0.13.1 available? Can you provide the download link

  4. locked as resolved and limited conversation to collaborators on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions