Migrating the GitHub Copilot runtime to Rust, using Copilot
For years, the idea of rewriting a massive codebase using the very tool built to write code seemed like a recursive joke, a paradox where the architect tries to build their own house with a hammer made of the house itself. We at GitHub decided to stop treating it as a joke and started treating it as a necessity. Our Copilot runtime, a critical piece of infrastructure handling billions of interactions, had been written in Go, a language we loved but found increasingly rigid for the specific chaos of an AI agent system. The goal was ambitious: migrate roughly 800,000 lines of production Rust code, a feat that would have been a multi-year slog for a human team, all while using Copilot to write the new code.
The initial hesitation wasn't about Rust; it was about the feasibility of the method. Traditional migrations rely on human reviewers line-by-line, a process that scales linearly with disaster. With millions of lines of code, the cognitive load required to verify every refactored function in a new language would have crashed the team. We realized that the only way to tackle this magnitude was to automate the translation layer. We needed an agent that didn't just generate snippets but understood the architectural intent, the error handling patterns, and the specific idioms of Rust enough to perform a safe, holistic translation. This shifted the problem from "how do we write Rust?" to "how do we make the agent reliable enough to write Rust for us?"
The result was a journey that defied our own predictions. It wasn't a smooth glide; it was a series of oscillating failures and breakthroughs where the AI would confidently generate code that compiled but behaved differently under load, requiring human intervention to steer the logic back on track. We found that the real value wasn't just in the speed of writing the code, but in the speed of learning the language. By letting Copilot handle the boilerplate and the syntax heavy-lifting, our engineers could focus entirely on the architectural decisions and the edge cases where the AI's probabilistic nature often stumbled. The migration became a collaborative loop where the AI proposed, humans verified, and the system iterated.
Looking at the final numbers, the timeline was compressed by orders of magnitude compared to a traditional rewrite. We moved from a planned two-year project to a matter of weeks for the bulk of the migration, a pace that would have been impossible without leveraging the very tool we were migrating to. This wasn't just about swapping languages; it was about validating a new paradigm for software engineering where the distinction between the tool and the work product begins to blur. It proved that agents aren't just assistants for the mundane; they are capable of being the primary architects of complex, high-stakes systems.
The success of this migration reinforces a broader truth about the future of development: the bottleneck is no longer the act of typing code, but the act of ensuring it is correct and maintainable. By using Copilot to port Copilot's own runtime, we demonstrated a self-referential capability that suggests the next evolution of software won't just be written by humans or machines, but by a hybrid intelligence that leverages the strengths of both. It is a glimpse into a future where the sheer scale of what we can build is limited only by our ability to trust and guide the systems that help us build it.
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 →