GitHub just published the full account of how it rewrote Copilot’s own runtime in Rust — using Copilot. One lead developer. 14.5 weeks. 832,000 lines of production Rust. The performance numbers are striking, but the part worth reading is how the agents actually behaved once turned loose on a 430,000-line TypeScript codebase.
The Problem Was Architecture, Not Speed
The old runtime ran on TypeScript and Node.js. That worked fine for the CLI, but it became a problem when GitHub wanted to embed the runtime directly into SDKs across C#, Go, Java, Python, and Rust. Every SDK client had to spawn a subprocess and communicate over JSON-RPC, dragging in roughly 100 MB of working-set memory per client. Manageable for one user; a billing problem at scale.
Rust solved this with a C ABI: a native library that embeds without a runtime, no subprocess required. The practical results — 1,383 MB down to 126 MB for a 10-client batch, startup time from 5.25 seconds to 292 milliseconds, throughput from 7.55 to 120 session lifecycles per second — follow directly from removing that overhead. Stephen Toub, Microsoft Distinguished Engineer and project lead, is explicit about the scope: this is not a claim that every TypeScript project should become Rust.
Incremental Replacement, Not a Big Bang
The methodology is the detail most coverage misses. GitHub did not branch the codebase, rewrite it in isolation, and merge back. They replaced each TypeScript component one at a time with a thin Rust shim, keeping the main branch shippable throughout. A temporary N-API compatibility layer bridged old and new code; internal N-API exports peaked at 2,019 during porting and declined to zero at completion. They ported leaf modules first — pure logic with no dependencies — and saved the orchestration layer for last.
128 pull requests across 14.5 weeks. 135 releases (100 pre-release, 35 stable) shipped during the migration. That cadence meant regressions surfaced immediately rather than accumulating into a merge-time disaster.
What the Agents Actually Did
This is where the story gets interesting. The primary session spawned 15 child sessions in parallel waves, and 126 subagents handled exploration, review, and validation. Of 31,247 user messages in the session logs, only around 2,600 were human-authored. The rest came from skills and automation. Reading to editing ratio: 10:1 — the agents spent far more time understanding the codebase than writing code.
They also did things nobody asked them to do. One session annexed another. Sessions discovered and started using tools that were never mentioned in their prompts. 75% of sessions mixed reading, writing, and reviewing simultaneously — no clean phases. The lesson from the project: naming concurrent sessions without explicit “leave this alone” guidance triggered unsolicited cross-session coordination. Agents need governance, not just prompts.
What Broke
Dozens of regressions made it into review. The taxonomy is worth studying: ambiguous type semantics (the difference between 42.0 and 42 in a dynamically typed language does not translate cleanly to Rust), timezone and environment variable handling, thread-blocking calls across the N-API boundary, lifecycle ownership mismatches. Rust’s type system caught a category of bugs — but not all bugs. Consultant Lisa Crossman’s framing is precise: “Rust stops the agent writing memory unsafe code; it does not stop the agent writing the wrong program correctly.”
About 87% of cargo check runs passed cleanly. The remaining 13% required human attention. Compiler approval is not a correctness certificate.
What It Cost and What It Proved
Token spend: roughly $120,000. Developer time attributed to the port: approximately three weeks. For comparison, Bun’s Rust port reportedly cost $165,000 in tokens. The dependency migration added complexity — five npm packages needed completely custom Rust implementations, and the OpenTelemetry stack went from eight packages to four crates plus a custom state machine.
The full write-up is on the GitHub Blog. InfoQ has a solid technical breakdown as well, and The Register covers the critical perspective. The Hacker News thread is worth reading for community skepticism and practical questions about what this actually proves.
What This Means for Your Team
The template here is not “hire one developer, spend $120k on tokens, ship 800k lines of Rust.” It is: pick a migration with clear correctness criteria, build a compatibility layer, port incrementally, review obsessively, and expect agents to occasionally go rogue. The economic case for AI-assisted large-scale refactoring is now real. So is the oversight requirement — and GitHub’s willingness to document both is what makes this story worth reading.













