GitHub Migrates Copilot Runtime to Rust Using AI-Assisted Rewrite
Tech

GitHub Migrates Copilot Runtime to Rust Using AI-Assisted Rewrite

TechNews Editorial
TechNews EditorialOct 9, 2026 · 2 min read
Share

Why it matters

The migration proves that large codebases can shift to Rust via AI assistance while maintaining continuous production releases.

The facts

  • GitHub migrated the Copilot runtime from TypeScript and Node.js to Rust.
  • The AI-assisted rewrite replaced over 800,000 lines of production code in 14.5 weeks.
  • Client startup and session creation dropped from 5.25 seconds to 292 milliseconds.

GitHub moved the runtime behind the Copilot CLI, the Copilot app, and the Copilot SDK from TypeScript and Node.js to Rust. The project replaced more than 800,000 lines of production code through an AI-assisted rewrite. The migration took approximately 14.5 weeks to complete.

Teams delivered the work through 128 pull requests while keeping the runtime in continuous release. GitHub states that a measured client startup, session creation, and single-turn scenario dropped from 5.25 seconds using the old runtime down to 292 milliseconds when embedding the Rust runtime in process.

Architecture changes remove heavy dependencies

The previous implementation depended on Node.js and V8, communicating with host applications across a process boundary. GitHub reports that this design added roughly 100 MB of working set per client. The new Rust implementation supports direct embedding into host applications through a C ABI, alongside an available out-of-process mode. The Copilot SDK currently offers support for TypeScript, Python, Go, .NET, Java, and Rust.

Incremental steps kept production stable

GitHub chose an incremental replacement strategy over a parallel rewrite and a single cutover. Individual TypeScript parts were swapped for Rust counterparts using temporary N API interoperability. This let existing end-to-end tests run against the new code while other sections stayed in TypeScript. GitHub shipped 135 releases during the migration period, consisting of 35 stable versions and 100 prerelease versions.

A runtime moves from a separate process into an application, eliminating the process boundary and reducing its memory footprint.
Illustration: AI & Tech News

The compatibility layer hit 2,019 internal N API exports and 3,356 TypeScript call sites before engineers removed it. By August 21, the runtime held 832,378 lines of production Rust and 468,689 lines of Rust unit tests. AI agents generated most of the codebase. Compilation, testing, and human review helped catch regressions involving behavior, state and lifetime handling, library semantics, and lost optimizations. GitHub tracked 4,478 direct cargo check runs, with 87.1% finishing cleanly.

Community highlights verification hurdles

Community feedback emphasized the verification challenges tied to AI-assisted migrations. Observers highlighted features like cancellation, retries, and backpressure as areas needing validation beyond mere compilation. Community member PLBjt noted that maintaining stable runtime behavior at the boundaries matters more than the fact that Copilot wrote Rust. Côme Redon, a senior solution engineer at Microsoft, noted the difficulty of finding undocumented behavioral contracts in legacy systems.

The final architecture delivers a native Rust runtime that runs embedded in host apps or separately. The Copilot SDK preserves language-specific interfaces across all supported languages. GitHub next moves forward with the established native Rust runtime architecture in production.

Newsletter

Get the best AI & tech news daily

A concise daily digest. Unsubscribe anytime.

We use your email only to send this newsletter.

Keep reading