Skip to content

fix(plugins): reuse active registry during tool resolution#52262

Merged
gumadeiras merged 3 commits intoopenclaw:mainfrom
PerfectPan:feat/plugin-tools-snapshot
Apr 3, 2026
Merged

fix(plugins): reuse active registry during tool resolution#52262
gumadeiras merged 3 commits intoopenclaw:mainfrom
PerfectPan:feat/plugin-tools-snapshot

Conversation

@PerfectPan
Copy link
Copy Markdown
Contributor

@PerfectPan PerfectPan commented Mar 22, 2026

Summary

  • add resolveEffectivePluginRegistry() as the single place that decides whether to reuse the active registry or perform a fallback plugin load
    • make tool resolution and plugin-backed provider registries share that same effective-registry logic
    • reuse the active registry only after the runtime has explicitly loaded one, while preserving the existing fallback load behavior when startup has not done that yet

Why

This fixes #52250.

In the broken path, a later tool-resolution step could reload plugins under a different state/workspace context and replace the process-global active plugin registry. After that, plugin-backed channels such as feishu could become unknown in subagent flows.

The earlier activate: false, cache: false approach avoided the overwrite, but it also rebuilt a second registry and could split stateful plugin runtime/service instances. This version fixes the same bug by converging all hot paths on a single effective-registry resolver instead.

Verification

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 22, 2026

Greptile Summary

This PR fixes a process-global plugin registry corruption that could occur in subagent flows (issue #52250). By passing activate: false and cache: false to loadOpenClawPlugins inside resolvePluginTools, the tool-resolution path is now a side-effect-free "snapshot" load — it no longer calls setActivePluginRegistry, so it cannot overwrite the registry that was previously established by a real plugin activation (e.g., the one that registered the feishu channel).

  • Root cause fix (src/plugins/tools.ts): resolvePluginTools now uses activate: false, cache: false, consistent with the same pattern already used in provider-runtime.ts, contracts/registry.ts, and web-search-providers.runtime.ts.
  • Test update (src/plugins/tools.optional.test.ts): Two existing assertions are tightened to verify that both new options are forwarded to loadOpenClawPlugins.
  • The loader itself enforces at runtime that activate: false must be paired with cache: false (throws otherwise), so the two options are correctly paired here.

Confidence Score: 5/5

  • Safe to merge — minimal, well-targeted change with matching test coverage and no observable regressions.
  • The fix is a two-line addition that aligns exactly with the existing activate: false / cache: false snapshot-load pattern already present in multiple other plugin subsystems. The loader enforces this pairing at runtime, so the options cannot drift. Tests are updated to assert the new contract, and the PR description includes a reproduction fixture confirming the bug is resolved.
  • No files require special attention.

Reviews (1): Last reviewed commit: "fix(plugins): avoid activating registry ..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88d865b6e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@PerfectPan PerfectPan force-pushed the feat/plugin-tools-snapshot branch from 88d865b to b889fe1 Compare March 22, 2026 13:25
@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime agents Agent runtime and tooling size: S and removed size: XS labels Mar 22, 2026
@PerfectPan PerfectPan changed the title fix(plugins): avoid activating registry during tool resolution fix(plugins): reuse active registry during tool resolution Mar 22, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: efd04ea6ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle bot removed gateway Gateway runtime agents Agent runtime and tooling labels Mar 22, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e67aa95aed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c90e200eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Mar 26, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be43591634

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras gumadeiras self-assigned this Mar 28, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dd264f2b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle bot added size: S and removed agents Agent runtime and tooling size: L labels Apr 3, 2026
@gumadeiras gumadeiras force-pushed the feat/plugin-tools-snapshot branch 3 times, most recently from 704d27b to 476ea0d Compare April 3, 2026 20:15
@gumadeiras gumadeiras force-pushed the feat/plugin-tools-snapshot branch from a1e6efb to eea3f1a Compare April 3, 2026 21:15
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gumadeiras gumadeiras force-pushed the feat/plugin-tools-snapshot branch from eea3f1a to 55982a6 Compare April 3, 2026 21:16
@gumadeiras gumadeiras merged commit dc21e3b into openclaw:main Apr 3, 2026
7 checks passed
@gumadeiras
Copy link
Copy Markdown
Member

Merged via squash.

Thanks @PerfectPan!

KimGLee pushed a commit to KimGLee/openclaw that referenced this pull request Apr 4, 2026
…52262)

Merged via squash.

Prepared head SHA: 55982a6
Co-authored-by: PerfectPan <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
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]: Plugin-backed channels can become unknown in subagent flows when OPENCLAW_STATE_DIR is relative

2 participants