Migrating the GitHub Copilot runtime to Rust, using Copilot
For years, the idea of rewriting a massive enterprise system like the GitHub Copilot runtime in Rust was a fantasy reserved for white papers and optimistic conference talks. The sheer scale of the original implementation, written in Go and TypeScript, presented a wall of legacy code that seemed immovable. Yet, standing in that gap between theoretical possibility and practical reality were the autonomous agents now capable of navigating codebases with a level of autonomy previously unimaginable. What we discovered was that the cost of migration wasn't just financial or temporal; it was cognitive, and the agents allowed us to bypass the traditional bottlenecks of human review cycles.
The scope of the rewrite was staggering: roughly 800,000 lines of production-grade Rust. To tackle this without a human army drowning in context switching, we leveraged the very tool we were building—Copilot itself. We set up a feedback loop where the agents analyzed the Go source, proposed the Rust equivalents, and then iterated on the logic based on test failures. It wasn't a simple find-and-replace operation; it was a complex orchestration of intent generation, code synthesis, and self-correction. The agents effectively became the senior engineering team, able to hold context across thousands of files in a way that no single human could.
What surprised us most was the speed of convergence. In a traditional migration, a team might spend months just reading and understanding the domain logic before writing a single line of new code. With the agents, we achieved a level of parallelism where discovery and implementation happened simultaneously. The agents didn't just copy syntax; they understood the architectural patterns of the Copilot runtime and translated them into idiomatic Rust. We watched as they refactored complex state machines into Rust's type-safe enumerations, handling concurrency models that felt like a native evolution rather than a port.
However, the journey wasn't without its friction. There were moments where the agents proposed elegant solutions that were brittle under edge cases, requiring human intervention to steer the logic back on track. This was the crucial differentiator: the agents acted as a force multiplier for human expertise, not a replacement for it. We learned that the most efficient path forward involved a tight feedback loop where humans defined the constraints and the agents handled the heavy lifting of translation and testing. It was a collaboration where the machine handled the scale and the human handled the strategy.
The result is a runtime that runs significantly faster, with a memory footprint that is a fraction of the original, and code that is easier to audit and maintain. But beyond the metrics, the shift represents a fundamental change in how we approach large-scale software engineering. We are moving toward a paradigm where the barrier to entry for massive migrations is lowered, not by reducing the complexity of the problem, but by increasing our capacity to manage it. The rewrite proved that with the right tools, even the most daunting technical debt can be refactored with precision and speed.
On Bluesky? Meet HomeSky.
Follower analytics, a growth toolkit, scheduling and AI posting — built for Bluesky. Connect your account and use everything free for 60 days.
Try HomeSky free →