Skip to content

🤖 ci: install every dependency from a lockfile or a checksum - #7234

Merged
ibetitsmike merged 5 commits into
mainfrom
mike/lock-dependencies
Oct 22, 2026
Merged

ibetitsmike merged 5 commits into
mainfrom
mike/lock-dependencies

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #7227. Every dependency that CI, the releases, the published npm package and the Terminal-Bench sandboxes install now comes from a lockfile, a sha256 or an image digest (the exceptions are listed below), and a lock update takes only releases that are at least 7 days old. A compromised release such as litellm 1.107.0 can no longer reach a job, a release or a user only because it is the newest version.

Background

In #7227, uv run --with harbor in Static Checks resolved the compromised litellm 1.107.0 on the day of its upload. The same pattern was in many other places:

  • tools resolved at run time: uvx, uv run --with, pip install, bunx/npx of packages outside the lockfile, bun x mintlify@<version>;
  • installers piped into a shell: uv's install.sh, shfmt from webinstall.dev, bun.sh/install;
  • release binaries without checksums: hadolint, zizmor, pinact, jsign (in the Windows signing job), Ollama;
  • the published package's npm-shrinkwrap.json, which npm install --package-lock-only resolved afresh at publish time instead of taking the versions that CI tested. It also listed 1,454 devDependencies, which npm installs for users too (2,298 entries in 0.31.0).

Implementation

npm package (npm install -g @coder/xum, npx @coder/xum)

  • scripts/generate-npm-shrinkwrap.ts replaces the shell script. It writes npm-shrinkwrap.json from bun.lock: the production subtree at the paths where bun.lock put it, with bun.lock's integrity digests, which must equal the registry's. Generation fails if npm would have to resolve an edge itself. The shrinkwrap now holds the 873 production packages only.
  • The smoke tests install the tarball the way npm installs the published package (--tarball-install plus npm ci), because npm ignores the shrinkwrap of a tarball file. The unlocked smoke test (SKIP_SHRINKWRAP=1) moves to its own job after the publish, with contents: read and no id-token.
  • bun update commander: bun.lock had commander 9.5.0 at the root for the range ^14.0.2, which the generator rejects.

Python tools

  • A root pyproject.toml with dependency groups (test, crap, dry, mutate, harbor, bigquery, ruff) and its uv.lock replace the PEP 723 headers, uvx, uv run --with and pip install. Every caller runs uv run --locked --only-group <group>, which fails when uv.lock is out of date.
  • exclude-newer = "7 days" keeps younger releases out of the lock.

bun

  • minimumReleaseAge = 604800 in bunfig.toml, and in vscode/, packages/chat-components/ and scripts/mintlify/, because bun reads only the bunfig.toml of the directory it runs in. Frozen installs are unaffected.
  • The lockfile-free install of check-bench-agent takes the same floor, because the check then runs the CLI that it resolved. The versions that package.json pins exactly are exempt: a PR reviewed them, and bun.lock may hold one that is younger than the floor.
  • Mintlify comes from scripts/mintlify/bun.lock instead of bun x mintlify@4.2.680. http-server, ts-prune and @types/semver become devDependencies. The VS Code extension installs with --frozen-lockfile and runs its locked vsce.

Binaries and images

  • shfmt v3.14.1 and hadolint v2.12.0 by sha256 (x86_64 and aarch64). uv through setup-uv with version: "0.12.17", because setup-uv verifies only the uv versions that it knows. Bun 1.4.3 in the Terminal-Bench sandboxes by sha256 instead of bun.sh/install.
  • The zizmor image by digest and its fallback archives by sha256, pinact by sha256, and jsign by sha256 in the signing job, which holds the signing token.
  • The server Dockerfile copies bun from the digest-pinned oven/bun:1.4.3-slim image, as the bug-bash sandbox does.
  • The unused setup-ollama action is deleted (it downloaded the newest Ollama without a check).

Workflows, docs and rules

  • auto-cleanup and auto-cleanup-fixup install @coder/xum@next with npm (--ignore-scripts), which honors its shrinkwrap, instead of bunx. The fixup job also moves from the old mux@next package to @coder/xum@next.
  • The GitHub Actions guide recommends npx @coder/xum, because npm honors the shrinkwrap and bunx does not.
  • AGENTS.md gets a short "Dependencies & Supply Chain" section.
  • .venv (uv's environment at the repository root) and scripts/mintlify/node_modules stay out of shellcheck, hadolint, shfmt and the Docker build context.

Not locked, on purpose

  • node:22-slim in the server Dockerfile floats, so that each release build gets the newest Node 22 security release (22.23.4, a security release, came out on 2026-10-20). A comment in the Dockerfile says so. alpine:latest in the SSH test fixture and the apt packages stay unpinned, as before.

Follow-ups

  • A static check that rejects new unlocked installs (curl | sh, pip install, uvx, bunx of a package outside a lockfile, FROM without a digest).
  • The server updater (src/node/services/serverUpdate/staging.ts) installs the downloaded release tarball with npm, pnpm or bun, and npm and bun ignore the shrinkwrap of a tarball file. So an update resolves the dependencies afresh: it checks each one against the registry's digest, but not against the shrinkwrap.
  • Downloads that are still not verified by us: Playwright browsers, the tree-sitter-language-pack grammars, setup-node's Node patch release.
  • Automated lock and digest bumps (Dependabot or Renovate) with the same 7-day cooldown. With those in place, the Docker base images can be pinned too.

Validation

  • Built the package from this branch, then ran scripts/smoke-test.sh (locked, and with SKIP_SHRINKWRAP=1) and scripts/smoke-test-mux-compat.sh locally. An npm ci --ignore-scripts install, as the auto-cleanup workflows use, runs xum run up to the provider request.
  • With a local fake registry: npx and npm install --prefix install the versions of a package's npm-shrinkwrap.json, and bunx and bun add resolve afresh. The published @coder/xum versions have _hasShrinkwrap: true.
  • Bun 1.4.3: installs from bun.lock keep its versions, while bun add, bun update and lockfile-free installs refuse releases younger than 7 days, exact pins included. A lockfile-free resolve of the production dependencies with the check-bench-agent floor held back 43 packages that an unfloored resolve took, all published 0 to 6 days earlier.
  • For each pinned asset, the sha256 of my own download equals the digest that GitHub computed at upload. hadolint v2.12.0 and jsign 6.0 predate those digests: hadolint matches its .sha256 assets, and the jsign asset has not changed since its upload on 2024-01-17. A wrong checksum stops the zizmor fallback and the jsign step (run with pwsh 7.6.8).
  • The pinned bun install in the Terminal-Bench setup script on glibc and Alpine; docker build of the server image with the copied bun, and its /health answers.
  • make static-check, make lint-eslint, actionlint v1.7.7, zizmor, the uv-based gates in parallel from an empty .venv, make check-docs-links, and the CRAP, DRY and mutation checks.

Risks

The product code does not change (the only src/ change is the regenerated docs snapshot). The risk is in CI and release plumbing:

  • A publish now fails when bun.lock leaves a production edge unresolved or when a registry digest differs from bun.lock's. This is intended, but such a lock blocks the release instead of shipping a fresh resolve.
  • Lock updates lag new releases by a week. An urgent fix needs minimumReleaseAgeExcludes (bun) or exclude-newer-package (uv).
  • PR CI does not run the release-only paths: jsign signing, the VS Code publish, the unlocked smoke test after a publish, and terminal-bench.yml. The local checks above cover them.

- scripts/generate-npm-shrinkwrap.ts projects bun.lock's production tree
  into npm-shrinkwrap.json (registry digests must match bun.lock) instead
  of resolving afresh at publish time.
- Smoke tests install the tarball the way npm installs the published
  package (npm ci with the shrinkwrap nested), since npm ignores the
  shrinkwrap of a tarball file.
- The no-shrinkwrap smoke test moves out of the id-token publish job.
- bun update commander: bun.lock kept 9.5.0 for the root's ^14.0.2.
- pyproject.toml + uv.lock (7-day exclude-newer) replace uvx/--with/pip
  and PEP 723 headers; gates run uv run --locked --only-group.
- setup-uv pinned to uv 0.12.17; shfmt/hadolint by sha256; bun in tbench
  sandboxes by sha256 instead of bun.sh/install.
- bunfig minimumReleaseAge (root, vscode, chat-components, mintlify).
- Mintlify from scripts/mintlify/bun.lock; http-server, ts-prune devDeps.
- auto-cleanup installs @coder/xum@next with npm (shrinkwrap honored).
- vscode: frozen bun install, local vsce.
- zizmor image by digest and its release archives by sha256; pinact,
  jsign (signing job) by sha256. Delete the unused setup-ollama action.
- Dockerfile: bun from the digest-pinned oven/bun image; node:22-slim
  stays floating on purpose (Node security releases).
- Docs recommend npx, which honors npm-shrinkwrap.json (bunx does not).
- Keep .venv and scripts/mintlify/node_modules out of shfmt, shellcheck,
  hadolint and the Docker context.
- Typecheck fixes for generate-npm-shrinkwrap (@types/semver).
- AGENTS.md: Dependencies & Supply Chain rules.
@mintlify

mintlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Mux 🟢 Ready View Preview Oct 22, 2026, 9:41 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T21:45:46.678494Z 1c6e7e7 New commits
🔒 Security Review ✅ Completed 2026-10-22T21:50:13.015212Z 1c6e7e7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 58f03f332b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

27 agent steps · 7 replayed from cache · 32 model calls · 233.1k tokens (72% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 2 steps · 4 calls 25.4s
🟢 a chat survives a restart of the server 2 steps · 4 calls 25.4s
🟢 compaction.e2e.ts · 1 passed 3 steps · 7 calls 47.6s
🟢 /compact replaces the old chat with a summary 3 steps · 7 calls 47.6s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.4s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.4s
🟢 settingsRoundTrip.e2e.ts · 1 passed 3 steps · 5 calls 29.4s
🟢 a chat survives trips through Settings 3 steps · 5 calls 29.4s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 5.0s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 5.0s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 5.8s
🟢 the agent opens the playground workspace 2 steps · 1 call 5.8s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.9s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.9s
🟢 todoNudge.e2e.ts · 1 passed 2 steps · 5 calls 25.3s
🟢 the agent finishes open TODO items after the turn-end nudge 2 steps · 5 calls 25.3s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 21.8s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.7s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.0s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.5s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.2s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.0s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.3s

e2e 0.20.0 · 3m 0s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.1k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 6.4s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 6.4s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.8s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.8s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.1s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.1s

e2e 0.20.0 · 19.3s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 58f03f332b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…-age floor

bun's minimumReleaseAge refuses fresh exact pins too when it resolves without
a lock, so the lockfile-free install failed on @pierre/highlights@0.2.0
(published 2026-10-21). Take the floor and its exceptions from bunfig.toml and
exempt the exact pins of package.json, which a PR reviewed. Correct the
AGENTS.md rule that said bun still installs fresh exact pins.
@ibetitsmike
ibetitsmike added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit b858332 Oct 22, 2026
74 of 77 checks passed
@ibetitsmike
ibetitsmike deleted the mike/lock-dependencies branch October 22, 2026 22:17
azaj01 pushed a commit to azaj01/mux that referenced this pull request Oct 25, 2026
## Summary

Follow-up to coder#7234. Its `uv.lock` locks certifi 2026.7.22, which still
trusts the emSign root whose intermediate CA keys leaked
([GHSA-6q48-6c7w-9gw2](GHSA-6q48-6c7w-9gw2),
critical, Dependabot alert 25). The fixed release, certifi 2026.10.19,
is younger than the 7-day release-age floor. This PR admits it with a
dated `exclude-newer-package` entry and re-locks certifi alone.

## Background

- Dependabot's security update failed: `uv lock --upgrade-package
certifi==2026.10.19` found no such version, because `exclude-newer = "7
days"` hides the release (uploaded 2026-10-20) until 2026-10-27. Before
coder#7234, the unlocked installs would have taken it.
- certifi is only in the `harbor` and `bigquery` groups, through
requests, httpx and httpcore. The Terminal-Bench workflow runs both with
provider API keys and GCP credentials. With a leaked intermediate key,
an attacker on the network path can forge a certificate for those hosts.

## Implementation

- `exclude-newer-package = { certifi = "2026-10-21T00:00:00Z" }` admits
2026.10.19 and no later certifi. `certifi = false` would also admit it,
but an entry that outlives its purpose would then let every later
certifi release skip the floor. A stale date only holds certifi back.
- The entry can go after 2026-10-27, when the floor admits the release.
If it goes earlier, `uv lock` downgrades certifi to 2026.7.22 (tested).

## Validation

- `uv lock --upgrade-package certifi` with uv 0.12.17 (the CI version)
changed only certifi. The new sha256 digests match PyPI's. `uv lock
--check` passes with uv 0.12.17 and 0.12.6. uv has read per-package
dates since 0.8, below `required-version = ">=0.11.8"`.
- In the locked `harbor` and `bigquery` environments, certifi is
2026.10.19 and its `cacert.pem` has no `emSign ECC Root CA - G3`. The
unaffected emSign roots remain.

## Risks

Low. Only the CA bundle of the CI Python tools changes. No product code
and no npm dependency changes.
azaj01 pushed a commit to azaj01/mux that referenced this pull request Oct 25, 2026
…on (coder#7304)

## Summary

A mid-session change to a workspace's AGENTS.md no longer rewrites the
whole cached Anthropic history. Inside a context segment (between
compactions), the instruction-file blocks (`<custom-instructions>` and
the `<model-...>`/`<mode-...>` sections scoped in AGENTS.md) now stay at
the text the segment first sent, and Xum reads that text from the ledger
(chat.jsonl), not from the live files. When the live blocks differ, Xum
sends the new blocks as one system row after the newest user message, so
the model follows the new instructions on that turn. Every later rebuild
puts the row back in the same place, so the next turn's prefix still
matches. The next compaction folds the current block into the system
prompt.

## Background

Measured on one host (10-22 08:12 to 10-23 01:28 UTC, 1,548 Anthropic
turns, a build with coder#7027 and coder#7029): 26 `cache.prefix_break` events in
the system section, 1.45 rewritten histories per 100 turns, the largest
class left. Each break's length change equals a `docs/AGENTS.md` change
on main (+168 chars = coder#7117, +378 = coder#7176, about +1,214 = coder#7234). Agents
merge main into their worktree, and the next turn read the new AGENTS.md
into the stable system prompt. Turn envelopes showed the volatile-tail
length unchanged at every break, so the change was in the stable part.

The history already comes from the ledger. The system prompt did not: it
was rebuilt from live files on every turn (`turnContextAssembler.ts`,
`buildSystemMessageFromSources`). This PR makes the cached instructions
come from the ledger too.

## Implementation

- New `MuxMetadata.customInstructions = { text, placement: "system" |
"row" }` on the turn's assistant row, the same shape and rule as
`volatileSystemTail` (coder#6687). Xum writes it only at a segment start and
when the blocks change, not on every turn.
- `buildSystemMessageFromSources` now returns the system message plus
the exact instruction-file span (the text before it and the blocks). The
assembler freezes that span only while the prompt still starts with the
reported text, so it never parses the final prompt for tags.
- `volatileSystemTail.ts` generalizes its planner to "system sections"
(`planSystemSection`): the volatile tail and the instruction blocks are
two channels with their own field, row header and row id. Instructions
plan first, so their rows come first.
- A segment that starts with no instruction blocks records an empty
baseline, so a first AGENTS.md added later is a row, not a rewrite.
- If every instruction file is deleted or emptied mid-segment, the
frozen blocks stay in the system prompt and a row says the instructions
were removed.
- The row header says the blocks come from Xum, not the user, and
replace the system prompt's blocks. In a live check, Haiku 5.5 ignored a
bare "Update: ..." header in 2 of 3 runs and followed this wording in 4
of 4.
- Same gating as the volatile-tail rows (Anthropic and Coder routes,
models that bind thinking to the prefix). Other routes keep today's
behavior.

## Validation

- Real-request prefix tests (real system prompt and tools): with
AGENTS.md rewritten between turns, the tools section and cached system
block are byte-identical on turns 1 to 3, turns 2 and 3 carry the same
row, and the compaction turn has the new blocks. A `## Mode:` edit, a
removed AGENTS.md and a first AGENTS.md added mid-segment behave the
same way. A `</custom-instructions>` line in later instructions does not
widen the frozen span. Each test fails with its fix reverted.
- `tests/ipc/tokenBudgetStages.fixture.integration.test.ts` grew the
prompt by rewriting AGENTS.md. With this PR the request really carries
both the old and the new block, so the larger estimate is correct. The
fixture now grows the prompt through the workspace scratchpad, which
stays live; its expected numbers are unchanged.
- Live check on direct Anthropic (under $0.50): with a 17.2k-token block
changed between turns, turn 2 read 17,167 tokens from the cache and
wrote only the 17,182-token row; turns 3 and 4 read from the cache.

## Risks

Medium. It changes how the system prompt is assembled for Anthropic
turns.
- **Context cost:** while a changed block is live, each request carries
the old blocks in the cached system prompt plus the full new blocks in
the row. For this repo's AGENTS.md plus a global `~/.xum/AGENTS.md` that
is about 10.8k extra tokens until the next compaction. They are written
to the cache once and read after that.
- `Tool: <name>` sections from AGENTS.md go into tool descriptions and
are not frozen here: an edit to one still rewrites the cached tool block
(follow-up).
- Old histories (no record) behave as before: the first turn sends the
live block and records it. A malformed record is ignored. An older build
ignores the field.
- A follow-up PR applies the same rule to the `agent_skill_read` skill
list.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$585.33`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=585.33 -->
azaj01 pushed a commit to azaj01/mux that referenced this pull request Oct 25, 2026
…hrinkwrap pins (coder#7346)

## Summary

A server self-update now installs the dependency versions that the
release's `npm-shrinkwrap.json` pins, instead of resolving every
dependency range again at update time. After the install, every staged
dependency must be one of those pins (version and digest), and its
digest must still match the one the registry publishes. A release whose
shrinkwrap does not pin every dependency by version and digest is
refused.

## Background

coder#7234 made the published `@coder/xum` ship a shrinkwrap projected from
`bun.lock`, so registry installs (`npm install -g @coder/xum`, `npx`)
get the tree that the release's CI tested. The server updater did not
get it. It downloads the release tarball, checks the tarball digest, and
then runs `npm install <tgz>`, `bun add <tgz>` or `pnpm add <tgz>`. None
of the three managers reads the shrinkwrap inside a tarball file, so
each update resolved all dependencies afresh. A dependency release
published an hour before the update would be installed, the way a
compromised litellm release reached CI (coder#7227). The registry digest
check after the install only proved that the bytes came from the
registry, not that they were the tested versions.

This also fixes a bug on main: bun 1.4 writes the staged tarball's
`bun.lock` entry as `[spec, meta, sri]` (bun 1.2 writes `[spec, meta]`).
The lockfile parser rejected that shape, so a bun 1.4 install could not
self-update.

## Implementation

- The staging directory gets a `package.json` that depends on
`file:<absolute tarball path>` and a `package-lock.json` that nests the
release's shrinkwrap under `node_modules/@coder/xum`. That is the layout
npm gives a registry install of a package that ships a shrinkwrap.
`scripts/generate-npm-shrinkwrap.ts --tarball-install` builds the same
layout for the smoke tests, so both now share `nestShrinkwrap` (the
generator's output is byte-identical).
- npm installs the lockfile with `npm ci`. bun writes bun.lock from it
with `bun pm migrate`, then runs `bun install --frozen-lockfile`; since
bun 1.4.4 a frozen install migrates in memory only and writes no
lockfile to verify. pnpm runs `pnpm import`, then `pnpm install
--frozen-lockfile`. bun and pnpm delete the seed afterwards, so the next
update still finds exactly one lockfile. `pnpm import` accepts neither
`--registry` nor `--ignore-scripts`, so it gets `--config.registry` and
runs no scripts.
- The shrinkwrap is read from the verified tarball with `tar -xzOf`,
with `TAR_OPTIONS` unset, because GNU tar takes options (including a
decompression program) from it.
- `verifyStagedDependencies` takes the pins and checks each staged
registry package against them before the existing registry anchoring.
Every digest that the lockfile records must be pinned, because a manager
accepts a tarball that matches any recorded digest.
- The seed moves each tarball URL that the shrinkwrap records on the
public registry to the same path under the configured registry, as npm's
default `replace-registry-host` does. bun, and npm with
`replace-registry-host=never`, fetch a recorded URL as written, so the
update would otherwise bypass a private registry.
- The tarball path is absolute because bun records a relative `file:`
path without the prefix that marks it as local.

## Validation

- Staged the real nightly `0.31.0-next.33.g5d7c31cad` from
registry.npmjs.org through `stageUpdate` with bun 1.4.4, bun 1.4.3, bun
1.2.15, npm 10.9.3 and pnpm 10.33.2 (15 to 18 s each). The staged CLI
ran `--version`, layout detection on the staged directory found the same
manager, and each staged bun.lock held exactly the shrinkwrap's 798
packages. An earlier run on `0.31.0-next.28.ga3cc8ea39` also matched
pnpm's lockfile and npm's tree to the shrinkwrap. Without the `bun pm
migrate` step, bun 1.4.4 installs and writes no bun.lock.
- Staging the current Stable, `0.31.0`, is refused: its shrinkwrap was
generated by npm at publish time, and 2067 of its 2298 entries have no
digest.
- A tampered tarball whose shrinkwrap lacks `@ai-sdk/google`: npm and
pnpm refuse it; bun stages without that package (see Risks).
- Main's flow (`bun add <tgz>`) with bun 1.4.3 ends the `@coder/xum`
entry with the tarball's digest (bun 1.2.15 does not), which main's
parser rejects with a zod `invalid_union` error. Reverting the tuple
change fails the new bun 1.4 test case.
- Seeded a one-dependency lockfile and installed with `--registry
https://registry.npmmirror.com`. With the public URL, npm under
`replace-registry-host=never` and bun 1.2.15 and 1.4.3 under default
settings fetched from registry.npmjs.org. With the moved URL, all of
them fetched only from the mirror. Leaving out `resolved` instead fails
on bun 1.2.15.
- `make mutate-check`: 31 of 35 mutants killed. The survivors are the
`private: true` and `requires: true` literals in the stage's two files
and two mutants on lines this PR does not change (the stage-prune filter
and the verifier's early stop).

## Risks

- Updates fail closed. Stable releases up to 0.31.0 carry an
npm-generated shrinkwrap without most digests, so a server that runs
this code cannot install them, for example after switching to the Stable
channel. Nightlies published since coder#7234 merged carry the new
shrinkwrap, and the next Stable will too. The docs say so.
- bun leaves out a dependency that the seeded lockfile lacks instead of
failing, so the staged tree would miss that package. A published
shrinkwrap cannot lack one: the tarball must match the registry's
digest, and the publish workflow's generator fails when `bun.lock`
leaves an edge of the production tree missing.
- Self-update now needs `tar` on the `PATH`, and a private registry must
serve dependency tarballs at npm's standard paths
(`<registry>/<package>/-/<file>.tgz`), as npm already assumes when it
replaces a lockfile's registry host. Both are documented.
- Deployed servers stage new releases with their own, older staging
code, so this changes nothing until a server runs a build that contains
it.
@linear-code

linear-code Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

This branch was successfully deployed

1 active deployment
staging - docs — 1c6e7e7a Deployed Oct 22, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant