Repository navigation
feat(server): production runs on Bun - #1123
Conversation
|
Reviewed No blocking findings. Verdict: ship, once the remaining required checks pass. I traced both promotion and rollback through the workflow, release record, exact task-definition revisions, provider and fleet controller. New hosts preserve each definition's runtime; a rolled-back Node host's retained Evidence checked:
Nonblocking evidence correction: the PR body's AVX2 caveat is inaccurate for the pin at Coverage limits: the committed image smoke promotes two revisions of one Bun image using the local provider, not a mixed-runtime ECS fleet. Its rollback result alone does not establish Node compatibility; that conclusion also relies on the command/definition trace and the legacy-command check above. No production services were accessed. I found no newly exposed infrastructure identifiers or secrets in the diff or PR body. Applicable mirrored surfaces were production launch/deploy, test harnesses and operating docs; this change introduces no wire contract, migration or CLI contract change. |
Acceptance: PASS with notesChecked The hands-on journeys began at Done means
Golden journeys All five requested journeys passed against a separately started built
Focused local commands and resultsRollback answers: They match the diff and the independent review's trace. There is no migration, changed wire contract or newly shaped persisted data. Retained images and task definitions name their own runtime; the provider preserves that command, deployment uses the selected image's fleet command, and the Bun image's Node fallback accepts an old host's exec override. The Docker image smoke proves that fallback and same-image promotion; the rollback rehearsal separately proves retained data across Node/Bun. I did not independently run a mixed-runtime ECS fleet. No Not run
Notes
Signed: gpt-6.1-sol, Codex harness, T3 Code. |
7f0338a to
b369615
Compare
d000db1 to
6dce0b4
Compare
The host, the company exec tasks and fleet promotion run on Bun 1.4.4, the version the root package.json pins; the CLI stays on Node. - The image runs on oven/bun:1.4.4-slim, pinned by digest. The build refuses a runner of another version, or one whose bun isn't the lockfile's binary. - Each release's task definitions name its runtime: the host's ECS provider no longer overrides exec tasks with `node dist/exec.js`, and the deploy promotes with the fleet command the image records. In the Bun image `node` falls back to Bun, so an older host still starts this release's exec tasks. - CI tests what production runs: `test (bun)` runs the offline suite on Bun, minus the Node-only files vitest.bun.config.ts names. Every lane's server runs on Bun, and the `image` job runs the built image (scripts/server-image-smoke.mjs). The rollback rehearsal runs each build on its own runtime. - A credential sealed on Bun opens on Node, as a fixture every Node lane runs. Closes #1040 Co-authored-by: Claude Opus 5.5 <[email protected]>
docker top refuses -o fields without pid ("Couldn't find PID field in ps
output"), so the first identity check failed after host a was already
healthy. Every row now starts with the pid.
Co-authored-by: Claude Opus 5.5 <[email protected]>
…ns on Node main.test.ts runs `pnpm dev` as the root script names it, `node --import tsx`. Under `pnpm test:bun` in CI that `node` is Bun, which couldn't resolve the runner's workspace imports (test (bun) on 04fe659). Co-authored-by: Claude Opus 5.5 <[email protected]>
b369615 to
5fbd126
Compare
## What changed `pnpm dev` ran its runner, supervisor and dev server on Node with the tsx loader. That was slow to start, and it doesn't match production once the server moves to Bun. Now the runner, supervisor and dev server run on the Bun that `package.json` pins. `pnpm check`/`verify`, the Clerk live launcher, `seed:dev` and the Pidgeon sweep run on it too. The CLI still runs on Node, as it does on people's machines. Part of #1040. Stacked on #1123, #1122 and #1120, which have merged. Merge it after #1123: its parity with production's server only holds once production runs on Bun. #1123 also settles the rollback rehearsal: each checkout's server runs on whatever that commit's own start script names. ## Look at **The split lives in one place, `scripts/dev/src/runtimes.ts`.** The runner used `process.execPath` to start the server, the release builds, the environment's `bin/node`, the pinned CLI for scenario publishes, and the workspace's `mise.toml` pin. Under Bun, every one of those would have quietly become Bun. Now: - `bun` starts the supervisor and the server. - `realNode()` serves everything else. It asks the first `node` on `PATH` for its own binary and version, and refuses one that turns out to be Bun. The guest-share step that main added to `pnpm dev up` while this PR was open is covered too. It runs the pinned CLI on the environment's `bin/node`, like the refresh and publish steps beside it. `runtimes.test.ts` covers both cases. Bun answering to the name `node` shows why the version has to come from real Node: ``` $ ln -s node_modules/.bin/bun /tmp/x/node && PATH=/tmp/x:$PATH node -e '…' {"execPath":"…/node_modules/.pnpm/bun@runtime+1.4.4/node_modules/bun/bun","version":"26.3.0","bun":"1.4.4"} ``` Under Bun, `process.versions.node` says `26.3.0`. The old code would have pinned the agent workspace's `mise.toml` to a Node that isn't installed. **Which runtime runs what**, on this branch's `pnpm dev up brightline`: ``` supervisor exe=node_modules/.pnpm/bun@runtime+1.4.4/node_modules/bun/bun --conditions=development scripts/dev/src/main.ts supervise server exe=node_modules/.pnpm/bun@runtime+1.4.4/node_modules/bun/bun --conditions=development apps/server/src/start.ts ``` `process.versions` from inside the environment's `bin/patchy` (a preload via `NODE_OPTIONS`, during `patchy whoami --json`): ``` inside bin/patchy: {"execPath":"<mise>/node/24.20.0/bin/node","node":"24.20.0","bun":null} ``` The workspace's `mise.toml` pins `node = "24.20.0"`, and `bin/node` links to that same binary. **Startup, before and after**, as medians on this machine. It's a shared box: the launcher and runner rows were measured interleaved under the same load. The `pnpm dev` row ran under higher load after the change (load average about 25, against about 7 for the baseline), which favours the baseline. | | Node + tsx | Bun | |---|---|---| | `pnpm check`'s launcher (`scripts/verify.ts`, to its usage line) | 127–131 ms | 15–16 ms | | The runner alone (`pnpm dev --dry-run --json`) | 1.39–1.63 s | 0.61–0.75 s | | `pnpm dev` to ready, existing state dir, release build cached | 16.9–17.7 s | 8.1–8.5 s | | … of which, to the supervisor's first line | 9.0–10.1 s | 3.5–4.1 s | | … of which, server start to `/healthz` | 6.5–7.0 s | 3.7–3.8 s | **On #1123's `test (bun)` lane**, the dev runner's two tests (`main.test.ts` and `runtimes.test.ts`) are in `vitest.bun.config.ts`'s Node-only list. They need a real `node` first on PATH, as on a person's machine, and the runner refuses a `node` that is Bun, which is the point of `realNode()`. Under `bun --bun`, the `node` on PATH is Bun's shim. The Node lanes run both tests with `pnpm dev` itself on Bun, so the Bun runner is still covered. ## How it was verified - On this machine, with this branch: - `pnpm dev`, `stop`, `status`, `logs` and `mcp-token`. - `pnpm dev up team`, then `pnpm dev shot ada /`: 200, no browser errors. - `pnpm dev down`, then `pnpm dev up brightline` from a wiped state. Its three repos were built, refreshed and published by the pinned CLI on `bin/node`, and sample data loaded through Playwright, which now runs in-process on Bun. - `pnpm dev shot jordan /brightline/kudos`: the tier 2 patch rendered its sample data for a member, with no browser errors and no server error lines in `dev.log`. - `pnpm dev stop` left no supervisor, server or Postgres pid behind. - `pnpm dev down` at the end. - `pnpm check` now launches from Bun; vitest itself still runs on Node. Locally, format, lint, typecheck and synth pass. `pnpm exec vitest run scripts/dev` passes: 15 files, 94 tests. - `test` failed locally on this shared machine: - CLI stub-server tests in `packages/patchy`, `LocalTaskProvider.test.ts` and one PGlite timeout. The CLI and LocalTaskProvider stubs received stray requests: local port probes, which CI doesn't have. - A different set fails on each run: 17 tests, then 12. - `origin/bun/fmt` without this commit fails the same way: 9 tests, the same kind of failures. - None of those files import anything this PR touches. CI is the gate for the full suite. - The moved scripts were each run on Bun offline: - `scripts/verify.ts` printed its usage. - `test:pidgeon:sweep` without a key: "nothing to sweep". - `test:clerk` with bad arguments loads its imports and refuses the arguments. - Bun keeps `detached` children in their own process group and signals the group, which the Clerk launcher relies on. - **Not run:** - `test:clerk` against Clerk and `test:pidgeon:sweep` with a key, because both touch live accounts. CI's `clerk-live` and `pidgeon-live` jobs exercise them. - `seed:dev` against an instance. - `pnpm dev compare`, `film`, `transcript` and `trial`. They spawn the same runner on evidence clones, and `transcript` and `trial` share the environment code exercised above. **Stays on Node:** - `pnpm patchy`, the CLI from source. - vitest's runner. - `pnpm test:browser`. - The release and broker builds the runner starts. - `test:rollback-rehearsal`. It runs people's CLI and an SDK probe with Node-only flags (`--input-type=module -e`) through `process.execPath`. It also starts each commit's server the way that commit's production would, so which runtime it uses belongs with `bun/runtime`. `tsx` stays a devDependency for these and for `render-docs` and the infra synth. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Dev tooling only: the dev runner, repo scripts and their docs. Nothing in the CLI, the API, the schema or production changes. - **What does a revert leave behind?** Nothing persistent. A dev instance started on Bun keeps running until `pnpm dev stop`, which stops it by pid whichever runtime started it. Environment folders and state dirs keep the same shape. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (xhigh effort) in T3 Code, via Claude Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
## What changed This adds release 34's What's new entry, written from `e5334ca`. It covers everything merged since release 33's `through` (`d5a7862`), and sets the `patchy` release to `0.34.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Behind the scenes: Patchy's servers moved to a faster JavaScript runtime, Bun, so each one uses less memory and handles more requests | #1123 | There's no announced change. Nobody using Patchy does anything differently, and the speed and memory gains were measured on our own machines, not yet in production. #1120 (the formatter), #1122 (a test) and #1121 (the local dev loop) are tooling and test changes, so they get no line. #1148 is release 33's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `fb2264f` (release 33) to `e5334ca`:** - #1120, #1122 and #1121 change dev tooling, a test and docs. Nothing that runs in production changes. - #1123 moves the server image and its task commands from Node to Bun. There's no migration, and rows are written by the same code on either runtime. Credentials sealed on Bun open on Node: a fixture checks that on every Node lane. A rollback runs release 33's own task definitions and promotes with its own `node dist/fleet.js`. While release 33's hosts still refill this release's spares, they start them with `node dist/exec.js`, and the Bun image runs that on Bun. CI's `rollback-rehearsal` passed against release 33 on #1123's merged head. Not `one-way`. - If a Bun host can't start, for example because it can't reach the database, the server fails before it listens. ECS's circuit breaker then rolls the service back before anything is promoted. **Rollback line:** If this release misbehaves, roll back to `fb2264f` (release 33). ## How it was verified - **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and `schemas.test.ts` pass (25 tests), and `bun fmt` passes on the changed files. - **The range.** Each PR had a GPT 6.1 Sol review with every finding resolved, and acceptance gave PASS with notes. #1121 was re-accepted at its rebased head. Each PR landed with all 12 required checks green, and `test (bun)` and `image` green too. - **Deploy state.** The live commit, pinned from `/healthz/deep`, is `fb2264f` (release 33). The Deploy run updated last succeeded, and none is unfinished. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Text and version numbers only. The `0.34.0` bump tells CLIs and patch repos installed before this deploy to upgrade, as every release does. - **What does a revert leave behind?** Nothing. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
The server, its company exec tasks and fleet promotion now run on Bun 1.4.4 in production, the version the root
package.jsonpins. People notice nothing: patch code still runs in workerd and the CLI stays on Node. CI now tests what production runs: the offline suite on Bun, every CI lane's server on Bun, and the built image itself.Closes #1040
Stacked on #1122 (
bun/seams), which sits on #1120 (bun/fmt). #1122 fixes the stale-stop Supervisor test that failed only on Bun. This PR'stest (bun)runs it, and every other server test, without skipping.Look at
1. How Bun gets into the image. The runner stage is
oven/bun:1.4.4-slim, pinned by digest. Itsbunis byte-identical to the binarypnpm-lock.yamlpins (sha25610702245…), which is the one CI's tests run on.scripts/build-server-image.mjsrefuses a runner whose tag names another version than"bun": "runtime:<version>", or whose binary isn't the lockfile's. Users stay as #1040 describes: the image'sbunuser is uid 1000 for hosts, and exec tasks run as root and drop each workerd to its own uid. Node 24 stays as the builder stage.2. Rolling back across the runtime change. Three places hardcoded
node, and each would have broken a deploy or a rollback:node dist/exec.jsdeploy.ymlpromoted withnode dist/fleet.jsfleetCommandthe image build recorded (present since #521), so a rollback to a Node release promotes withnodenode dist/exec.jsnodefalls back to Bun (the base image'sbun-node-fallback-bin), so a rolled-back Node host still starts this release's sparesA scratch run (not in the repo) of a mixed fleet on one TLS+SCRAM database:
main, host B on the Bun image, sharing tasks;bun dist/fleet.js promotepromoted B;node dist/fleet.js promoterolled back to A;3. The two images, built locally and booted the same way. Each image's rootfs ran under bwrap as uid 1000, with the server as PID 1, against a local Postgres that takes only TLS (verify-full, scratch CA) and SCRAM. The machine was shared and loaded, so treat the numbers as relative.
main)/healthz200, median of 74. Which runtime each commit's server runs on in the rollback rehearsal. The rehearsal harness stays on Node, as #1121 left it. Each checkout's server runs on the runtime its own
apps/server/package.jsonstartscript names: the same file that says how that commit runs,node dist/start.jsbefore this PR andbun dist/start.jsfrom it. So this PR rehearses live (Node) → this PR (Bun) → live (Node) → this PR (Bun); once a Bun release is live it is Bun throughout. Reading it from each checkout, not from the harness, keeps a later rehearsal across this PR honest in either direction.How it was verified
CI, new or changed:
test (bun)runspnpm test:bun: the offline suite underbun --bun vitest.vitest.bun.config.tsnames the 15 Node-only files and says why: 13 CLI process and dev-loop tests,packages/sdk/src/install.test.tsandlint/rules.test.ts.test (22),test (24)andtest (26)are unchanged and still run every file. Nothing else is skipped: test(execution): a stale task-wide stop test no longer depends on I/O timing #1122 fixed the one real Bun-only failure, and the other (RequestEvents) was a local port probe that CI doesn't have.image(server-image.yml) now loads the built image and runsscripts/server-image-smoke.mjswith Docker:bun dist/fleet.js promotepromotes the staged revision, then rolls back;nodein the image runs Bun 1.4.4.browser(tier 1 and 2 pages),cli-smoke,tier2-smokeandclerk-live(live Clerk) now start their server on the pinned Bun; the CLI stays on Node.rollback-rehearsalstarts each build's server on the runtime itsapps/server/package.jsonstart script names, so this PR rehearses live (Node) → this PR (Bun) → live (Node) → this PR. It runs here because the rehearsal script changed.NodeCryptography.test.tsgains a credential and an agent retry copy sealed on Bun 1.4.4. Node's lanes open them, which is the rollback direction; the Bun lane opens the Node-sealed fixtures already there.Locally:
pnpm lint,pnpm typecheck, infra tests,EcsTaskProvider.test.ts, and the crypto fixtures on both runtimes.pnpm test:packed-tier2-e2ewith the server on Bun: PASS (packed init, both dev mounts, publish, two-viewer sync, keyed retry, sharing, files, members, CSV).browserlane with the server on Bun: 53 tests passed acrosstier1,stream,server-subscriptionsandstarting(local fleet, idle release, host restart, HTTP/2 ingress). Onetier1test failed only on a strayGET /to its foreign-origin harness port. That's T3 Code's local port probe, which CI doesn't have, and that server is the harness's own, on Node.@aws-sdk/client-ecsagainst a loopback endpoint on Bun: SigV4-signed, and the response parsed, the same as on Node. The S3 client already runs on Bun in the content-store contract tests.node dist/exec.js, the process is/usr/local/bin/bun.Shown only in production:
oven/bun:1.4.4-slimimage ships thex64-baselinebinary, byte-identical to pnpm's pin. That was checked in review against Bun's v1.4.4 slim Dockerfile.BunHttpServerstays a separate, measured follow-up (Bun.servecloses silent connections after 10 s unless streams setidleTimeout: 0). The server keeps@effect/platform-nodethrough node:http compat, as the 2026-10-28 trial ran it.Release impact
The runtime under the server changes; nothing anyone runs or calls does. The CLI, the API and the schema are unchanged.
bun dist/exec.js.node dist/fleet.js. While its hosts still replenish this release's spares, they start them withnode dist/exec.js, which the Bun image runs on Bun. The rollback rehearsal and the mixed-fleet run above exercise that path. Notone-way.Built by Claude Opus 5.5 (xhigh effort) in T3 Code, via Claude Code.