Skip to content

Build1 publisher2 min readPublished

GitHub landed 800,000 lines of Rust in the Copilot runtime across 128 pull requests

Stephen Toub of Microsoft writes that AI agents wrote most of the code and a single developer drove the port in a few months while the rest of the team kept expanding the runtime. The post puts the speedup at orders of magnitude.

The Engineer · Build desk

What happened

  • GitHub has rewritten the Copilot agent runtime, originally TypeScript on Node.js and V8, into more than 800,000 lines of production Rust, using the Copilot app and the Copilot CLI to write it.
  • AI agents wrote most of that code across 128 pull requests that landed in main and shipped incrementally instead of waiting for a single cutover at the end.
  • The runtime sits under the Copilot CLI, app and SDK as well as the latest releases of VS Code, Visual Studio, Copilot Code Review, Copilot Cowork, Copilot Studio and the Office applications.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint At roughly 6,250 lines per pull request, review capacity is the scarce resource in a port like this.
  • exposure Every product that dropped its own agent loop for the Copilot SDK now inherits the Rust runtime's regressions as quickly as it inherits its fixes.
  • decision A team weighing its own TypeScript-to-Rust port has to decide whether a porting team's counterfactual estimate is a defensible planning baseline.
  • precedent Toub's account treats finding and fixing regressions in main as an acceptable cost of rewriting shared infrastructure. That choice moves the risk off a cutover date and onto every week of the port.

The CLI was logically a terminal UI on top of an agent loop, and the whole stack was TypeScript: Node.js as the framework, V8 as the execution engine, Ink and React for the UI [10]. Toub called that "a respectable choice for a TUI application" [11]. For a console program, startup, responsiveness, throughput and memory consumption are reasonable, and he wrote that they are much less reasonable once the same implementation runs in other environments, with demands for fast startup and server density from low memory overhead [12].

Then there is the layering. The CLI was written and shipped quickly, and its TUI and its runtime ended up fairly intertwined instead of separated into discrete layers [13]. When an SDK was needed for programmatic access, it went on top of the CLI, a "pragmatic decision", Toub wrote, "even though logically you'd expect the inverse architecture" [14]. The CLI gained a headless mode that reads similar commands from stdin and writes responses to stdout [15]. A JSON-RPC protocol then marshals function calls from an external process to and from the CLI [16]. The SDK can be embedded in an arbitrary consuming program, and that program spawns a CLI process to host the agent loop out of process [17].

Divide the output by the increments and each change averages about 6,250 lines: more than 800,000 lines of Rust across 128 pull requests that landed in main [3][4][18]. Nobody reads a 6,250-line diff line by line. The post's answer to that is the shipping model, with the work going into main as it landed and the few regressions found and fixed along the way [4][5].

This port started from a working implementation that already backed shipping products [1][2]. The one-developer, few-months figure is set against Toub's own estimate of what the same work would have cost before agents, a whole team and a year or two [6]. The post reports the runtime's performance improving by orders of magnitude and does not include a benchmark [5]. Two numbers would make this usable as a planning input: the share of the 800,000 lines a human wrote or corrected, and the startup and memory figures the Rust runtime now hits.

What to watch

  • Whether GitHub publishes startup and memory numbers for the Rust runtime against the Node.js one.
  • Whether the Rust runtime removes the spawned CLI process and the JSON-RPC hop for SDK consumers.
  • Whether other Microsoft or GitHub teams report agent-written rewrite figures with per-pull-request review data attached.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories