Agents drive a module-by-module migration

Microsoft has completed a Rust rewrite of the runtime behind GitHub Copilot and several integrations across its product portfolio, using coding agents for most of the conversion work. The project moved about 430,000 lines of TypeScript into roughly 800,000 lines of production Rust and cost around $120,000 in model-token usage, alongside about three weeks of a developer’s time.

The migration ran for 14.5 weeks and was delivered through more than 135 releases, averaging about 1.3 port pull requests per day. Modules were replaced incrementally rather than redesigned, keeping the immediate goal focused on behavioral compatibility. Structural optimization is expected to follow.

The runtime supports the GitHub Copilot command-line interface, app, software-development kit and cloud agent. Variants are also used by Microsoft products and services including Visual Studio Code, Visual Studio, Excel, Outlook and PowerPoint. Its previous TypeScript implementation relied on Node.js and the V8 engine, a combination suited to rapid development but less aligned with requirements for quick startup, efficient server density and embedding through a C application binary interface.

Benchmarks reported for the rewrite show substantial gains in particular workloads. A test running 1,000 one-turn session lifecycles with 100 concurrent pipelines completed 7.55 lifecycles per second in TypeScript and 120 per second with in-process Rust, a 15.9-fold increase. In another comparison, a ten-client agent batch used 1,383 MB with TypeScript and 126 MB with Rust. Those measurements describe selected tests, not a guarantee that every Copilot workload will see the same improvement.

Compilation did not prevent behavioral failures

The project also exposed the limits of agent-led translation. Managers encountered dozens of regressions even though Rust’s compiler enforced its usual memory and type-safety rules. Problems included ambiguous behavior, branch drift and features that had not been carried over. Valid Rust can still implement the wrong behavior or miss requirements that were never encoded in tests or specifications.

Microsoft distinguished engineer Stephen Toub cautioned that the result should not be read as a case for rewriting every large TypeScript program in Rust. The runtime had specific constraints around embedding, startup time, predictable resource use and steady-state overhead that made Rust a suitable choice.

Agents reportedly spent much of their time inspecting code and forming hypotheses rather than simply generating replacements. One difficult conversion involved a TypeScript session file exceeding 30,000 lines. The session assigned to that work first studied documentation and made numerous tool calls, then created child sessions in separate worktrees and coordinated overlapping tasks.

That process suggests large agentic migrations still depend on strong tests, staged delivery and human judgment. Rust reduced certain classes of low-level error and delivered measurable resource benefits, but the regressions demonstrate that compiler approval is not equivalent to application correctness. The next phase—redesigning rather than mechanically translating the runtime—will provide a further test of how well that combination of agents and human supervision can handle architectural work.