Skip to content

Fix/97985 bundle plugin update smoke check - #98007

Closed
hanZeng-08 wants to merge 3 commits into
openclaw:mainfrom
hanZeng-08:fix/97985-bundle-plugin-update-smoke-check
Closed

hanZeng-08 wants to merge 3 commits into
openclaw:mainfrom
hanZeng-08:fix/97985-bundle-plugin-update-smoke-check

Conversation

@hanZeng-08

Copy link
Copy Markdown
Contributor

Fixes #97985

Summary

Fix openclaw update so its post-update plugin sync no longer treats format=bundle plugins as npm packages. Bundle plugins (Codex/Claude/Cursor layouts) have no package.json, so the post-update smoke check reported missing-package-json, caused the update to exit 1, and incorrectly unloaded the gateway.

The fix introduces a shared helper resolvePluginInstallPayloadKind that classifies an install path as "npm-package", "bundle", or "unknown". Both check points — runPluginPayloadSmokeCheck and collectMissingPluginInstallPayloads — consume this helper and skip npm-specific validation for bundle paths.

Real Behavior Proof

Environment: Linux, Node v22.23.1, pnpm 11.2.2, OpenClaw worktree SHA 1052652

Test fixtures:

  • /tmp/openclaw-bundle-proof/extensions/claude-bundle/.claude-plugin/plugin.json (bundle plugin, no package.json)
  • /tmp/openclaw-bundle-proof/extensions/npm-plugin/package.json (npm plugin)

After the fix, calling the real check functions:

$ tsx /tmp/bundle-proof.mjs
=== collectMissingPluginInstallPayloads ===
[]

=== runPluginPayloadSmokeCheck ===
{
  "checked": ["claude-bundle", "npm-plugin"],
  "failures": [
    {
      "pluginId": "npm-plugin",
      "installPath": "/tmp/openclaw-bundle-proof/extensions/npm-plugin",
      "reason": "missing-main-entry",
      "detail": "Plugin main entry \"dist/index.js\" not found at /tmp/openclaw-bundle-proof/extensions/npm-plugin/dist/index.js"
    }
  ]
}

Results:

  • Bundle plugin claude-bundle no longer produces missing-package-json.
  • Npm plugin npm-plugin is still checked under npm rules (the fixture intentionally lacks dist/index.js to show the path is unaffected).

Regression Test Plan

  • src/cli/update-cli/plugin-payload-kind.test.ts: 7 cases covering codex/claude/cursor bundles, manifestless claude, npm package, empty directory, dual-format precedence
  • src/cli/update-cli/plugin-payload-validation.test.ts: new bundle plugin smoke-check acceptance test
  • src/cli/update-cli/update-command.test.ts: new bundle plugin missing-package-json skip test

Root Cause

The post-update payload checks in src/cli/update-cli/plugin-payload-validation.ts and src/cli/update-cli/update-command.ts assumed every tracked plugin was an npm package. They checked installPath/package.json directly without distinguishing format=bundle plugins. Bundle plugins use manifest files such as .claude-plugin/plugin.json and have no package.json, so every update falsely flagged them as corrupted payloads.

Implementation Plan Details

  1. Create src/cli/update-cli/plugin-payload-kind.ts
    • resolvePluginInstallPayloadKind(installPath) reuses detectBundleManifestFormat to detect bundles
    • Falls back to checking package.json for "npm-package"
    • Returns "unknown" otherwise
  2. Modify src/cli/update-cli/plugin-payload-validation.ts
    • In runPluginPayloadSmokeCheck, call the helper after confirming the install dir exists
    • "bundle" causes continue, skipping package.json / extension / main / peer-link checks
  3. Modify src/cli/update-cli/update-command.ts
    • In collectMissingPluginInstallPayloads, call the helper after confirming the install dir exists
    • "bundle" causes continue, avoiding the missing-package-json entry
  4. Add regression tests in the three test files
  5. Verify with pnpm test src/cli/update-cli/ and pnpm build

Change Details

  • src/cli/update-cli/plugin-payload-kind.ts (new)
  • src/cli/update-cli/plugin-payload-kind.test.ts (new)
  • src/cli/update-cli/plugin-payload-validation.ts: skip npm checks for bundle paths
  • src/cli/update-cli/plugin-payload-validation.test.ts: bundle smoke-check regression test
  • src/cli/update-cli/update-command.ts: skip missing-package-json for bundle paths
  • src/cli/update-cli/update-command.test.ts: bundle payload-scan regression test

Test Points

  • pnpm test src/cli/update-cli/plugin-payload-kind.test.ts: 7 passed
  • pnpm test src/cli/update-cli/plugin-payload-validation.test.ts: 22 passed
  • pnpm test src/cli/update-cli/update-command.test.ts: 36 passed
  • pnpm test src/cli/update-cli/: 124 passed
  • pnpm build: succeeded
  • oxlint / oxfmt: 0 warnings / 0 format issues

Next Steps

  1. Push branch to personal fork
  2. Open PR using the body below
  3. Comment @clawsweeper re-review

Adds resolvePluginInstallPayloadKind to distinguish npm-package,
bundle, and unknown plugin install layouts. Reuses the existing
bundle-manifest detector.

Refs openclaw#97985
Smoke validation now resolves the payload kind before checking for
package.json. Bundle-format plugins bypass npm-specific validation.

Refs openclaw#97985
…d scan

collectMissingPluginInstallPayloads now treats bundle-format install
paths as valid payloads, matching runtime behavior and preventing
openclaw update from false-failing on healthy bundle plugins.

Refs openclaw#97985
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 30, 2026
@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed June 30, 2026, 12:02 AM ET / 04:02 UTC.

Summary
The PR adds a payload-kind classifier and uses it to skip npm-specific update payload validation for bundle-format plugin directories.

PR surface: Source +34, Tests +120. Total +154 across 6 files.

Reproducibility: yes. Current main's tracked-plugin payload checks reach missing-package-json for an existing bundle install directory without top-level package.json, and the PR regression is source-reproducible for a dual-format directory with both package metadata and bundle markers.

Review metrics: 1 noteworthy metric.

  • Dual-format precedence: 1 documented rule contradicted. The new helper must match the existing native-first plugin install contract before merge.

Stored data model
Persistent data-model change detected: persistent cache schema: src/cli/update-cli/plugin-payload-kind.ts, serialized state: src/cli/update-cli/plugin-payload-kind.test.ts, serialized state: src/cli/update-cli/plugin-payload-validation.test.ts, serialized state: src/cli/update-cli/update-command.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #97985
Summary: This PR is a candidate fix for the canonical update-time bundle plugin false-failure issue; a sibling PR also targets the same issue but is not a safe superseding target.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Preserve native-first dual-format classification in the payload-kind helper and add a regression test for a package.json plus bundle-marker directory.

Risk before merge

  • [P1] Merging as-is would let valid native OpenClaw packages that also contain bundle markers skip package.json, extension-entry, main-entry, and peer-link validation during update.
  • [P1] Because this validation runs in the post-update path before restart/recovery, weakening native package validation can turn real corrupt-package payloads into later plugin or gateway availability failures.

Maintainer options:

  1. Repair Native-First Classification (recommended)
    Update the helper and tests so directories with valid native package metadata stay subject to npm/native validation even when bundle markers are also present.
  2. Accept A Contract Change Explicitly
    Maintainers could intentionally allow bundle markers to bypass native package checks only if they update the documented native-first contract and accept the reduced update validation coverage.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve native-first dual-format plugin classification in the new payload-kind helper, add a regression where package.json with openclaw.extensions plus a bundle marker remains an npm/native payload, and keep the true bundle no-package.json acceptance tests green.

Next step before merge

  • [P2] The remaining blocker is a narrow mechanical repair to preserve native-first dual-format payload classification and tests on this PR branch.

Security
Cleared: No concrete security or supply-chain regression was found; the diff adds filesystem classification and tests without dependency, CI, secret, or package execution changes.

Review findings

  • [P2] Preserve native-first dual-format validation — src/cli/update-cli/plugin-payload-kind.ts:17-19
Review details

Best possible solution:

Align post-update payload checks with the existing plugin install contract: skip npm checks for true bundle payloads while keeping native package validation for dual-format package directories.

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

Yes. Current main's tracked-plugin payload checks reach missing-package-json for an existing bundle install directory without top-level package.json, and the PR regression is source-reproducible for a dual-format directory with both package metadata and bundle markers.

Is this the best way to solve the issue?

No. The PR touches the right update-cli validation path, but the best fix must preserve native-first dual-format package validation instead of treating every bundle-marker directory as safe to skip npm checks.

Full review comments:

  • [P2] Preserve native-first dual-format validation — src/cli/update-cli/plugin-payload-kind.ts:17-19
    This branch classifies any directory with a bundle marker as bundle before checking whether it is also a valid native package. That conflicts with the documented and tested native-first rule, so a broken native package payload with bundle markers would now skip package.json, extension, main-entry, and peer-link checks during update. Classify valid native package payloads first, then skip npm checks only for true bundle payloads.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The PR targets a released update workflow that can exit before gateway recovery when valid bundle plugins are installed.
  • merge-risk: 🚨 compatibility: The diff changes update-time plugin payload classification and currently contradicts documented native-first dual-format package behavior.
  • merge-risk: 🚨 availability: The changed validation gate is in the update path that determines whether OpenClaw reaches gateway restart or recovery after a package swap.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes terminal-style after-fix output from real payload-check functions against bundle and npm fixtures, which is sufficient for this non-visual CLI validation change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal-style after-fix output from real payload-check functions against bundle and npm fixtures, which is sufficient for this non-visual CLI validation change.
Evidence reviewed

PR surface:

Source +34, Tests +120. Total +154 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 34 0 +34
Tests 3 120 0 +120
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 154 0 +154

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/cli/update-cli/plugin-payload-kind.test.ts src/cli/update-cli/plugin-payload-validation.test.ts src/cli/update-cli/update-command.test.ts.
  • [P1] node scripts/run-vitest.mjs src/plugins/install.test.ts src/plugins/bundle-manifest.test.ts.

What I checked:

  • PR classifier is bundle-first: The new helper returns bundle as soon as detectBundleManifestFormat() finds a marker, before checking whether top-level package metadata makes the directory a native package payload. (src/cli/update-cli/plugin-payload-kind.ts:17, fa93dfeb081a)
  • Current main smoke check is package-json-specific: runPluginPayloadSmokeCheck requires top-level package.json before validating extension entries, main files, and peer links, which explains the linked bundle false-failure on current main. (src/cli/update-cli/plugin-payload-validation.ts:81, 72f837a4a478)
  • Current main missing-payload collector is package-json-specific: collectMissingPluginInstallPayloads reports missing-package-json whenever a tracked install directory exists but lacks top-level package metadata. (src/cli/update-cli/update-command.ts:577, 72f837a4a478)
  • Documented native-first contract: The bundle docs say OpenClaw checks native plugin format first and uses the native path when a directory contains both native and bundle markers. Public docs: docs/plugins/bundles.md. (docs/plugins/bundles.md:250, 72f837a4a478)
  • Tested native-first contract: The plugin install tests include a regression named prefers native package installs over bundle installs for dual-format directories. (src/plugins/install.test.ts:4006, 72f837a4a478)
  • Related issue remains canonical: The linked issue reports OpenClaw v2026.6.10 false-failing valid format=bundle plugins during openclaw update, exiting 1, and leaving the gateway unloaded until manual recovery.

Likely related people:

  • BKF-Gitty: GitHub path history shows the mandatory post-core plugin convergence change introduced active plugin payload validation in the update path. (role: introduced behavior; confidence: medium; commits: 109493bcdd62; files: src/cli/update-cli/plugin-payload-validation.ts, src/cli/update-cli/post-core-plugin-convergence.ts, src/cli/update-cli/update-command.ts)
  • steipete: Recent path history shows work on update smoke validation and bundle manifest/docs helpers that define the native-first contract this PR must preserve. (role: recent area contributor; confidence: high; commits: 7d75bffa17ce, f91fab8b1818, f43dc9aa6150; files: src/cli/update-cli/plugin-payload-validation.ts, src/plugins/bundle-manifest.ts, docs/plugins/bundles.md)
  • vincentkoc: Recent plugin install and update-command history includes repeated work in the native package install/update validation surfaces relevant to this regression guard. (role: adjacent owner; confidence: medium; commits: 13d474134f38, a192b2ea52b3, c1a414bf286a; files: src/plugins/install.test.ts, src/plugins/install.ts, src/cli/update-cli/update-command.ts)
  • ly-wang19: GitHub path history and local blame show recent work in the missing-plugin-payload/update-command path that this PR modifies. (role: recent area contributor; confidence: medium; commits: a0e9ca1e9544, 5f60724b6d7b; files: src/cli/update-cli/update-command.ts, src/cli/update-cli/plugin-payload-validation.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 30, 2026
@hanZeng-08

Copy link
Copy Markdown
Contributor Author

Hi @steipete @vincentkoc @frankekn @thewilloftheshadow @joshavant @gumadeiras @hydro13 this PR is ready for review/approval. Please take a look when convenient. Thank you!

@openclaw-barnacle

Copy link
Copy Markdown

Please don’t spam-ping multiple maintainers at once. Be patient, or join our community Discord for help: https://discord.gg/clawd

@vincentkoc

Copy link
Copy Markdown
Member

The canonical fix for #97985 has now landed in #98010 as 4391041. I’m closing this PR as superseded so we keep one implementation path for the bundle-plugin update payload fix and avoid overlapping update-smoke behavior changes. This branch was also waiting on author/proof refresh, so #98010 is the safer canonical path.

@vincentkoc vincentkoc closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openclaw update: post-update plugin sync false-fails on format=bundle plugins ("package.json is missing"), exits 1 and unloads the gateway

2 participants