Skip to content

os/v3/puppy: ship Node.js + npm with the global prefix on /data, so lemonade launch <agent> can install its agent (engine#3310) - #3311

Merged
bong-water-water-bong merged 2 commits into
mainfrom
cl-release/node-in-image
Nov 22, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
cl-release/node-in-image

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes the image side of #3310. The issue's on-box acceptance, from a fresh stick and again after an install, is still to run (see the end).

What ships

  • Node.js v24.22.3 (LTS "Krypton", the 2026-11-10 security release). This is the official node-v24.22.3-linux-x64.tar.xz, pinned in os/v3/puppy/pin.txt with sha256 4f2b175a6d53a5c617a80dba2676238a0688cef28c6da4eba35c7d844e66fcfb (from nodejs.org's SHASUMS256.txt, re-measured on the download). v24 is the line the owner already ran lemonade launch pi on by hand (24.22.1). Moving to v26 LTS later is a one-line pin bump.
  • stage-node.sh <root> [--tarball F] [--manifest] checks the sha256 before unpacking anything. It puts the release in /usr/local/lib/nodejs, unmodified, leaving out include/ (67 MB of addon headers; the appliance has no compiler), CHANGELOG, README and share/doc. node, npm, npx and corepack in /usr/local/bin are small exec wrappers, not symlinks, because patch-sfs.sh copies a single-file target with install, which would turn npm's relative symlink into a copy that cannot find its modules. --manifest prints the 5 patch-sfs lines a cut needs (the cut belongs to cl-buildenv).
  • Global installs that persist: the tree's etc/npmrc sets prefix=/data/npm-global.
    • 05onboard-data creates it at boot and links /root/.npm-global to it, which is the path Lemonade's agent finder tries after PATH.
    • On an installed disk, 07onboard-user hands the tree to onebit. It is deliberately not world-writable, because its bin is on root's PATH; onebit already has sudo, so owning it adds nothing.
    • /etc/profile.d/91onboard-npm appends /data/npm-global/bin to PATH, after the system directories, so an installed package cannot shadow a system command.
  • Release check: new row node. It checks that node --version and npm --version run, and that npm prefix -g is on the mounted data partition (taken from df, so a /data that is only a directory on the RAM root fails). The row skips on os/mini, which does not ship Node. The row's text says installing an agent needs the network. 6 new --self-test cases.
  • Licences: os/licenses/nodejs/ holds the release's own LICENSE (Node MIT plus every bundled dependency) and a SOURCE record; os/LICENSES.md gains a Node.js section. The image keeps the LICENSE at /usr/local/lib/nodejs/LICENSE. NOTICE-BINARY is not touched: it covers the closed engine binaries, and Node is not part of them (qrencode and Dropbear are handled the same way).
  • container-build.sh stages Node in the payload block and refuses a packed image without the tree, the npmrc, the LICENSE, the wrappers and the profile.d file.

Measured

  • SFS size: patch-sfs.sh --manifest with the staged tree on the v2026.47 puppy_upup64r_26.04.sfs (woof-CE's zstd-19 / 256K options): 495,226,880 → 536,666,112 B, +41,439,232 B (+39.5 MiB). patch-sfs's checks all passed: no uid/gid ≥ 1000, the repack matches, only the 5 declared paths differ. The node and npm unpacked from the packed SFS run (v24.22.3 / 11.19.1). A live stick copies the SFS to RAM, so it also uses about 40 MB more RAM.
  • On the AI MAX+ 395 (c35 installed; the staged tree under /data/dev/cl-release/node-root): node --version v24.22.3, npm --version 11.19.1, npm prefix -g /data/npm-global, update-notifier false. npm i -g --prefix <scratch> @earendil-works/pi-coding-agent gave rc=0 in 6 s, and pi --version printed 1.6.0 (168 MB installed). npm 11 blocks the install scripts of two dependencies, and pi runs without them. The row's verdict with the box's real values is PASS; with no Node (today's c35 image) it is FAIL.
  • tests/stage_node_test.sh 10/10, on a fake release tarball, so CI needs no network. release-check.sh --self-test rc=0. scripts/pre-pr-checks.sh --base origin/main: 17 green, 3 skipped.

Not run yet: the issue's acceptance itself. On a freshly written stick and again after an install: npm i -g @earendil-works/pi-coding-agent, reboot, then lemonade launch pi with a downloaded model. That needs a stick built with this change, which happens with the next candidate (test at the end).

🤖 Generated with Claude Code

…o `lemonade launch <agent>` can install its agent (engine#3310)

- pin.txt: Node.js v24.22.3 LTS linux-x64, sha256 4f2b175a... (nodejs.org SHASUMS256, re-measured).
- stage-node.sh: sha256-checked unpack into /usr/local/lib/nodejs (minus include/, CHANGELOG, README, share/doc), npm
  global config prefix=/data/npm-global, exec wrappers node/npm/npx/corepack in /usr/local/bin (regular files, so
  patch-sfs's single-file copy cannot break npm's relative symlink); --manifest prints the cut's patch-sfs lines.
- container-build.sh stages it and asserts it in the packed image.
- 05onboard-data makes /data/npm-global (+ /root/.npm-global link, Lemonade's fallback path); 07onboard-user hands it
  to onebit on an installed disk (not world-writable: it is on root's PATH); profile.d/91onboard-npm appends its bin.
- release-check row `node`: node + npm run and the global prefix is on the mounted data partition (SKIP on os/mini).
- os/licenses/nodejs (the release's LICENSE + SOURCE), os/LICENSES.md row.
- tests/stage_node_test.sh on a fake release tarball.

Measured: main SFS 495,226,880 -> 536,666,112 B (+39.5 MiB) via patch-sfs on the v2026.47 SFS; on the AI MAX+ 395 the
staged tree runs (node v24.22.3, npm 11.19.1, prefix -g /data/npm-global) and installs pi 1.6.0 in 6 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 7371460)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3310 - Partially compliant

Compliant requirements:

  • Node.js in the image: Node.js v24.22.3 is shipped with the correct pin and sha256, installed under /usr/local.
  • Global installs that persist: npm's global prefix is set to /data/npm-global and created at boot by 05onboard-data.
  • Licences: Node.js's license and bundled third-party notices are included in os/licenses/nodejs/.
  • The release check: a new node_verdict function in release-check.sh verifies node --version, npm --version, and that npm's global prefix is on the data partition.
  • Offline: documentation and behavior indicate that agent installation requires network and that lemonade launch prints install hints offline.

Non-compliant requirements:

  • The SFS size growth measurement is not explicitly confirmed in the PR description or code diff, though the commit message mentions a 39.5 MiB increase.

Requires further human verification:

  • The actual SFS size increase needs to be verified on the hardware.
  • The behavior of lemonade launch <agent> on a fresh stick and after installation needs to be confirmed.
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect handling of symlinked npm binary

The script creates exec wrappers for node, npm, npx, and corepack but does not ensure that the npm binary is not a symlink that would break when copied by patch-sfs.sh. The script explicitly mentions that it avoids symlinks for these wrappers, but it's not clear if the original npm binary from the Node.js release is a symlink and whether it's correctly handled.

for b in node npm npx corepack; do
    t=/usr/local/lib/nodejs/bin/$b
    [ -e "$dest/bin/$b" ] || { echo "$prog: REFUSED: the release has no bin/$b" >&2; exit 2; }
    printf '#!/bin/sh\n# engine#3310: Node.js %s, staged by os/v3/puppy/stage-node.sh\nexec %s "$@"\n' "$ver" "$t" \
        > "$root/usr/local/bin/$b"
    chmod 755 "$root/usr/local/bin/$b"
done
Ownership change may not be atomic

The script changes ownership of /data/npm-global and its subdirectories to the user account. If this operation is not atomic, it could leave the directory in an inconsistent state if interrupted.

if [ -d "$DATA/npm-global" ]; then
    chown -R "$USER_NAME:$GRP" "$DATA/npm-global"
    h=/home/$USER_NAME/.npm-global
    if [ ! -e "$h" ] || [ -L "$h" ]; then ln -sfn "$DATA/npm-global" "$h"; chown -h "$USER_NAME:$GRP" "$h"; fi
fi
Potential race condition in symlink creation

The script creates a symlink /root/.npm-global pointing to /data/npm-global but does not ensure atomicity or consistency in case of concurrent access. If multiple processes attempt to create or modify the symlink simultaneously, it could lead to inconsistent state.

mkdir -p "$DATA/npm-global/bin" "$DATA/npm-global/lib/node_modules"
chmod 755 "$DATA/npm-global" "$DATA/npm-global/bin" "$DATA/npm-global/lib" "$DATA/npm-global/lib/node_modules"
if [ ! -e /root/.npm-global ] || [ -L /root/.npm-global ]; then ln -sfn "$DATA/npm-global" /root/.npm-global; fi

⚠️ Review coverage: The following files were not included in this review because of the token budget:

  • os/licenses/nodejs/LICENSE

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 22, 2026 15:45
…stage_node runs in the CI container (no xz there) (engine#3310)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 7371460

@bong-water-water-bong
bong-water-water-bong merged commit 3d46373 into main Nov 22, 2026
11 of 12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-release/node-in-image branch November 22, 2026 16:42
bong-water-water-bong added a commit that referenced this pull request Nov 22, 2026
…ses release-check `node` (engine#3287, engine#3310) (#3324)

#3311 made container-build.sh stage the pinned Node.js; a cut that patches a released SFS (BASE=) did not,
so its image would ship 91onboard-npm and the `node` release-check row without node. cut.sh now runs
stage-node.sh --manifest into its own root and adds those rows to the patch-sfs manifest (a tree row and
the four wrappers with mode 755); rows whose bytes the base already carries are dropped as before, a tree
compared whole. NODE_TARBALL=<file> uses a local copy of the pinned tarball (still sha256-checked).

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant