Repository navigation
fix: warm the Solid plugin before the release bundle and retry a failed build once - #1823
Conversation
…ed build once Babel's lazy requires on the JS thread raced Bun 1.3.14's unlocked resolver cache inside `Bun.build`, so a target could read `@babel/traverse` as a file (EISDIR). Warm it first; `release.yml` retries a failed build once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmKQv6E2XpAgL5eJE8RYi
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Investigation notesWhere it breaks. Both failures read the same path: the Why Babel is in both places. The Bun code. In 1.3.14 the directory-entry cache ( Repro. Fixtures of N files each importing M symlinked packages with no exports map (default 400 × 40):
The real-shaped bundle (the opencode entrypoints with the Solid plugin, no compile, no fix) passed 200 of 200 fresh runs here. That fits what CI shows: since 2026-09-21, 2 failures in 80 release legs, and none in the last 100 main-branch runs of the What the warm-up changes. strace on
The warm-up build itself resolves nothing on the bundle thread (all imports external, entry in a tmpdir). So Babel's first transform runs in a build that has no store directories to race over. Output. I compared the unminified bundle with and without the warm-up. 8 of 11 warm runs were byte-identical to every cold run. The other 3 differ only by a consistent renaming of 26 local identifiers in index.js and 22 in worker.js, with the same token count, the same non-identifier text and a one-to-one name mapping. The likely cause: with Babel warm, plugin results interleave with native parses, so Bun's renamer numbers symbols in a different order. Retry. Simulated the step under |
Codex review logClaims (each falsifiable by a concrete trace):
Disclosed residuals (accepted, not findings):
Rounds
Other reviewers on 050a289 (after the ready flip):
|
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Note: the retry's interaction with the build job's unchanged Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by deepseek-v4.1-flash-1017 · Input: 85.2K · Output: 18.9K · Cached: 993.8K Review guidance: REVIEW.md from base branch |
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus review: APPROVE. Panel: Claude (lead) and Codex (independent read-only pass, then a cross-check). Neither found anything above a nit.
What I checked by running it (Bun 1.3.14, the version release.yml pins):
-
Release binary unchanged. The per-target
Bun.buildcall (options, plugins, defines, entrypoints) is byte-identical to the base. I built the unminified linux-x64 bundle three times at base and three times at head. All 9 base/head pairs are byte-identical, and so is a fulldist/comparison that includes the parser worker. I saw no identifier renaming locally. The compiled darwin-arm64 binaries differ only by the checkout path baked into__dirname, the sourcemapdebugIds and the code signature. Both print the same--version, and their--helpoutput is identical. -
Warm-up.
mkdtempSyncunderos.tmpdir()is removed infinallyboth when the warm-up succeeds and when it fails. Nothing is written under the repo. The Solid plugin has onlyonLoadhooks, soexternal: ["*"]covers every import. The JSX is compiled to@opentui/solidimports, so Babel's Solid preset really runs. A syntax error, a throwingonLoadand a missing entry all makeBun.buildreject. Breaking the warm-up in the realbuild.tsmakes it exit 1 before any target is built, and leaves no tmpdir behind. -
Mechanism. I hooked
requireresolution during eachBun.build. At base, the main bundle triggers 38 JS-threadnode_moduleslookups (@babel/helper-compilation-targets,browserslist,caniuse-lite, ...). At head, the main bundle triggers 0 and all 38 happen in the warm-up. I ran a synthetic fixture (400 files × 40 symlinked packages with no exports map, 5 processes × 20 builds) inoven/bun:1.3.14on Linux:- With a plugin resolving those packages on the JS thread in every build: 32 of 100 builds hit EISDIR.
- Same plugin with the lookups done once before the builds (the warm-up's shape): 0 of 100.
- Without the plugin: 0 of 100.
- Same racing plugin on Bun 1.4.5: 0 of 100.
On macOS arm64 the race never fired (0 of 500). In the source, 1.3.14's
Entry.kindclearsneed_statbefore it writes the stat result, and takes no lock. 1.4.5 checks the flag again under the entry's mutex and clears it only after the write. -
Retry. I ran the step under
bash --noprofile --norc -eo pipefailwith a stubbun. It exits 0 exactly when one attempt exits 0. This holds when attempt 2 exits 0 after printing to stderr, and when attempt 1 dies by SIGKILL or SIGSEGV. Each attempt is a separate process, and attempt 1's failure prints the::warning::.rm -rf distsits insidebuild.ts, so every attempt clearsdistbefore building. The upload step has noif:, so it still needs the build step to succeed. The matrix, env, permissions and secrets are unchanged, and all 8 legs run onubuntu-latest. -
Timing. I looked at the build legs of the last six release runs. The build step took 12–26 s and the job 59–109 s. The two failed legs died 3 s and 9 s into the step. A second attempt fits easily in the 15-minute job timeout. Locally, head builds take the same time as base (about 8 s).
-
Suites at head.
bun run typecheck: pass. Marker guard: pass. By hand, every added line inbuild.tsandrelease.ymlsits insidealtimate_changemarkers.test/branding/,test/install/and the build-related tests: 570 pass, 0 fail, the same as base.bun run pre-release: 4/4 checks pass. The ci.yml sanity build settings (--target-index=1, fixture catalog): pass.
Remaining items, none blocking (details in the PR comment):
- The warning doesn't show the exit code: cosmetic.
- The warm-up should go when the build moves to Bun 1.4: safe as a follow-up. Upstream opencode moved from 1.3.14 to 1.4.0 on 2026-08-31 and has no warm-up.
- A build that hangs instead of failing gets no second attempt within the job timeout: edge case, and the exposure to hangs predates this PR.
- Disclosed by the author: identifier renaming, a retry of deterministic failures, no retry in
ci.yml. These are cosmetic, or safe to handle in a follow-up.
|
Nits and follow-ups from the consensus review (Claude + Codex). None of them blocks the merge.
|
🤖 Code Review — OpenCodeReview (Gemini) — No Issues FoundNo supported files changed. |
Issue for this PR
Closes #1694
Type of change
What does this PR do?
The EISDIR on
@babel/traverseis a race in Bun 1.3.14's resolver, not thebun installcalls in build.ts (those finish beforeBun.buildstarts). The binary bundles @babel/core, so the bundle thread resolves Babel's packages from the symlinked store, while the Solid plugin's Babel lazily requires the same packages on the JS thread. Bun caches whether each symlink is a file or a directory without a lock, so the losing side can read a package directory as a file. Bun 1.4 locks that lookup.How did you verify your code works?
Investigation notes: #1823 (comment). Claims and Codex review log: #1823 (comment).
Cost side effects
None.
Screenshots / recordings
Not a UI change.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01VEmKQv6E2XpAgL5eJE8RYi
Summary by CodeRabbit