The application motor underpinning GitHub Copilot and a expanding figure of Microsoft products is now written entirely in Rust, alongside AI agents doing most of the porting work.
The immigration disbursal concerning $120,000 in AI token use affirmative concerning three weeks of a developer's time. However, managers additionally had to grapple alongside a few dozen regressions in the resulting code, pointing to AI’s ongoing challenges in understanding Rust.
The attempt updated the runtime module-by-module until the job was completed, spanning complete 135 releases throughout a 14.5-week period period. Roughly 1.3 harbor drag requests were opened per day.
Overall, agents converted 430,000 lines of TypeScript into 800,000 lines of manufacturing Rust. To keep the harbor as uncomplicated as possible, the harbor lone replaced TypeScript modules on a case-by-case basis. It didn’t appearance to optimize the construction of the runtime itself. That activity is next.
And Rust, known for its lean performance, did not disappoint.
One benchmark measured how quickly the runtime could complete 1,000 one-turn meeting lifecycles, using a shared client and 100 concurrent pipelines. The first TypeScript implementation completed 7.55 of those lifecycles per second, during Rust operating in-process managed 120 per second - representing a 15.9x speedup on that particular workload.
In conditions of memory, a 10-client lot of agents consumed 1,383 MB alongside TypeScript during the Rust rewrite consumed lone 126 MB serving the identical swarm. Within Rust, the activity remained in-process alternatively of spawning external backdrop processes for completion, a necessity for TypeScript.
Copilot from VS Code to Microsoft Office
At archetypal glance, most users may not cognize how pervasive the Copilot runtime is. It backs the GitHub Copilot command-line interface (CLI), the Copilot app, the SDK and the GitHub Copilot haze agent. It shows up in VS Code, Visual Studio, Excel, Outlook, PowerPoint, and innumerable another Microsoft haze services.
Originally, the runtime was written in TypeScript and used Node.js as the example and V8 for the implementation engine. TypeScript and Node were ace for fast development, but whenever used at scale, they suffered in conditions of providing accelerated start-up and server density.
“This is in no way a assertion that all ample TypeScript program should rotate into Rust. Our requirements emphasized embedding through a C ABI, low startup and steady-state overhead, and predictable asset use. Rust made those goals possible,” wrote Microsoft Distinguished Engineer Stephen Toub in a article that explained the complete process.
The project used Copilot to rewrite Copilot, which in rotate used multiple LLMs – GPT-5.6 Sol and Claude Opus 4.8 were the two namechecked – to execute distinct parts of the job, depending on all LLM’s natural strength.
Well-read but chatty agents
Toub assessed the use of agents as mostly successful. Indeed, this project would have taken years and disbursal millions if done by hand.
Agents showed multiple amazing emergent behaviors, Toub noted. For one, they spent far additional period gathering data than really penning code.
“The famous depiction of AI spewing code is nearly backwards; at this scale, the activity looked much additional akin iterative investigation, inspecting the current state, forming a hypothesis, making a targeted change, rinsing and repeating,” he wrote.
Another astonishment was how frequently sessions interacted alongside another sessions, either those they spawned or another ones entirely.
One of the thorniest conversions was the session.ts file, which was complete 30,000 lines of TypeScript that touched all aspects of the runtime. The porting session, which ended up taking 25 hours to complete, began by spending 56 minutes study the records and making 122 tool calls for clarification. It afterward spawned 15 kid sessions, all creating its own worktree and agent. Then, they started communicating alongside all other.
Using a built-in orchestration skill, one meeting established all another energetic meeting and sent messages to those whose missions overlapped, requesting coordination.
The compiler is a teacher, not an oracle
Given its achievement benefits, Rust has proven to be a famous tongue for rewriting applications. Bun creator Jarred Sumner, for instance, lately ported the Anthropic-owned JavaScript runtime and toolkit, which contained approximately 535,000 lines of Zig code, complete to Rust, nearly entirely using Claude agents. As of July 30, the experimental Rust harbor was passing 99.8 percent of Bun's existing tests on Linux x64 glibc, alongside the stable releases motionless shipping from the Zig codebase.
That job disbursal $165,000 in tokens.
But there are hidden dangers in using Rust as well, as Toub has found.
For an LLM and a lazy programmer alike, if the code compiles, afterward it is valid Rust.
But throughout the process, the project encountered dozens of regressions inside the code. A regression is item that used to work, but no longer does following an update.
The compiler has no idea, for instance, whether functions are in the correct order, whether the job completes at an satisfactory cost, whether it meets the developer's unwritten requirements, or whether it is internally coherent at all, for that matter.
At RustConf, held in Montréal final week, adviser Lisa Crossman warned concerning the custom of treating the compiler as an “oracle,” or the final term on whether several Rust code is valid or not. “Rust stops the delegate penning recollection unsafe code; it does not halt the delegate penning the incorrect program correctly,” she said.
If they’re wise, a individual developer treats the compiler as a teacher, decoding the errors as a way to a improved understanding of the language’s domain. An LLM, on the another hand, fair uses the compiler as a dreary box, one it can batter alongside blunt, inefficient workarounds until one passes muster (perhaps this is what Zig creator Andrew Kelley meant whenever he called Bun’s Rust code “unreviewed slop”).
In Toub’s case, he had established that compiler-approved regressions could arrive from ambiguous semantics and behaviors, branch drift, missing features that weren’t ported over, and differing behaviors from the replacement code.
“That’s in no way an disagreement against Rust’s compiler,” Toub wrote. “But ‘if it compiles, it’s correct’ is helpful lone as a joke.” ®