Skip to content

fix(update): use candidate snapshot worker and warn on plugin parse errors - #162298

Merged
steipete merged 2 commits into
mainfrom
upd/upd-candidate-snapshot-esm-plugin
Oct 1, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-candidate-snapshot-esm-plugin

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Closes #162017

Prepared head: dd7898b5244adaadebfa11583956a43063aae9d1.

What Problem This Solves

Fixes update snapshot preparation aborting when an optional plugin entry cannot be parsed, and makes updated drivers run snapshot inspection from the staged candidate package.

User Impact

Snapshot inventory and candidate Doctor report named plugin parse warnings while preserving the plugin files and continuing other checks. Source-integrity and private-copy failures remain errors.

Already-installed 2026.9.5/2026.9.6 drivers require the documented one-time disable/update/enable recovery for an affected plugin. Their installed launcher runs its own snapshot worker before the candidate takes over, so a candidate cannot retrofit that first-hop launcher. Run openclaw plugins disable <id>, then openclaw update, then openclaw plugins enable <id>. The unchanged 9.5 driver with an enabled ESM fixture reproduces the original failure; the recovery sequence was verified through that published 9.5 updater and leaves the unchanged plugin enabled and loaded on 2026.9.7. The 9.6 recovery was not live-tested. Once this fix is installed, later update hops select the candidate worker and record unsupported plugin entries as named warnings.

Thanks @jamiezigelbaum for the detailed report.

Why This Change Was Made

Main already has one shared parser admitting retained import.meta; selecting the installed driver's worker kept older parser behavior in the update path. Pass the candidate root to the existing worker resolver, share per-entry syntax-error handling between snapshot inventory and Doctor, and carry bounded warnings into the recorded snapshot step. Older candidate inventory responses remain readable when they omit warnings.

Evidence

  • The real snapshot regression failed before the warning repair. Its 724k-character ESM entry contains import.meta.dir and a deliberately invalid regex; the repaired snapshot preserves its bytes, records the plugin name, and continues the valid Doctor sibling. Test time: 0.768 seconds; pnpm test <file> --maxWorkers=1 wall: 6.878 seconds.
  • Removing only the candidate-root argument makes the worker-selection regression fail on the actual child argv, which points at the driver's runtime instead of the candidate.
  • Twelve focused files: 233 tests passed, with one existing case-insensitive-filesystem skip, in three clean runs.
  • The 48 importer files were exercised. A pre-existing cleanup mock/timer defect and missing Doctor candidate-worker fixtures were repaired; cleanup's 22 tests and the affected Doctor shard's 63 tests passed three times each.
  • Cleanup fixture timing improved from repeated 120-second timeouts to 1.138 seconds for all 22 tests (7.827 seconds wall), without changing assertions or timeouts. The Doctor producer file takes 24.789 seconds of test time (31.831 seconds wall).
  • node scripts/check-changed.mjs --base fb2052a33fd612097bd37ae8f29730505f6be8ea passed in 1,361.775 seconds, including production types, all 27 test type graphs, formatting, lint, dead exports, and selected guards.
  • Candidate build and package inventory/import-graph integrity passed. Candidate tarball SHA-256: 252a9b4bb57d368e9a2e058f7675399cb217842d533afe9acb20a22da77be94a, built from production checkpoint 0ff17dac142c255bb5240350d470cbf650384381; subsequent changes are test fixtures only.
  • Unmodified published 2026.9.5, enabled fixture: exit 1 after 26.72 seconds, runtime-verification-failed, exact error Cannot use 'import.meta' outside a module (7:415663). Installed worker and plugin bytes remained unchanged.
  • Documented recovery: update exit 0 after 104.206 seconds, status: ok, run.status: succeeded, no failed steps; plugin re-enabled and reported loaded, with unchanged bytes.
  • Production checkpoint and final test-fixture follow-up: independent direct-route Codex P1 reviews were both scoped-clean.
  • Production +75/-26; tests and test support +189/-27; docs +13/-3. Growth carries the warning result and candidate-worker fixtures; there was no duplicate parser on main to remove.

Blacksmith Testbox evidence: focused checks, package and published-driver proof, final checks. Hosted PR CI timing is not yet available.

The package build also reported an ordinary Control UI chunk at 216.6 KiB gzip against its 215.0 KiB report threshold; the packer and tarball integrity checks returned success. This branch changes no UI source or budget.

Measured single-worker test costs

Each wall measurement uses pnpm test <file> --maxWorkers=1 on Linux. Test seconds exclude shared compiler/setup time.

Test file Test seconds Wall seconds
update-candidate-snapshot.plugin-inspection.test.ts 0.768 6.878
update-candidate-canary.test.ts 21.407 29.173
update-candidate-plugin-repair.test.ts 0.966 7.530
update-candidate-plugin-sources.test.ts 5.373 12.239
update-candidate-bundled-provenance.test.ts 12.155 19.153
update-candidate-rehearsal.resources.test.ts 11.791 18.246
update-candidate-rehearsal.test.ts 1.077 10.134
update-candidate-state.budget.test.ts 10.538 17.095
update-candidate-state.cleanup.test.ts 8.745 14.740
update-candidate-state.test.ts 20.629 27.223
update-candidate-workspace-rehearsal.test.ts 37.141 46.578
update-candidate-state.inventory.test.ts 4.186 11.038
update-candidate-canary.cleanup.test.ts 1.138 7.827
doctor-update-rehearsal-producer.test.ts 24.789 31.831

The existing four-case workspace suite uses real snapshot and Doctor boundaries to verify that older, identical, newer, and interrupted-claim operator files and SQLite history survive. Its fixture change supplies the candidate-local worker; no cases were added there.

Keep snapshot workers in the staged candidate package and share named syntax-error warnings with candidate Doctor. Preserve source integrity checks and carry warnings into the update step. Validation is in progress on an isolated Linux Testbox for #162017.
Use candidate-local snapshot workers in Doctor producer fixtures and the shared UTF-8 command mocks in canary cleanup. Start virtual cleanup time after Gateway startup so real snapshot child settlement can finish.

Cleanup: 22 tests pass three times in 1.14-1.43 seconds of test time, replacing deterministic 120-second hangs. The affected Doctor shard passes 63 tests three times. The changed-file gate and independent P1 review pass.
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 1, 2026 02:21
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 10:27 PM ET / October 1, 2026, 02:27 UTC.

ClawSweeper review

What this changes

The PR runs update snapshot inspection from the staged candidate package and records optional plugin parse failures as named warnings while preserving plugin files.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: the repair remains necessary on current main, and this Codex review found no blocking introduced defect. The published-driver recovery evidence supports the documented first-hop limitation.

Priority: P0
Reviewed head: dd7898b5244adaadebfa11583956a43063aae9d1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary regressions, measured validation, and published-driver recovery evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.
Evidence reviewed 8 items Introduced worker selection: The pinned introduced patch selects the snapshot worker under candidateRoot. The verified test merge retains this change against its main parent, whose raw recorded parents match the supplied base and PR head.
Shared bounded warning boundary: Snapshot inventory and Doctor use the same helper, which catches only SyntaxError, bounds warning count and length, and rethrows other failures. Successful inspections retain source-current checks; plugin-tree copying retains locator, entry-stat, and private-link verification.
Regression and protocol compatibility: The new regression exercises the actual snapshot child and Doctor repair boundary with a large invalid ESM entry, asserts unchanged bytes and named warnings, and checks preservation of a valid sibling dependency without executing it. Inventory decoding defaults omitted warnings to an empty array. The plugin plan is disposable rehearsal data; no operator database schema or persisted configuration contract changes.
Findings None None.
Security None None.

How this fits together

Update rehearsal copies operator state and plugins into a private environment before checking the candidate Gateway. Snapshot inspection supplies the copied files, capacity estimates, and warnings consumed by Doctor and the update report.

flowchart TD
  A[Installed updater] --> B[Staged candidate]
  C[Operator state and plugins] --> D[Candidate snapshot worker]
  B --> D
  D --> E[Private state copy]
  D --> F[Named parse warnings]
  E --> G[Doctor and Gateway checks]
  F --> H[Update report]
  G --> H
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +49, Tests +162, Docs +10. Total +221 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 7 75 26 +49
Tests 14 189 27 +162
Docs 2 13 3 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 23 277 56 +221

Review metrics

Metric Value Why it matters
Installed-driver recovery 2026.9.5 verified; 2026.9.6 not live-tested The installed updater owns the first snapshot hop, so the documented recovery has a narrower evidence scope than the candidate repair.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/update-candidate-plugin-repair.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #162017
Summary: This PR explicitly targets the open snapshot-inspection report; the issue should remain open until the candidate fix merges.

Members:

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

Technical review

Best possible solution:

Keep candidate-owned snapshot inspection and shared named warnings while preserving private-copy and source-integrity failures.

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

Yes from source: an unparseable configured plugin reaches current main's unguarded snapshot dependency inspector. The captured published-driver failure corroborates this path; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the existing candidate worker resolver and sharing Doctor's syntax-error handling is a focused repair that retains integrity checks and documents the older-driver boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1b9d7e70ae30.

Labels

Label changes:

  • add P0: The linked report establishes a blocked Update Gateway path whose recovery currently requires terminal plugin commands.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.

Label justifications:

  • P0: The linked report establishes a blocked Update Gateway path whose recovery currently requires terminal plugin commands.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux published-9.5 updater transcript reports the original failure and successful recovery using the identified candidate artifact, with unchanged plugin bytes and restored loading. Real snapshot/Doctor regression evidence supplements that upgrade cell. Raw linked logs were unavailable to this reviewer; 9.6 coverage is expressly unclaimed. No stored operator data model changes.

Evidence

What I checked:

  • Introduced worker selection: The pinned introduced patch selects the snapshot worker under candidateRoot. The verified test merge retains this change against its main parent, whose raw recorded parents match the supplied base and PR head. (src/infra/update-candidate-snapshot.ts:353, dd7898b5244a)
  • Shared bounded warning boundary: Snapshot inventory and Doctor use the same helper, which catches only SyntaxError, bounds warning count and length, and rethrows other failures. Successful inspections retain source-current checks; plugin-tree copying retains locator, entry-stat, and private-link verification. (src/infra/update-candidate-plugin-sources.ts:10, dd7898b5244a)
  • Regression and protocol compatibility: The new regression exercises the actual snapshot child and Doctor repair boundary with a large invalid ESM entry, asserts unchanged bytes and named warnings, and checks preservation of a valid sibling dependency without executing it. Inventory decoding defaults omitted warnings to an empty array. The plugin plan is disposable rehearsal data; no operator database schema or persisted configuration contract changes. (src/infra/update-candidate-snapshot.plugin-inspection.test.ts:12, dd7898b5244a)
  • Current-main necessity: Inspection of fetched main shows the snapshot launcher still resolves the installed worker and plugin inventory still invokes dependency inspection without syntax-error containment. This PR supplies a distinct remaining repair rather than duplicating the earlier Doctor fix. (src/infra/update-candidate-plugins.ts:353, 1b9d7e70ae30)
  • Published-driver behavior evidence: The captured PR body, source revision 0229a4c2cd0e8a7fe7930f5dc6e2c21b2f3d4f1459f99afcea39de3c49a43ff3, reports an unchanged published 2026.9.5 updater failing with the exact import.meta error, then completing the documented recovery in 104.206 seconds with status ok, run.status succeeded, no failed steps, and the unchanged plugin re-enabled and loaded. The candidate artifact is identified by SHA-256 252a9b4bb57d368e9a2e058f7675399cb217842d533afe9acb20a22da77be94a and production checkpoint 0ff17da. The body explicitly says 9.6 recovery was not live-tested. (0ff17dac142c)
  • Documented installed-updater limitation: The troubleshooting page explains why candidate code cannot replace an already-running installed parser and documents temporary plugin disable/update/enable recovery. This is an existing first-hop limitation, not a regression introduced by the patch. Public docs: docs/install/update-troubleshooting.md. (docs/install/update-troubleshooting.md:407, dd7898b5244a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit f525f46 into main Oct 1, 2026
273 of 317 checks passed
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed via the admin exception (squash f525f462414f9d5e03d2bdfc4de86d254152a29a, head dd7898b5244a). The PR run had no failing test job: 73 checks green, 16 jobs cancelled mid-run with no PR-caused failure, and the gate failed only on those cancellations. Lead review was scoped-clean; no CI was re-spent.

@steipete
steipete deleted the upd/upd-candidate-snapshot-esm-plugin branch October 1, 2026 03:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…rrors (openclaw#162298)

The candidate state snapshot step launched its worker from the installed driver's own dist instead of the candidate root, so an old driver parsed plugin bundles with pre-openclaw#155394 options and failed the whole snapshot on an ESM plugin's import.meta ("Cannot use 'import.meta' outside a module"), ending the update as runtime-verification-failed. The snapshot worker now resolves under candidateRoot, and an unparseable plugin is recorded as a bounded named warning through the inspection helper Doctor already shares, instead of aborting the snapshot. Already-installed 2026.9.5/9.6 drivers keep their old worker for that first hop; the issue records the disable/update/enable recovery.

Closes openclaw#162017
yozakura-ava pushed a commit to yozakura-ava/openclaw that referenced this pull request Oct 6, 2026
…rrors (openclaw#162298)

The candidate state snapshot step launched its worker from the installed driver's own dist instead of the candidate root, so an old driver parsed plugin bundles with pre-openclaw#155394 options and failed the whole snapshot on an ESM plugin's import.meta ("Cannot use 'import.meta' outside a module"), ending the update as runtime-verification-failed. The snapshot worker now resolves under candidateRoot, and an unparseable plugin is recorded as a bounded named warning through the inspection helper Doctor already shares, instead of aborting the snapshot. Already-installed 2026.9.5/9.6 drivers keep their old worker for that first hop; the issue records the disable/update/enable recovery.

Closes openclaw#162017

(cherry picked from commit f525f46)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

2026.9.7 update: candidate state snapshot fails with "Cannot use 'import.meta' outside a module" (regression of #155371 class)

1 participant