~64 AI agents rebuilt Bun in 11 days. Millions ran it for a month.

4 months ago

For a month, millions of machines have run a JavaScript runtime that AI agents rewrote into another language. Nobody noticed. That was the point.

Ask about this presentation

Chapters

  1. 0:00~64 AI agents rebuilt Bun in 11 days. Millions ran it for a month.
  2. 0:09The problem was never speed. It was memory.
  3. 0:24It has been shipping inside Claude Code since June.
  4. 0:38Nobody read a million lines. So they built a machine to check it.
  5. 1:10The argument isn't about Rust.
  6. 1:23Syntactically identical. Semantically different.
  7. 1:36When a machine writes the code, the thing you review is the checker.
Show transcript
  1. For a month, millions of machines have run a JavaScript runtime that AI agents rewrote into another language. Nobody noticed. That was the point.

    Slide text
    535,496 lines ported out of Zig in 11 days — and it shipped for a month before anyone looked
    Zig → Rust 535,496 lines 11 days ~64 agents
  2. Bun is a JavaScript runtime, and Claude Code's engine. The problem was never speed. It was memory. Bundle one project two thousand times. The old build climbs to six and a half gigabytes. The rewrite stays at six hundred megabytes.

    Slide text
    0 2 GB 4 GB 6 GB 500 1,000 1,500 2,000 times the same project was bundled in one process
    v1.3.14 · the old Zig build v1.4.0 · the Rust rewrite
    6,745 MB
    609 MB
    same 60-module project, bundled again and again in one process · about 3 MB leaked every build
    bun.com/blog/bun-in-rust
  3. They ran it in eleven days, with about sixty agents at once. A million lines landed. It has shipped inside Claude Code since June. Run strings on the binary. It prints Bun version one point four. Bun never released it.

    Slide text
    in Claude Code since June 17, 2026 · noticed a month later
    $ strings ~/.local/bin/claude | grep -m1 'Bun v1'
    Bun v1.4.0 (macOS arm64)
    Bun's latest tagged stable release: bun-v1.3.14 (2026-05-13). The Rust build reached users through Claude Code before Bun published it.
    11 days ~64 agents 6,502 commits +1,009,272 lines 223 unique src/*.rs · macOS arm64 ~$165k in tokens (author's accounting)
  4. Nobody read a million lines. Nobody could. So the story isn't the writing. It's the checking. Bun's test suite is TypeScript. The rewrite couldn't touch it. One point four million assertions, sixty thousand tests, none skipped. Then the review. One agent writes the code. Two more see only the diff, not the writer's reasoning. They must assume the code is wrong. This code compiled cleanly. It frees the same memory twice. Rust was built to prevent that bug. A reviewer caught it by hand.

    Slide text
    1,386,826
    expect() assertions
    60,624
    tests
    0
    skipped
    The test suite is written in TypeScript. The rewrite couldn't touch it.
    Debian 13 x64 · author manually verified the tests ran, not skipped
    one agent
    writes the code
    ↓the diff only, not the reasoning
    two reviewers
    see only the diff
    told to assume the code is wrong
    // compiles clean, frees the same memory twice:
    StdioResult::Buffer(mut pipe) => {
        // pipe: Box<uv::Pipe>, handed to async uv_close
        pipe.close(Subprocess::on_pipe_close)  // UAF, then double-free
    }
    // fix: leak the Box so libuv owns the handle
    Box::leak(pipe).close(Subprocess::on_pipe_close)
    commit f0a454376c7 · caught in adversarial review · bun.com/blog/bun-in-rust
  5. The pushback isn't really about Rust. Bun has belonged to Anthropic since December. There is still no published governance document. The tests pass. Nobody noticed for a month. Is that enough to trust a million lines nobody read?

    Slide text
    It's about how much proof ‘the tests pass’ really is.
    Bun · acquired by Anthropic, December 2025 · no published governance document
    Is that enough to trust a million lines nobody read?
  6. Nineteen regressions got through. Zig's assert is a function, so its argument always runs. Rust's is a macro, erased in release. That call registered files for hot reloading. So reloading broke in release builds only.

    Slide text
    19 regressions introduced, all since fixed
    Zig · assert is a function
    // argument runs in every build
    assert(insertStale(src, false)
           == refresh_index);
    Rust · debug_assert! is a macro
    // whole line erased in release
    debug_assert!(insert_stale(src, false)?
                 == refresh_index);
    That call registers files for hot reloading. In release it never ran, so hot reloading broke in release builds only.
    bun.com/blog/bun-in-rust · issue #30678
  7. The part worth keeping has nothing to do with Rust. When a machine writes the code, the thing you review is the checker. They built that first.

    Slide text
    The part worth keeping has nothing to do with Rust.
    They built that first.
    Rust v1.4.0 shipping in Claude Code latest stable tag v1.3.14
    bun.com/blog/bun-in-rust · github.com/oven-sh/bun

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York