Repository navigation
🤖 ci: install every dependency from a lockfile or a checksum - #7234
Conversation
- 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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
🟢 e2e stories (Haiku): 14 passed27 agent steps · 7 replayed from cache · 32 model calls · 233.1k tokens (72% cached) All 14 tests in 9 files
e2e 0.20.0 · 3m 0s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.1k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 19.3s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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.
## 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.
…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 -->
…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.
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 harborin Static Checks resolved the compromised litellm 1.107.0 on the day of its upload. The same pattern was in many other places:uvx,uv run --with,pip install,bunx/npxof packages outside the lockfile,bun x mintlify@<version>;install.sh, shfmt from webinstall.dev,bun.sh/install;npm-shrinkwrap.json, whichnpm install --package-lock-onlyresolved 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.tsreplaces 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.--tarball-installplusnpm 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, withcontents: readand 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
pyproject.tomlwith dependency groups (test,crap,dry,mutate,harbor,bigquery,ruff) and itsuv.lockreplace the PEP 723 headers,uvx,uv run --withandpip install. Every caller runsuv 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 = 604800inbunfig.toml, and invscode/,packages/chat-components/andscripts/mintlify/, because bun reads only the bunfig.toml of the directory it runs in. Frozen installs are unaffected.check-bench-agenttakes 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.scripts/mintlify/bun.lockinstead ofbun x mintlify@4.2.680.http-server,ts-pruneand@types/semverbecome devDependencies. The VS Code extension installs with--frozen-lockfileand runs its locked vsce.Binaries and images
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 ofbun.sh/install.oven/bun:1.4.3-slimimage, as the bug-bash sandbox does.setup-ollamaaction is deleted (it downloaded the newest Ollama without a check).Workflows, docs and rules
@coder/xum@nextwith npm (--ignore-scripts), which honors its shrinkwrap, instead ofbunx. The fixup job also moves from the oldmux@nextpackage to@coder/xum@next.npx @coder/xum, because npm honors the shrinkwrap and bunx does not..venv(uv's environment at the repository root) andscripts/mintlify/node_modulesstay out of shellcheck, hadolint, shfmt and the Docker build context.Not locked, on purpose
node:22-slimin 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:latestin the SSH test fixture and the apt packages stay unpinned, as before.Follow-ups
curl | sh,pip install,uvx,bunxof a package outside a lockfile,FROMwithout a digest).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.Validation
scripts/smoke-test.sh(locked, and withSKIP_SHRINKWRAP=1) andscripts/smoke-test-mux-compat.shlocally. Annpm ci --ignore-scriptsinstall, as the auto-cleanup workflows use, runsxum runup to the provider request.npxandnpm install --prefixinstall the versions of a package's npm-shrinkwrap.json, andbunxandbun addresolve afresh. The published@coder/xumversions have_hasShrinkwrap: true.bun add,bun updateand lockfile-free installs refuse releases younger than 7 days, exact pins included. A lockfile-free resolve of the production dependencies with thecheck-bench-agentfloor held back 43 packages that an unfloored resolve took, all published 0 to 6 days earlier..sha256assets, 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).docker buildof the server image with the copied bun, and its/healthanswers.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:minimumReleaseAgeExcludes(bun) orexclude-newer-package(uv).