Github Migrates Copilot Runtime to Rust with AI-Assisted Rewrite
GitHub migrated more than 800,000 lines of Copilot runtime code from TypeScript and Node.js to Rust in about 14.5 weeks using AI-assisted development. The incremental migration used N-API interoperability, automated testing, human review, and 128 pull requests while continuing to ship releases. By Leela Kumili
GitHub has transitioned the backend for its Copilot tools, including the Copilot CLI, application, and SDK, from TypeScript and Node.js to Rust. This migration involved rewriting over 800,000 lines of code with assistance from AI technologies. The process, which took about 14.5 weeks, consisted of 128 pull requests and continued runtime releases.
Performance improvements were significant, with startup times dropping from 5.25 seconds to 292 milliseconds, and memory usage reduced from 100 MB per client. The new architecture allows the runtime to be embedded directly into host applications using a C API, or operated separately. Support for the Copilot SDK remains for TypeScript, Python, Go, .NET, Java, and Rust.
The migration utilized an incremental approach, replacing TypeScript components one by one with Rust versions while maintaining compatibility layers. AI agents primarily generated the new implementation, and human review and testing helped ensure quality. Community feedback highlighted the importance of verification for AI-assisted migrations, particularly concerning undocumented behavioral contracts in legacy systems.
Written by urgent.news from InfoQ's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.