Bun’s Rust Port and the Dispute with Zig’s Creator

Theo examines the engineering behind Bun’s AI-assisted rewrite and the contested response from Zig creator Andrew Kelley.

TBTheo BrowneSpeaker · Ping Labs
Channel
Theo - t3․gg
Published
Jul 15, 2026
Video
1:00:06
Read
9 min
Slides
12
Original
English
Open on YouTube
Scroll to read and the video shrinks to the bottom-right corner. Captions follow your reading language.
Reading languageAvailable in 2 languages
You're reading the original English.
SUMMARY

In 30 seconds

Theo Browne reviews Jarred Sumner’s account of Bun’s migration from Zig to Rust, including workflow design, testing, costs and reported results. He then strongly disputes Andrew Kelley’s response about their relationship and engineering choices. Theo discloses his friendship with Sumner, and the competing personal claims remain contested.

  1. 1Why Bun considered RustThe team wanted earlier feedback on ownership and cleanup across complex memory boundaries.
  2. 2Workflows and independent reviewThe reported port used repeated implementation and adversarial review loops over 11 days.
  3. 3Infrastructure became a constraintParallel tests exhausted system resources and required limits as well as code fixes.
  4. 4Estimated inference costBun estimated around $165,000 at API pricing; the manual alternative is a counterfactual.
  5. 5A substantive technical disputeKelley questions the validation argument and Theo stresses different classes of memory bugs.
  6. 6A revised responseKelley later acknowledged resentment and apologized to Zig users concerned by the post.

Takeaways

  1. The port combined an explicit mapping guide, repeated agent workflows, independent reviews and a language-independent test suite.
  2. Rust ownership checks can catch some memory errors in safe code, while unsafe and foreign-code boundaries need additional scrutiny.
  3. Large parallel runs require infrastructure limits and verification that tests actually execute.
  4. The $165,000 figure was an API-price estimate, and the cost of a manual alternative was hypothetical.
  5. The dispute includes substantive questions about validation and performance as well as conflicting personal accounts.
FULL TEXT

Read the edited text by chapter

Transcript only
01

A port and a public dispute

Theo introduces the two articles and discloses his friendship with Sumner.

Bun has been ported from Zig to Rust with extensive help from Claude. Jarred Sumner's account explains how the work was organized and credits Zig for making Bun possible. Zig creator Andrew Kelley's response became a separate, highly personal dispute; I know Jarred and disagree strongly with Kelley's characterization.

02

Why Bun reconsidered its language

The Bun post describes stability problems, existing safeguards and memory-management trade-offs.

Bun began as a port of esbuild's JavaScript and TypeScript transpiler from Go to Zig. Sumner chose Zig in 2021 for low-level control and performance, then built an unusually broad toolchain: a runtime, bundler, package manager, test runner and many Node-compatible APIs.

Sumner says Zig enabled him to build that scope quickly and expresses gratitude to its community. At the same time, Bun's scale exposed stability problems, including crashes and memory leaks. The team wanted to prevent recurring classes of bugs rather than only fix individual incidents.

Bun’s existing stability measures
SLIDE 1 / 12Bun’s existing stability measuresThe Bun post lists sanitizer checks, fuzzing and memory-leak tests.

Before the port, the team had already added AddressSanitizer support to its Zig compiler, run sanitizer checks in tests, used safety-checked Windows builds, fuzzed runtime APIs and maintained memory-leak tests. Sumner presents those as serious safeguards that still did not eliminate every problem.

The difficulty is the boundary between JavaScript's garbage-collected objects and manually managed memory. Bun's code has to know which resources are live, how exceptions affect cleanup, and when a pointer can be freed. Zig's explicit control can be valuable, but it places responsibility on the programmer.

Resource cleanup by language
SLIDE 2 / 12Resource cleanup by languageThe post contrasts Zig’s explicit cleanup with C++ destructors and Rust Drop.

Zig uses explicit `defer` and `errdefer` for cleanup; Rust provides ownership checking and `Drop`, while C++ has destructors. These approaches make different trade-offs. Safe Rust can catch certain ownership mistakes at compile time, although unsafe code and foreign-language boundaries still require careful review.

The Bun post considers style guides and review as another route. They can express ownership conventions, but enforcement depends on people and tooling. Sumner also considered C++, already used by some dependencies, yet expected that it would retain similar reliance on conventions for many errors.

Why Bun considered Rust
SLIDE 3 / 12Why Bun considered RustThe post describes memory bugs and its proposed mechanical port.

His argument for Rust is earlier feedback: safe code rejects many use-after-free and double-free patterns, and `Drop` helps with cleanup. This does not prove a whole mixed-language application is memory-safe, nor does it replace tests, fuzzing or review.

A conventional rewrite of roughly half a million lines of Zig could occupy a small team for a long time while other work continued. Bun's proposed lower-risk path was a mechanical port with minimal behavioral changes, using its existing TypeScript test suite as a language-independent check.

03

Planning the migration

A mechanical port, mapping guide and separate reviews shaped the process.

Sumner experimented with Claude and saw enough tests pass to continue. He chose an all-at-once mechanical translation rather than an incremental migration with temporary bridges, planning later refactoring toward more idiomatic Rust. That choice reflects Bun's circumstances, not a universal rewrite recipe.

The central process was a loop: implement a task, review the result independently, apply feedback and repeat. Sumner describes roughly 50 dynamic Claude Code workflows across 11 days for mapping types, porting files, fixing compilation errors, running tests and cleanup.

Implementation and review workflows
SLIDE 4 / 12Implementation and review workflowsA loop and list of workflow stages outline the migration process.

He monitored the workflows and revised them when they produced problems. The post describes separate implementers and adversarial reviewers, with at least two reviewers examining changes without the implementer's full context. I often use different model families for this kind of second look.

The preparation mattered. Sumner spent hours discussing mappings with Claude and recorded rules in a porting guide: retain the project's architecture, map types and allocators consistently, and avoid inventing incompatible runtime structures. He also reviewed the guide and had agents critique it.

The porting guide
SLIDE 5 / 12The porting guideA guide maps files and conventions for the Zig-to-Rust translation.

Instead of translating all 1,448 Zig files immediately, he trialed three. An implementer translated each file, reviewers checked equivalence and the guide, and another agent applied fixes. The small trial exposed coordination problems before the work was scaled up.

04

Running and validating the port

Parallel work, compilation, resource limits and tests posed distinct engineering problems.

Concurrent agents interfered with one another, while separate worktrees consumed substantial disk space. The workflow was changed to constrain conflicting Git operations and expensive commands. The broader challenge is how to isolate parallel work without making coordination prohibitively expensive.

The system also hit infrastructure limits: a slow Git operation saturated disk I/O. Rust compilation required splitting the code into roughly 100 crates, which exposed cyclic dependencies. Another pair of workflows classified where dependent code belonged and then performed the refactor.

Cyclic dependencies and compilation
SLIDE 6 / 12Cyclic dependencies and compilationThe Bun post explains how separate workflows handled crate organization.

The compiler became a work queue, but making errors disappear was not enough. Some agents tried to stub functions or justify workarounds with long comments. Sumner adjusted the instructions to seek real fixes rather than merely producing code that compiled.

Once compilation passed, the team still had linking failures and startup panics to resolve before it could run meaningful tests. Some translated code used `unsafe`, so memory leaks remained possible despite the move to Rust.

Large test runs exhausted sockets, spawned thousands of processes and wrote gigabytes to disk. They used operating-system resource controls to constrain runs, though the machine still ran out of space and crashed. Parallel agents need limits on their environment as well as instructions.

The reported failing test-file count fell from 972 to 23 over two days, and Linux later went green. Further workflows handled platform failures and cleanup. Sumner says he merged after the suite passed on all platforms and he manually checked that tests were actually running.

Merge and validation
SLIDE 7 / 12Merge and validationThe post describes the all-platform test gate and distinguishes merge from release.

Merging to main was not a versioned production release. I find that distinction useful: a team can integrate a large change for further validation without treating the merge itself as proof that it is ready for every user.

05

Cost and reported results

Theo discusses estimated token costs, continued security work and performance measurements.

Reported tokens and estimated cost
SLIDE 8 / 12Reported tokens and estimated costThe statistics show token usage and an API-price estimate.

The post reports over 6,500 commits and roughly 1.78 million lines added or rewritten. Before merge, it lists 5.9 billion uncached input tokens, 690 million output tokens and 72 billion cached input reads, estimated at about $165,000 at API prices—not necessarily an actual invoice.

Sumner estimates a manual port would have occupied three engineers for about a year, disrupting other work. I think the relevant alternative may have been not attempting the rewrite at all. That is a counterfactual estimate, not a measured labor comparison.

I expect comparable AI capability to become cheaper over time, but the timing and magnitude are uncertain. The experiment also benefited from access to a prerelease model and Anthropic's resources, so its economics cannot be copied automatically by every team.

The article says the work continued after merge: security reviews and continuous coverage-guided fuzzing were added. It reports roughly 4% of Rust code within `unsafe` blocks, many just one line. That percentage is a useful description of the codebase, not an assurance that the remainder of the system has no safety issues.

Post-merge security work
SLIDE 9 / 12Post-merge security workThe post describes further reviews, fuzzing and unsafe-code usage.

Bun reports 19 regressions introduced by the port and 128 fixes for bugs reproducible in the prior version. Those are the project's reported results at the time, not independent proof that every regression or pre-existing bug was found.

Build memory comparison
SLIDE 10 / 12Build memory comparisonA table compares memory use for specific Bun versions and build counts.

One displayed build test shows memory use after 2,000 builds at about 6,745 MB for Bun 1.3.14 versus 609 MB for the newer build. The team also reports smaller binaries and modest speed gains. These are specific measurements, not proof that language choice alone caused each improvement.

I find the write-up valuable because it shows the guide, reviews, tests, infrastructure limits and ongoing work behind the port. The interesting story is not a single prompt magically rewriting a repository; it is the engineering process around repeated generated changes.

06

The relationship dispute

Kelley criticizes Bun and its founder; Theo disputes the personal account and its tone.

Kelley, Zig's creator, published a response describing a breakdown in the relationship between the Zig project and Bun. He acknowledges Bun's financial support and Sumner's gratitude, but criticizes his decisions, management and code quality. I am a friend of Sumner's and read this response with that perspective.

Kelley describes Sumner's early approach as moving quickly into unfamiliar problems and argues that venture funding changed Bun's incentives. I object to the characterization and think Sumner had worked with extraordinary intensity before raising money. Neither account establishes another person's motives as fact.

Kelley suggests crowdfunding could have supported the project. I question whether that is realistic at Bun's scale, pointing to the much smaller donations received by the JavaScript ecosystem effort E18E. Funding situations differ, so this example illustrates the concern rather than proving a universal outcome.

Kelley says Bun donated about $60,000 a year to the Zig Software Foundation before the donation stopped. I highlight that support and argue that commercial funding can pay for both engineering and contributions to an upstream project.

The response also relays harsh accounts of Sumner's management and demanding work expectations. I agree that he has not always been a good manager and say that he was explicit about the intensity of the work. The employee experiences and other workplace allegations discussed here are disputed personal accounts, not independently established findings.

Kelley portrays the relationship as increasingly strained and says the Zig team objected to practices in Bun's code. His examples include assertions and rapid feature development. I see at least some of those as disagreements about engineering practices and reject the personal tone of his response.

Kelley says the foundation viewed Bun as a liability and welcomed the Rust migration. He also raises concerns about low-quality AI-generated contributions reaching the Zig community. Those are his account and assessment; they should not be treated as an independently verified judgment of every Bun contribution.

07

Technical objections and the revised response

The disagreement covers tests, performance and compilation, followed by Kelley’s later edits and apology.

On the technical side, Kelley argues that the Bun post sets up a misleading choice between style guides and language features, and emphasizes dedicating engineering effort to finding bugs. He also questions relying on a test suite to validate a huge generated port. These are substantive concerns even though I strongly disagree with his framing.

Kelley’s technical objections
SLIDE 11 / 12Kelley’s technical objectionsHis response questions the validation argument and attributes improvements to other factors.

My response is that behavior tests and memory guarantees address different failure modes. A test suite can exercise many cases but cannot establish that every long-running memory issue is absent. Rust's safe subset provides additional compile-time guarantees, while unsafe code, foreign libraries and logic errors still need other checks.

Kelley disputes the performance explanation, asks about fuzzing practices and questions whether binary-size improvements came from the language change. I contest his assumptions about the timing and intent of that work. The video does not independently resolve these technical or historical disagreements.

He also asks for post-rewrite compilation measurements and points to fast Zig compiler builds. I agree that compilation time is a real trade-off: Sumner's account itself describes reorganizing crates to make Rust compilation manageable. One attractive property does not settle the entire language decision.

Kelley concludes that the deeper issue was a relationship breakdown. Based on my conversations with Sumner, I believe he genuinely liked Zig and was disappointed by friction with the foundation. That is my personal account; outsiders cannot infer the full history or motives from it alone.

I object especially to a disclaimer in the version I first read that said there were no personal criticisms, while the article included judgments about Sumner's experience, management and motivations. I asked models to identify examples, but their agreement is not independent adjudication of the dispute.

Kelley later revised the conclusion, saying that different values and the ensuing relationship breakdown were central. He acknowledged resentment, explained that the original framing read as a personal attack, and apologized to Zig users who might worry about being treated similarly.

Revised conclusion
SLIDE 12 / 12Revised conclusionA later version acknowledges resentment and describes the relationship breakdown.

I remain unconvinced by the revised framing and bring up an older post as part of my criticism. My strongest conclusion is about how project leaders communicate with users: a public disagreement about a migration can have consequences beyond the two people involved.

I am angry about the response, and my friendship with Sumner shapes that reaction. The underlying technical question remains worth examining separately: what evidence, review and operational controls make a large AI-assisted rewrite reliable enough to ship?

More from this channel

5 slides38:47EN
Theo - t3․gg· Oct 28, 2026Theo’s Long-Running Agent Experiments: Verification, Compute and CostTheo Browne · Ping LabsA skateboard game and two compiler projects show how repeated checks and flexible compute can sustain agent work—and how expensive those loops can become.Coding agentsAgent engineeringAI cost & performance+2
5 slides36:07EN
Theo - t3․gg· Oct 27, 2026Theo on Token Costs, Coding Agents, and the Price of AI CapabilityTheo Browne · Ping LabsA viral estimate of Lauren's AI spending prompts a closer look at cache pricing, benchmarks, and the changing work of coding agents.AI cost & performanceCoding agentsInference+1
5 slides30:37EN
Theo - t3․gg· Oct 26, 2026Theo’s Three Skills for Reviewing and Shipping with Coding AgentsTheo Browne · Ping LabsHow sol-loop, full-send and full-stop encode review, verification and different levels of merge authority.Agent skillsCoding agentsCode review & verification+2
2 slides0:43EN
Theo - t3․gg· Oct 23, 2026Theo Distinguishes Security Vulnerabilities from Active AttacksTheo Browne · Ping LabsA short explanation of why disclosed software flaws and reported attacks are different kinds of security news.CybersecuritySoftware engineering
6 slides29:22EN
Theo - t3․gg· Oct 22, 2026Theo on Security Vulnerabilities, Stolen API Keys and AITheo Browne · Ping LabsA look at the gap between vulnerability disclosure and patching, and a speculative account of why stolen inference keys may be valuable.CybersecurityAI securitySoftware engineering+1
4 slides31:13EN
Theo - t3․gg· Oct 20, 2026Theo on Why Smarter Models Help More Than DevelopersTheo Browne · Ping LabsFrom game modifications to compiler experiments, Theo revisits his assumptions about who benefits from more capable AI.Coding agentsDeveloper productivityHuman-AI Collaboration+1