Skip to main content
The Quantum Dispatch
Back to Home
Cover illustration for Agentic Code Migration: GitHub's 800K-Line Rust Port

Agentic Code Migration: GitHub's 800K-Line Rust Port

GitHub's coding agents rewrote 430,000 lines of TypeScript into 832,000 lines of production Rust in 14.5 weeks, at a 96% prompt-cache hit rate.

Dr. Nova Chen
Dr. Nova Chen★Sep 20, 2026★8 min read

A Rewrite That Was Not Affordable Before

Large language migrations have always had the same shape: everyone agrees the old codebase should be in a different language, everyone costs it out, and everyone quietly decides to live with what they have. GitHub just published a detailed account of doing one anyway. Between May 12 and August 21 this year, the team ported the Copilot agent runtime from TypeScript to Rust, and coding agents did the bulk of the typing.

  • Scale: roughly 430,000 lines of production TypeScript became 832,378 lines of production Rust, plus 468,689 lines of Rust unit tests
  • Duration: about 14.5 weeks, landing 128 pull requests and 135 public CLI releases
  • Memory: a 10-client agent batch that needed 1,383 MB under Node.js now runs in 126 MB, per The Register's write-up of the same work
  • Economics: a 96.22% prompt-cache hit rate across the porting sessions, which is the number that made the whole thing viable

Why Move the Runtime Off Node.js at All?

The motivation was architectural rather than fashionable. The Copilot runtime and its terminal UI had grown intertwined, and shipping the runtime meant shipping Node.js with it. Every one of GitHub's six language SDKs — C#, TypeScript, Python, Rust, Go and Java — had to bundle a Node binary and spawn a CLI subprocess, which meant every function call crossed a process boundary and got serialised through JSON-RPC. The floor for a single client was roughly 100 MB of working set before any actual work happened.

What GitHub wanted was a runtime with few dependencies that could be embedded in-process and exposed over a stable C ABI. Rust fits that description. The payoff is visible in the SDK surface: 19 C ABI exports now carry the public interface, and in-process hosting arrived as an additive, opt-in transport rather than a breaking change for anyone already using the old path.

How Did the Agents Actually Work?

This is the part worth dwelling on, because it contradicts the popular image of AI coding. The port ran component by component, ordered from leaves inward — pure helpers first, then stateful subsystems, then orchestration last — with temporary N-API bindings holding the two halves together. Those interop exports peaked at 2,019 and then fell to zero as the last TypeScript component went away. Nothing was ever big-bang cut over.

The telemetry GitHub published is unusually candid. Across the porting sessions there were 1,130,921 tool calls, 61% of them from subagents doing parallel exploration while a main agent handled orchestration and editing. Reading and searching outweighed editing by roughly ten to one. Ripgrep alone accounted for 281,783 calls. The author's summary is blunt: the agents spent far more time gathering evidence than changing code, and the human role was less assigning a task and waiting than operating a control loop — inspecting results and challenging technical decisions.

That ratio is the real lesson for anyone planning similar work. The expensive part of a migration was never typing the new code. It was establishing what the old code actually did, and that is exactly the part agents can grind through at volume. It is the same shift toward agents that execute and verify rather than summarise that we saw when research papers were rebuilt as runnable agents.

What Did the Compiler Catch, and What Did It Miss?

Dozens of regressions surfaced during the port, and GitHub grouped them honestly. The most common family was ambiguous semantics — 64-bit floats against 64-bit integers, implicit JavaScript coercions, empty-string handling that meant one thing in TypeScript and another in Rust. Then came ambient behaviours (time zones, environment variables, working directories), desynchronised paired operations, blocked main threads from synchronous N-API exports, lifecycle and ownership slips, and features quietly dropped in translation.

The compiler was a real safety net but a narrow one. 87.1% of cargo check runs came back clean, and of the diagnostics that did appear, name resolution accounted for 37%, missing methods 22%, type mismatches 14% and trait bounds 11%. Borrow-checker complaints were only 1.7%. Of the 158 unsafe blocks across 36 files — nearly all of them at the C ABI, Windows API and POSIX boundaries — none were involved in a known regression.

Lisa Crossman, speaking at RustConf and quoted by The Register, put the limit neatly: Rust stops the agent writing memory-unsafe code, but it does not stop the agent writing the wrong program correctly. GitHub's answer was process rather than trust — the full end-to-end TypeScript test suite ran continuously against the new Rust, CI blocked failing merges, and a custom review step compared old and new implementations line by line for behavioural equality.

What This Means for Everyone Else's Legacy Code

The Register put the token bill at about $120,000 plus roughly three weeks of developer time, a figure GitHub's own post does not state. Treat it as that outlet's reporting rather than a vendor number. Even so, the order of magnitude is the story: a rewrite at this scale used to be a multi-year headcount decision, and the 96% cache hit rate is what moved it into the range where a team can simply choose to do it.

There is a caveat worth keeping. This migration had unusually good conditions — a comprehensive existing end-to-end test suite, a clean component boundary to port across, and a target language whose compiler is loud. Codebases without those things will not see these numbers, and the honest read is that agentic migration rewards good engineering hygiene rather than substituting for it. That same pattern — tooling that pays off most where the groundwork already exists — showed up in GitHub Copilot's move to compact open coding models and in the open-weight coding models now landing inside Copilot. More on coding agents and model releases in our AI coverage.

Sources: The GitHub Blog — September 16, 2026; The Register — September 18, 2026.

More AI Stories