Skip to content

chore(cli): update Bun to 1.4.0 - #13409

Merged
marius-kilocode merged 3 commits into
mainfrom
update-bun-to-latest
Aug 25, 2026
Merged

chore(cli): update Bun to 1.4.0#13409
marius-kilocode merged 3 commits into
mainfrom
update-bun-to-latest

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Bun 1.3.14 forced the compiled CLI release build to disable code splitting because Bun generated invalid cross-chunk re-exports. The workaround duplicated shared modules across CLI entry points and prevented the release build from using Bun's newer compiler improvements.

The Bun 1.4.0 upgrade removes that limitation and keeps local, CI, and release builds on one supported runtime.

Why This Change Was Made

  • Pin the repository, CI setup, Nix package, container image, documentation, and upstream-merge metadata to stable Bun 1.4.0.
  • Enable splitting: true for compiled CLI targets.
  • Keep the published CLI binaries, Docker image, and VS Code extension on the same compiled Bun 1.4.0 artifacts.
  • Add narrow compatibility handling for Bun 1.4.0 FFI pointer types, process event types, and rejected SSE reader cancellations.

User Impact

Artifact or workflow Before After Impact
Compiled CLI build Bun 1.3.14, splitting disabled Bun 1.4.0, splitting enabled Faster build and smaller binary
Published CLI binaries Older Bun runtime and duplicated chunks Bun 1.4.0 runtime with shared chunks Smaller release downloads
VS Code extension Bundled CLI built with the old path Bundled CLI built from the Bun 1.4.0 release artifacts Same CLI improvement in VSIX packages
bun dev Uses the active Bun executable Uses the active Bun executable Source development is unchanged, but Bun 1.4.0 is the supported runtime

Evidence

Measurements use the same macOS ARM64 worktree and cached build inputs. The baseline uses Bun 1.3.14 with the required workaround; the updated build uses Bun 1.4.0 with code splitting enabled.

Metric Bun 1.3.14 Bun 1.4.0 Change
Cached compiled CLI build 10.88 s 8.59 s 21.0% faster
CLI binary size 188,755,682 bytes 146,123,762 bytes 22.6% smaller
WebSocket test median, 3 runs 3.43 s 3.36 s 2.0% faster, within noise

The first CI run exposed a Bun 1.4.0 stream-cancellation difference in provider/header-timeout.test.ts. The fix handles the rejected reader.cancel() promise in both SSE wrappers while preserving the timeout and abort behavior. After that fix and a merge from main, all required Linux, macOS, and Windows CI checks passed.

The published PR also includes the required Bun 1.4.0 FFI and process-type compatibility shims, plus the coordinated package quarantine exception for the newly released Bun type packages.

@kilo-code-bot

kilo-code-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • .changeset/update-bun-1-4.md
  • CONTRIBUTING.md
  • bun.lock
  • bunfig.toml
  • nix/bun.nix
  • package.json
  • packages/containers/bun-node/Dockerfile
  • packages/kilo-docs/pages/contributing/development-environment.md
  • packages/kilo-vscode/docs/mercury-next-edit-testing.html
  • packages/opencode/script/build.ts
  • packages/opencode/src/bun-compat.d.ts
  • patches/@ff-labs%2Ffff-bun@0.9.4.patch
  • script/upstream/package.json

Reviewed by grok-4.6 · Input: 90.5K · Output: 20.9K · Cached: 663.7K

Review guidance: REVIEW.md from base branch main

@iscekic iscekic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, bot remarks below, feel free to ignore

Comment thread packages/opencode/src/provider/provider.ts
@marius-kilocode
marius-kilocode merged commit f2da2ee into main Aug 25, 2026
35 checks passed
@marius-kilocode
marius-kilocode deleted the update-bun-to-latest branch August 25, 2026 12:05
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.

2 participants