Skip to content

fix(update): validate bundle plugin payloads by manifest contract - #98010

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
LiLan0125:fix/97985-shared-bundle-payload-validation
Jul 1, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
LiLan0125:fix/97985-shared-bundle-payload-validation

Conversation

@LiLan0125

@LiLan0125 LiLan0125 commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #97985

Summary

  • Update-time plugin payload checks now classify bundle installs by persisted record metadata or by the installed bundle manifest/marker on disk.
  • Marketplace installs that persist only source, installPath, and marketplace identity fields no longer fail only because they lack package.json.
  • Native package payloads still stay on the package validation path, and npm/code plugins still fail closed when their package payload is missing or corrupt.

Change Type

  • Bug fix

Scope

  • CLI update
  • Plugin install payload validation

Verification

  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo passed.
  • node scripts/run-vitest.mjs run src/cli/update-cli/plugin-payload-validation.test.ts src/cli/update-cli/update-command.test.ts passed.
  • OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/cli/update-cli/plugin-payload-validation.ts src/cli/update-cli/plugin-payload-validation.test.ts src/cli/update-cli/update-command.ts src/cli/update-cli/update-command.test.ts passed.
  • git diff --check passed.

Real behavior proof

Behavior addressed: Bundle install payloads are validated by the bundle manifest contract even when persisted marketplace install records do not carry transient format fields.
Environment tested: Node v22.22.0 on Linux 4.19.112-2.el8.x86_64 x86_64.
Steps run after the patch: Called the actual runPluginPayloadSmokeCheck and collectMissingPluginInstallPayloads production functions from source with a ClawHub bundle record, two marketplace bundle records without format, and a broken npm payload.
Evidence after fix:

node --import tsx --no-warnings -e "
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { runPluginPayloadSmokeCheck } from './src/cli/update-cli/plugin-payload-validation.ts';
import { collectMissingPluginInstallPayloads } from './src/cli/update-cli/update-command.ts';
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'openclaw-proof-97985-'));
async function writeJson(file, value) {
  await fs.mkdir(path.dirname(file), { recursive: true });
  await fs.writeFile(file, JSON.stringify(value), 'utf8');
}
try {
  const marketplaceBundleDir = path.join(root, 'marketplace-cursor-bundle');
  await writeJson(path.join(marketplaceBundleDir, '.cursor-plugin', 'plugin.json'), { name: 'marketplace-cursor-bundle' });
  const clawhubBundleDir = path.join(root, 'clawhub-codex-bundle');
  await writeJson(path.join(clawhubBundleDir, '.codex-plugin', 'plugin.json'), { name: 'clawhub-codex-bundle' });
  const manifestlessBundleDir = path.join(root, 'manifestless-bundle');
  await fs.mkdir(path.join(manifestlessBundleDir, 'skills'), { recursive: true });
  const npmDir = path.join(root, 'npm-plugin');
  await fs.mkdir(npmDir, { recursive: true });
  const records = {
    'clawhub-codex-bundle': { source: 'clawhub', clawhubFamily: 'bundle-plugin', installPath: clawhubBundleDir },
    'manifestless-bundle': { source: 'marketplace', installPath: manifestlessBundleDir, marketplaceName: 'Local', marketplaceSource: 'local/repo', marketplacePlugin: 'manifestless-bundle' },
    'marketplace-cursor-bundle': { source: 'marketplace', installPath: marketplaceBundleDir, marketplaceName: 'Local', marketplaceSource: 'local/repo', marketplacePlugin: 'marketplace-cursor-bundle' },
    'npm-plugin': { source: 'npm', installPath: npmDir },
  };
  const smoke = await runPluginPayloadSmokeCheck({ records, env: {} });
  const missing = await collectMissingPluginInstallPayloads({ records, env: {} });
  console.log(JSON.stringify({
    smokeChecked: smoke.checked,
    smokeFailures: smoke.failures.map((failure) => ({ pluginId: failure.pluginId, reason: failure.reason })),
    missingPayloads: missing.map((entry) => ({ pluginId: entry.pluginId, reason: entry.reason })),
  }, null, 2));
} finally {
  await fs.rm(root, { recursive: true, force: true });
}
"

Output:

{
  "smokeChecked": [
    "clawhub-codex-bundle",
    "manifestless-bundle",
    "marketplace-cursor-bundle",
    "npm-plugin"
  ],
  "smokeFailures": [
    {
      "pluginId": "npm-plugin",
      "reason": "missing-package-json"
    }
  ],
  "missingPayloads": [
    {
      "pluginId": "npm-plugin",
      "reason": "missing-package-json"
    }
  ]
}

Observed result after the fix: Valid bundle payloads pass both update-time payload checks without package.json; the npm payload that lacks package.json still fails with missing-package-json.
What was not tested: Full macOS package upgrade plus service restart; this proof exercises the update payload functions directly and the targeted test suites cover the related update paths.

Root Cause

The update payload checks treated tracked plugin install records as npm/code packages unless the record carried bundle-specific transient fields. Marketplace install records persist source and marketplace identity fields but not those transient format fields, so valid bundle directories could still be reported as missing package payloads.

Regression Test Plan

  • Added coverage for persisted marketplace bundle records without transient format metadata in the smoke check path.
  • Added coverage for the same persisted marketplace record shape in the missing-payload collector path.
  • Existing coverage still checks bundle records, manifestless bundle layouts, dual-format native package validation, invalid bundle manifests, and unchanged npm package.json failures.

User-visible / Behavior Changes

Users with valid bundle marketplace plugins no longer get a post-update payload failure solely because the persisted install record lacks transient bundle format fields.

Security Impact

No new permissions, network calls, or secret handling changes. The change reads local bundle manifests through the existing shared bundle loader.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Jun 30, 2026
@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 12:07 PM ET / 16:07 UTC.

Summary
The PR changes update-time plugin payload validation so bundle plugin installs are classified by persisted metadata or bundle markers and validated through the bundle manifest contract while preserving native package checks.

PR surface: Source +155, Tests +295. Total +450 across 4 files.

Reproducibility: yes. Current main source requires package.json for tracked update payload records, and the linked issue describes valid bundle plugins without that package payload failing the update path.

Review metrics: 2 noteworthy metrics.

  • Update Payload Gates: 2 changed. Both the smoke check and missing-payload collector now branch between bundle and native package payload validation before update recovery.
  • Persisted Marketplace Bundle Coverage: 2 regression tests added. The tests cover marketplace bundle records without transient format metadata, which was the prior review gap.

Stored data model
Persistent data-model change detected: serialized state: src/cli/update-cli/plugin-payload-validation.test.ts, serialized state: src/cli/update-cli/update-command.test.ts, vector/embedding metadata: 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 linked update false-failure issue; sibling PRs target the same update payload root cause.

Members:

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

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦀 challenger crab
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Risk before merge

  • [P1] The payload classifier is compatibility-sensitive: a mistake could either keep false-failing valid bundle plugins or skip a real native package corruption signal during update.
  • [P1] The PR proof exercises the production payload-check functions directly, but it does not prove a full packaged macOS update plus gateway restart.
  • [P1] Several open sibling PRs target the same canonical issue, so maintainers should land one path and close the rest after preserving useful coverage.

Maintainer options:

  1. Pick One Canonical Bundle Fix (recommended)
    Choose this PR or one viable sibling as the canonical implementation, ensure it preserves both bundle validation and native package fail-closed behavior, then close the remaining sibling fixes.
  2. Require Packaged Update Proof
    Maintainers can ask for a packaged update plus gateway restart proof before merge because the touched path controls update recovery after the gateway may have been stopped.
  3. Close If A Sibling Lands First
    If another viable sibling PR lands first, preserve any stronger tests from this branch and close this PR as superseded.

Next step before merge

  • [P0] Multiple open sibling PRs target the same linked outage, so maintainers should select a canonical patch rather than dispatching an automated repair.

Security
Cleared: No concrete security or supply-chain regression was found; the diff reads local bundle manifests through existing loader code and does not change dependencies, workflows, permissions, downloads, or secret handling.

Review details

Best possible solution:

Land one canonical format-aware update payload validation fix that uses the shared bundle manifest contract, preserves native package fail-closed checks, and then close the duplicate sibling PRs.

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

Yes. Current main source requires package.json for tracked update payload records, and the linked issue describes valid bundle plugins without that package payload failing the update path.

Is this the best way to solve the issue?

Yes for the central bug. Reusing the shared bundle manifest detector is the right owner-boundary fix, while broader non-destructive plugin-sync recovery can be tracked separately if maintainers want that policy change.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦀 challenger crab and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

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 interpretation of persisted plugin install records and bundle/package payload precedence.
  • merge-risk: 🚨 availability: A false payload failure can stop the update before gateway restart, leaving the runtime unavailable until manual recovery.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦀 challenger crab and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from production payload-check functions over bundle layouts and a broken npm payload; that is sufficient targeted real behavior proof, though not a full packaged update proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from production payload-check functions over bundle layouts and a broken npm payload; that is sufficient targeted real behavior proof, though not a full packaged update proof.
Evidence reviewed

PR surface:

Source +155, Tests +295. Total +450 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 232 77 +155
Tests 2 295 0 +295
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 527 77 +450

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs run src/cli/update-cli/plugin-payload-validation.test.ts src/cli/update-cli/update-command.test.ts.
  • [P1] node scripts/run-vitest.mjs run src/cli/update-cli/post-core-plugin-convergence.test.ts src/plugins/loader.bundle.test.ts src/plugins/manifest-registry.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • Peter Steinberger: Top update-cli history contributor in shortlog and author/committer of prior update plugin-sync sequencing work near this surface. (role: adjacent owner; confidence: high; commits: be16cf2f0d41, 84aed919a9cd; files: src/cli/update-cli/update-command.ts)
  • FullerStackDev: Recent merged work touched post-core plugin convergence and stale bundled plugin shadow pruning, both adjacent to this update payload path. (role: recent area contributor; confidence: medium; commits: 6b0361cdef9a, b5d714e25dd9; files: src/cli/update-cli/post-core-plugin-convergence.ts, src/cli/update-cli/update-command.ts, src/plugins/stale-local-bundled-plugin-install-records.ts)
  • Vincent Koc: Update-cli history shows recent self-update/plugin refresh work and the latest release tag commit that contains the shipped failing behavior. (role: recent update-cli contributor; confidence: medium; commits: a24af4910018, aa69b12d0086; 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Jun 30, 2026
@clawsweeper clawsweeper Bot added 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
@clawsweeper clawsweeper Bot added 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. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 30, 2026
@LiLan0125

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the native-first finding: dual-format payloads with package.json OpenClaw extension metadata now stay on the package validation path, while bundle-only records continue through shared bundle manifest validation.

Also fixed the check-test-types failure by keeping the historical format-marked bundle fixture out of direct PluginInstallRecord object literals.

Verified locally:

  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • node scripts/run-vitest.mjs run src/cli/update-cli/plugin-payload-validation.test.ts src/cli/update-cli/update-command.test.ts
  • node scripts/run-vitest.mjs run src/plugins/bundle-manifest.test.ts
  • git diff --check

@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. and removed 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 30, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 30, 2026
@vincentkoc
vincentkoc merged commit 4391041 into openclaw:main Jul 1, 2026
128 of 136 checks passed
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…enclaw#98010)

* fix(update): validate bundle plugin payloads by manifest contract

Closes openclaw#97985

* fix(update): preserve native payload checks for dual-format plugins

* fix(update): satisfy payload validation lint

* fix(update): cover persisted marketplace bundles
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 2, 2026
…enclaw#98010)

* fix(update): validate bundle plugin payloads by manifest contract

Closes openclaw#97985

* fix(update): preserve native payload checks for dual-format plugins

* fix(update): satisfy payload validation lint

* fix(update): cover persisted marketplace bundles
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

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