Video summary

I Was Wrong About Rust...

Main summary

Key takeaways

Technology

Summary

The presenter revises his earlier claim that Rust’s compiler is the main reason AI agents are effective at writing Rust. A GitHub case study of an AI-assisted Copilot runtime rewrite suggests the compiler helps, but most of its feedback was ordinary static type checking: of 8,678 compiler errors, about 84% were errors that other typed languages could also catch. Rust-specific ownership, borrowing, and lifetime errors made up just 1.7%.

GitHub Copilot runtime rewrite

  • GitHub ported its Copilot runtime from TypeScript and Node.js to Rust, using AI agents for most of the code. The runtime supports the Copilot app, CLI, SDK, VS Code, and Microsoft Office apps.
  • The rewrite took about 14.5 weeks and was delivered incrementally across 128 pull requests. The reported totals were roughly 430,000 lines of TypeScript replaced by 832,000 lines of production Rust, plus 469,000 lines of Rust tests. The presenter notes that some Rust code was also added independently during that period.
  • The goal was to provide a native library that multiple SDK languages could load directly, rather than making each client start a separate Node.js/V8 process and communicate with it. This reduced runtime overhead and dependency exposure.
  • Reported benchmarks included:
    • Warm client/session startup and first reply dropping from 5.25 seconds to 55.3 milliseconds.
    • Memory use for 10 clients dropping from 1,383 MB to 126 MB.

The write-up cautions that other changes landed during the same period, so the figures should be treated with some caution.

  • The rewrite also removed about 60 npm packages. The presenter frames fewer dependencies as a potential reduction in supply-chain risk.

What made the process work

  • Small, frequent changes: Agents changed a small piece of code, ran cargo check, and fixed the reported issues before continuing. Across roughly 4,000 checks, 87% returned clean.
  • Exploration before editing: The agents reportedly spent about 10 times as much effort exploring and reading the codebase as modifying it.
  • Tests the agents could not alter: Full end-to-end tests caught problems that compiled successfully. An agent had deleted a test along with the feature it guarded, so the team established a rule preventing agents from changing those tests.
  • Independent review: A second agent reviewed changes without the first agent’s reasoning context. GitHub also used review agents on three models to compare the old TypeScript and new Rust code line by line.
  • Port first, improve later: The engineer found that allowing cleanup or refactoring during the port led to more regressions, additional work, and higher cost.

Some lifecycle, ownership-ordering, and race-related bugs still escaped the compiler. One reason was that TypeScript held handles to state now stored in Rust; those handles were essentially table indices, so the compiler could not verify the relationship. Tests helped find these issues.

Why Rust—and how it compares with Bun’s rewrite

The GitHub engineer said the goal was to move away from Node.js and V8, not specifically to adopt Rust. Rust fit the need for a native library with minimal dependencies.

The presenter contrasts this with Bun’s Zig-to-Rust rewrite, which was motivated more directly by memory-safety concerns. Bun reported fixing 128 bugs after the port, while GitHub’s TypeScript-originating port used 158 unsafe blocks, located at boundaries with C or the operating system. The write-up reported no known bugs in those blocks.

The presenter cautions that these projects started from different languages and had different memory-management challenges.

Main takeaway

The compiler’s iterative feedback is useful, but it is not unique to Rust: most of the errors in this project were ordinary type errors. The presenter credits the broader workflow—incremental changes, protected end-to-end tests, independent review, and postponing improvements—as central to making the rewrite successful.

Rust was a good fit for this project, but the case study is not an argument that every TypeScript codebase should be rewritten in Rust.

Sponsor segment

The video also features WorkOS Pipes, a product for connecting an app’s AI agents to users’ tools. The presenter describes a widget for connecting to more than 300 tools, with token retrieval and lifecycle management handled by Pipes. Credentials are stored encrypted, and access ends when a user disconnects.

Main speakers and sources

  • Forrest Knight — presenter and narrator.
  • GitHub’s Copilot runtime rewrite write-up — the primary case study, by the GitHub engineer who led the port (the surname is unclear in the subtitles).
  • Bun’s Rust rewrite write-up — cited as a comparison.
  • WorkOS Pipes — sponsor featured in the video.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video