Skip to content

fix(plugins): include selected context-engine slot plugin in gateway startup (#76576)#76636

Merged
steipete merged 3 commits into
openclaw:mainfrom
hclsys:fix/76576-context-engine-plugin-gateway-startup
May 3, 2026
Merged

fix(plugins): include selected context-engine slot plugin in gateway startup (#76576)#76636
steipete merged 3 commits into
openclaw:mainfrom
hclsys:fix/76576-context-engine-plugin-gateway-startup

Conversation

@hclsys

@hclsys hclsys commented May 3, 2026

Copy link
Copy Markdown

Root cause

resolveGatewayStartupPluginPlanFromRegistry builds the startup plugin set by filtering installed plugins. For memory plugins it uses shouldConsiderForGatewayStartup which checks activation.onStartup or kind: "memory". External context-engine plugins (e.g. lossless-claw@0.9.2) have kind: "context-engine" but no activation.onStartup in their manifest — they register via api.registerContextEngine() at load time. The planner skipped them, so the selected engine was never loaded before agent turns resolved the active engine, producing:

[context-engine] Context engine "lossless-claw" is not registered; falling back to default engine "legacy".

Fix

Add resolveContextEngineSlotStartupPluginId mirroring the existing resolveMemorySlotStartupPluginId pattern. Pass contextEngineSlotStartupPluginId into shouldConsiderForGatewayStartup so any plugin matching plugins.slots.contextEngine is included in the gateway startup load plan regardless of its manifest activation shape.

Audit:

  • A: resolveMemorySlotStartupPluginId is the existing helper — mirrored, not reused (different semantics: context engine has no built-in default override, no dreaming sub-case)
  • B: shouldConsiderForGatewayStartup has one non-test caller — change is purely additive, no contract change
  • C: No rival PR found

Tests

4 new cases in channel-plugin-ids.test.ts:

82/82 tests pass (src/plugins/channel-plugin-ids.test.ts src/plugins/effective-plugin-ids.test.ts src/agents/runtime-plugins.test.ts).

Fixes #76576. Thanks @hclsys.

@clawsweeper

clawsweeper Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR adds selected context-engine slot plugins to the gateway startup plan, changes optional plugin-tool cold-load behavior, and adds tests plus changelog entries for #76576 and #76598.

Reproducibility: yes. from source inspection. Current main omits selected non-startup context-engine plugins from startup plugin ids, and the PR's #76598 path can still return a loaded-empty registry without reloading tool entries.

Next step before merge
A narrow automated repair can update the PR branch to reload loaded-empty tool registries or remove the #76598 change while preserving the valid #76576 fix.

Security
Cleared: No concrete security or supply-chain regression found in this diff.

Review findings

  • [P2] Reload loaded-empty tool registries — src/plugins/tools.ts:811
Review details

Best possible solution:

Land the #76576 startup-plan fix with its regression tests, and either correctly repair #76598 in the same branch or split/remove the tool fallback and changelog claim.

Do we have a high-confidence way to reproduce the issue?

Yes, from source inspection. Current main omits selected non-startup context-engine plugins from startup plugin ids, and the PR's #76598 path can still return a loaded-empty registry without reloading tool entries.

Is this the best way to solve the issue?

No as submitted. The context-engine startup seam is the narrow maintainable fix for #76576, but the bundled #76598 change must reload loaded-empty registries or be removed from this PR.

Full review comments:

Overall correctness: patch is incorrect
Overall confidence: 0.86

Acceptance criteria:

  • pnpm test src/plugins/tools.optional.test.ts src/plugins/channel-plugin-ids.test.ts src/plugins/effective-plugin-ids.test.ts src/agents/runtime-plugins.test.ts
  • pnpm check:changed in Testbox before handoff

What I checked:

Likely related people:

  • @steipete: Recent current-main work changed src/plugins/tools.ts, the same tool-registry resolution surface affected by the [Bug]: Path-based plugin tools (origin "config") not exposed after 2026.5.2 #76598 part of this PR; the timeline also shows maintainer force-pushes to this branch. (role: recent maintainer; confidence: high; commits: 5e9135f2e23d; files: src/plugins/tools.ts, src/plugins/tools.optional.test.ts)
  • @amknight: Recent current-main startup-planning work touched gateway-startup-plugin-ids.ts, the file where the context-engine startup selection belongs. (role: adjacent owner; confidence: medium; commits: 8142e67d633d, 1e4098134aa8; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/tools.ts)
  • @vincentkoc: The startup snapshot/runtime-plugin loading layer and standalone/active registry helper files in current main trace to the cron startup-state repair commit. (role: introduced behavior; confidence: medium; commits: 310b1987e143; files: src/agents/runtime-plugins.ts, src/plugins/runtime/standalone-runtime-registry-loader.ts, src/plugins/active-runtime-registry.ts)
  • @jalehman: Git history points to the original custom context-engine plugin support and later context-engine prompt-cache maintenance, adjacent to the selected-engine behavior fixed here. (role: feature origin; confidence: medium; commits: fee91fefceb4, a327b6750dbe; files: src/context-engine/registry.ts, docs/concepts/context-engine.md, docs/plugins/manifest.md)

Remaining risk / open question:

Codex review notes: model gpt-5.5, reasoning high; reviewed against 2b82c05a7fb1.

@steipete steipete force-pushed the fix/76576-context-engine-plugin-gateway-startup branch from 326c63f to 8509f81 Compare May 3, 2026 12:02
@steipete steipete force-pushed the fix/76576-context-engine-plugin-gateway-startup branch 2 times, most recently from 9d8a902 to 4d2e5af Compare May 3, 2026 12:13
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label May 3, 2026
HCL and others added 3 commits May 3, 2026 13:17
…penclaw#76598)

`resolvePluginTools` returned an empty tool list when no pre-warmed
channel/active registry was found after startup — the on-demand fallback
removed by PR openclaw#76004 was only added back for memory and capability-provider
surfaces, leaving path-based (origin "config") plugin tool factories silent.

Fix: when `resolvePluginToolRegistry` returns null, trigger a standalone
registry load via `ensureStandaloneRuntimePluginRegistryLoaded`, then retry.
Adds regression test asserting tools are resolved without pre-warming.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…startup (openclaw#76576)

External context-engine plugins (e.g. lossless-claw) register via
api.registerContextEngine at load time but ship without
activation.onStartup in their manifest. The gateway startup planner
only considered memory plugins and explicit sidecar plugins, so a
selected non-legacy context engine was omitted from the startup load
plan and never loaded before agent turns resolved the active engine,
producing the "Context engine X is not registered; falling back to
default engine legacy" warning.

Fix: add resolveContextEngineSlotStartupPluginId mirroring the memory
slot pattern; pass contextEngineSlotStartupPluginId into
shouldConsiderForGatewayStartup so the selected context-engine plugin
is included in pluginIds regardless of its manifest activation shape.

Tests: added four regression cases covering include, exclude, legacy
bypass, and id normalization. 82 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@steipete steipete force-pushed the fix/76576-context-engine-plugin-gateway-startup branch from 4d2e5af to 0db6c28 Compare May 3, 2026 12:18
@openclaw-barnacle openclaw-barnacle Bot removed the cli CLI command changes label May 3, 2026
@steipete steipete merged commit deb7b82 into openclaw:main May 3, 2026
102 checks passed
@steipete

steipete commented May 3, 2026

Copy link
Copy Markdown
Contributor

Thanks @hclsys. I rebased this onto current main, kept your commits/credit, and opened replacement PR #76669 because this source branch is not maintainer-editable and needed the current-base cleanup before landing. I am closing this PR in favor of the replacement: #76669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bug Report: Context engine plugin not registered despite being loaded

2 participants