Skip to content

fix(packaging): reject tarballs without the code mode worker - #115178

Merged
steipete merged 1 commit into
mainfrom
codex/code-mode-worker-package-integrity
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/code-mode-worker-package-integrity

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where an OpenClaw npm package can pass release and Docker integrity validation even though Code Mode cannot start after installation. The worker is loaded through a dynamically constructed path, so the static import graph does not detect an omitted worker; an uninventoried worker can also be deleted by postinstall.

Why This Change Was Made

Require dist/agents/code-mode.worker.js in both the packaged tarball and postinstall inventory starting exactly at 2026.5.14-beta.2, the first release tag containing that worker. Use the existing semver dependency so 2026.5.14-beta.1 and older valid packages remain accepted. Keep the existing Control UI npm-pack fixtures aligned and verify that real npm postinstall preserves the worker.

User Impact

Release and Docker package validation fails before shipping a package with broken installed Code Mode. Historical releases remain inspectable; packaged Control UI and the Code Mode worker both survive real npm installation.

Evidence

Failing-before adversarial reproduction

$ pnpm test test/scripts/check-openclaw-package-tarball.test.ts
FAIL rejects Code Mode packages that omit the dynamically loaded worker
AssertionError: expected +0 not to be +0
FAIL rejects Code Mode workers that postinstall would remove
AssertionError: expected +0 not to be +0
Test Files  1 failed (1)
     Tests  2 failed | 50 passed (52)

Passing real tarball and npm-postinstall tests

$ pnpm test test/scripts/check-openclaw-package-tarball.test.ts test/scripts/check-openclaw-package-tarball-control-ui.test.ts
✓ test/scripts/check-openclaw-package-tarball.test.ts (52 tests)
✓ test/scripts/check-openclaw-package-tarball-control-ui.test.ts (7 tests)
  ✓ proves actual npm postinstall deletes an omitted dashboard from a falsely accepted package
  ✓ accepts a packaged dashboard whose complete UI survives postinstall
Test Files  2 passed (2)
     Tests  59 passed (59)
[test] passed 1 Vitest shard
blacksmith run summary exit=0

Actual full production build and npm tarball

$ node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog --output-dir .artifacts/docker-e2e-package --output-name openclaw-code-mode-stress.tgz
==> Building OpenClaw package artifacts
[build-all] phase timings: total 2m 6.4s
==> Writing OpenClaw package inventory
==> Packing OpenClaw package
==> Checking OpenClaw package tarball
check-openclaw-package-tarball: tar list completed in 403ms
check-openclaw-package-tarball: tar extract completed in 404ms
check-openclaw-package-tarball: dist import graph completed in 3878ms
OpenClaw package tarball integrity passed.
==> OpenClaw package tarball check finished in 5s
.artifacts/docker-e2e-package/openclaw-code-mode-stress.tgz
blacksmith run summary sync=delegated command=2m22.212s total=2m22.261s exit=0

Full changed-file gate and independent review

$ pnpm check:changed
[check:changed] lanes=testRoot, tooling
[check:changed] format changed files
All matched files use the correct format.
[check:changed] script declaration contracts
[script-declarations] 244 declaration contracts match
[check:changed] typecheck test root
[check:changed] lint docker-e2e
Docker E2E package boundary/catalog guard passed.
[check:changed] lint script changed file
Found 0 warnings and 0 errors.
blacksmith run summary sync=delegated command=2m29.805s total=2m29.848s exit=0

$ .agents/skills/autoreview/scripts/autoreview --mode uncommitted
autoreview clean: no accepted/actionable findings reported
overall: patch is correct (0.96)

Verified the precise historical boundary directly against release tags: v2026.5.14-beta.1 contains no worker; v2026.5.14-beta.2 introduces it. Current main has no subsequent changes in any of the three touched packaging files, so refreshing only for unrelated main drift would discard exact-head green proof without changing the tested packaging behavior.

AI-assisted implementation and review.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Jul 28, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 8:14 AM ET / 12:14 UTC.

ClawSweeper review

What this changes

Adds npm tarball and postinstall-inventory validation that requires the Code Mode worker for package versions released after it was introduced, with regression fixtures covering installation preservation.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

Keep this PR open for normal maintainer review: the packaging guard and regression coverage appear targeted, but the PR body provides claims of live packaging validation rather than inspectable after-fix output or artifacts, so real-behavior proof is still required before merge.

Priority: P2
Reviewed head: b1dc850067ba2591b5bba1c4e83ed5cea2265072

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation and focused regression coverage look solid, but merge-quality evidence is capped until the claimed real packaging behavior is attached in inspectable form.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports real package-build and npm-postinstall runs, but it contains no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports real package-build and npm-postinstall runs, but it contains no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Targeted package guard: The proposed validator requires dist/agents/code-mode.worker.js only for valid package versions at or after 2026.5.14-beta.2, and checks both the tarball entry set and postinstall inventory.
Regression coverage: The PR adds fixtures for the worker and inventory and asserts that an installed packed package retains the worker, covering the postinstall failure mode described in the PR.
PR provenance: The sole proposed commit is titled “fix(packaging): require the code mode worker in shipped tarballs,” tying the tests and validator change to one focused packaging repair.
Findings None None.
Security None None.

How this fits together

The package-integrity script inspects the files and postinstall inventory shipped in OpenClaw npm tarballs before release and Docker packaging proceed. Its result protects installed Code Mode from failing because its dynamically loaded worker was omitted from the published package.

flowchart LR
  A[Build output] --> B[NPM tarball]
  B --> C[Package integrity validator]
  C --> D[Version gate]
  D --> E[Required Code Mode worker]
  E --> F[Postinstall inventory]
  F --> G[Release and Docker validation]
  G --> H[Installable Code Mode]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports real package-build and npm-postinstall runs, but it contains no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The branch is behind current main, so maintainers should refresh the merge result and rerun the packaging-focused proof on the exact merge head.
  • Resolve merge risk (P1) - The PR body describes real packaging and npm-install runs but does not include inspectable terminal output, logs, or a linked artifact demonstrating the after-fix behavior.
  • Complete next step (P2) - A protected maintainer label and missing inspectable real-behavior proof require contributor evidence plus maintainer review rather than an automated repair.
Agent review details

Security

None.

PR surface

Tests +80, Other +12. Total +92 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 82 2 +80
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 12 0 +12
Total 3 94 2 +92

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: test/scripts/check-openclaw-package-tarball-control-ui.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the version-gated tarball and inventory guard, then attach redacted terminal output or a linked artifact from the real package-build and npm-postinstall run against the refreshed merge head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the version-gated tarball and inventory guard, then attach redacted terminal output or a linked artifact from the real package-build and npm-postinstall run against the refreshed merge head.

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

Yes from source: a tarball at or after the stated version boundary can omit the dynamically loaded worker or omit it from postinstall inventory while prior validation does not explicitly require it. The PR adds focused adversarial tests for those paths, but this review did not execute them.

Is this the best way to solve the issue?

Yes, provisionally: enforcing the worker in both the tarball and postinstall inventory addresses the two distinct package-loss paths without changing Code Mode runtime behavior, and the release-version gate preserves older historical packages.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded packaging-integrity repair that prevents a release artifact from shipping with a Code Mode runtime file missing.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports real package-build and npm-postinstall runs, but it contains no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded packaging-integrity repair that prevents a release artifact from shipping with a Code Mode runtime file missing.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports real package-build and npm-postinstall runs, but it contains no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Targeted package guard: The proposed validator requires dist/agents/code-mode.worker.js only for valid package versions at or after 2026.5.14-beta.2, and checks both the tarball entry set and postinstall inventory. (scripts/check-openclaw-package-tarball.mjs:477, b1dc850067ba)
  • Regression coverage: The PR adds fixtures for the worker and inventory and asserts that an installed packed package retains the worker, covering the postinstall failure mode described in the PR. (test/scripts/check-openclaw-package-tarball-control-ui.test.ts:66, b1dc850067ba)
  • PR provenance: The sole proposed commit is titled “fix(packaging): require the code mode worker in shipped tarballs,” tying the tests and validator change to one focused packaging repair. (b1dc850067ba)
  • Current review state: GitHub reports the PR as cleanly mergeable but behind main; this requires a review refresh before merge, not a correctness finding that assumes main-only code would be removed.

Likely related people:

  • steipete: The available item provenance identifies this contributor as the author of the focused packaging-validator commit; no deeper current-main history could be established from the read-only review environment. (role: recent packaging contributor; confidence: low; commits: b1dc850067ba; files: scripts/check-openclaw-package-tarball.mjs, test/scripts/check-openclaw-package-tarball.test.ts, test/scripts/check-openclaw-package-tarball-control-ui.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted terminal output, logs, or a linked artifact from the real packaging workflow and a fresh npm-postinstall verification.
  • Refresh the branch against current main and capture the proof from that exact head.

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 981a3df into main Jul 28, 2026
118 of 122 checks passed
@steipete
steipete deleted the codex/code-mode-worker-package-integrity branch July 28, 2026 12:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant