Bun Rewrites 535K Lines of Zig into Rust in Four Months, Eliminates Numerous Memory Leaks

Bruno Couriol ยท rss ยท 2026-09-20 source โ†— Reader ๐Ÿ–ฅ๏ธ

Agentic EngineeringCapacity to Verify AI OutputCoding AgentsIncremental Rewrite GranularityMulti-Agent OrchestrationRust (Programming Language)
A single domain expert, directing dozens of parallel adversarial-review AI agents against a mechanical (behavior-preserving) porting process anchored to an extensive pre-existing test suite, rewrote a 535K-line production codebase into a memory-safer language in months instead of a year and shipped measurable bug and memory-leak reductions โ€” but critics dispute whether passing that same test suite ever was, or could be, sufficient proof that a million lines of largely unreviewed AI-generated code are actually safe.

practical ยท mixed โ€” Primarily a narrative case report (Sumner's account of the rewrite process and outcomes), but it embeds a genuine argumentative thread via Andrew Kelley's published rebuttal of the safety framing, plus a third-party (vitaminCPP) reframing of the stakes. It implicitly argues 'this approach is worth trusting,' while also reporting the counter-argument that it is not.

Structure

PartRole
Sumner's motivation and the historical risk of rewrites ('historically, rewrites are a terrible idea')context
The process: PORTING.md and LIFETIMES.tsv planning artifacts, implementer/reviewer/fixer agent roles run in isolated context windows, sharded across 64 parallel Claude instancesevidence (methodology)
Quantitative outcomes: $165,000 in tokens, 1,300 lines/minute peak, 128 bugs fixed, native memory leaks eliminated, 2-5% HTTP throughput gainevidence (results)
Post-merge hardening: 19 subtle semantic regressions found by fuzzing, 11 rounds of security review, 15 fuzzing-driven PRsevidence (qualification of the results)
Andrew Kelley's (Zig creator) rebuttal that the safety framing is a 'sleight of hand' since bugs are eliminated by engineering resources, not language or method, and that the same test suite deemed inadequate for the old Zig code cannot simultaneously be trusted as sufficient for a million new linescounter-argument
vitaminCPP's framing of the merge as an 'industry canary' for whether massive LLM-generated codebases stay maintainable long-termbroader implication

Key terms

Propositions

Arguments

The rewrite's process was rigorous enough that the resulting codebase is trustworthy to ship, despite being largely AI-generated.
Explicit premises:
Implicit premises:
Inferences:
The safety claim for the rewrite is a sleight of hand and the resulting code should be regarded as unreviewed. strength: high
Explicit premises:
Implicit premises:
Inferences:

Narratives

Questions addressed

Gaps

Closes gaps elsewhere

Related documents