Skip to content

fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing - #108336

Merged
steipete merged 2 commits into
mainfrom
claude/codex-group5-install-doctor
Jul 15, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/codex-group5-install-doctor

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three install/doctor resilience bugs around the codex bundled→external transition:

  1. doctor --fix silently drops the plugins.allow entry for a bundled→externalized plugin (codex), unregistering the agent harness — and the gateway still reports healthy #107226 — doctor --fix silently dropped the plugins.allow entry for a bundled→externalized plugin (codex) on machines where the external package was not yet installed: the doctor stale-config scan and plugin auto-enable only accepted ids from the discovered manifest registry, so an official-but-not-installed id looked like garbage. That unregistered the agent harness while the gateway reported healthy.
  2. [Bug]: Gateway startup blocked because @openclaw/codex installation fails with "npm view produced incomplete package metadata" #107842 — npm view <spec> … --json metadata normalization only unwrapped singleton arrays and one dist shape; multi-version output, dotted vs nested dist keys, or an absent openclaw block collapsed to "npm view produced incomplete package metadata" and blocked gateway startup during @openclaw/codex install.
  3. Unknown CLI command triggers Codex register crash because runtime.state is unavailable #107219 — an unknown CLI command could crash instead of printing suggestions: the codex plugin's register() called api.runtime.state.openSyncKeyedStore eagerly, and the base (non-proxied) plugin runtime rejects state access by design (src/plugins/runtime/index.ts:334-341).

Why This Change Was Made

  • Official-catalog ids are valid pre-install config: the doctor stale-plugin scan and auto-enable now treat ids from the official external-plugin catalog as known even when not installed (installed diagnostics remain actionable), and only genuinely unknown ids are pruned. This also deletes the codex-specific shouldSuppressMissingCodexPluginDiagnostics special case from the doctor scan in favor of the generic rule — one fewer hardcoded plugin id in core.
  • Robust npm metadata: handles object and multi-version array output, selects the maximum satisfying semver (npm view arrays follow publication order — a backport published after a higher release must not win), fails closed when a recognized range has no satisfying entry (never silently resolves outside the requested constraint), accepts flat dist.* and nested dist shapes, tolerates missing openclaw blocks, and names the missing fields in the error.
  • Lazy binding store (landed with fix(codex): settle plugin activation, align plugin/list with codex 0.144, bound discovery per turn #108311 alongside its regression test, noted here for the record): plugin registration defers openSyncKeyedStore to first binding use, so control-plane loads (CLI suggestions use manifest/light metadata — verified: src/plugins/cli-registry-loader.ts, extensions/codex/cli-metadata.ts) can never crash on state access.

User Impact

  • Upgrading through the codex bundled→external transition no longer silently kills the agent harness; operators get an actionable "allowed but not installed" state instead of a vanished config entry.
  • openclaw plugins install / gateway startup survives npm registry metadata shape variance and never pins a version outside the requested range.
  • Typo'd CLI commands print suggestions instead of a register crash.

Evidence

  • Focused suites (all pass): install-source-utils 25 (new: multi-version selection, max-satisfying over publication order, fail-closed unmatched range, dotted/nested dist, absent openclaw, missing-field error), doctor stale-plugin-config 17, plugin auto-enable + validation 167, codex plugin register 22 (incl. base-runtime no-crash regression, landed with fix(codex): settle plugin activation, align plugin/list with codex 0.144, bound discovery per turn #108311).
  • Remote changed-surface gate (implementation round): format, typechecks, lint, boundaries, guards — green.
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean after two review-driven fixes (max-satisfying semver instead of positional order; fail-closed unmatched range).

Fixes #107226
Fixes #107842
Fixes #107219

…moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (#107842)

The #107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
#108311 alongside its regression test.
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M maintainer Maintainer-authored PR labels Jul 15, 2026

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

Copy link
Copy Markdown
Contributor

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: 4182c1c04d

ℹ️ 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".

Comment on lines +79 to +82
if (!version || !satisfiesSemver(version, range)) {
continue;
}
if (!best || gtSemver(version, best.version)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve OpenClaw correction ordering when selecting npm metadata

When this helper resolves metadata for OpenClaw range/month selectors, it now applies vanilla semver satisfies/gt even though OpenClaw treats numeric correction releases as stable and newer than their base version (src/infra/npm-registry-spec.ts:174-184). For a package line containing 2026.5.3 and the correction 2026.5.3-1, a selector such as @openclaw/[email protected]/range metadata will exclude or under-order the correction and resolve the older base tarball (or report no match), so plugin installs/updates can miss a published OpenClaw correction.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit e4fe969 into main Jul 15, 2026
113 checks passed
@steipete
steipete deleted the claude/codex-group5-install-doctor branch July 15, 2026 14:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 16, 2026
…moves, harden npm metadata parsing (openclaw#108336)

* fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (openclaw#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (openclaw#107842)

The openclaw#107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
openclaw#108311 alongside its regression test.

* style: format install-source-utils imports
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…moves, harden npm metadata parsing (openclaw#108336)

* fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (openclaw#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (openclaw#107842)

The openclaw#107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
openclaw#108311 alongside its regression test.

* style: format install-source-utils imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: M

Projects

None yet

1 participant