OpenAI

Over the past year, the size of our monorepo and the demands placed on it have grown at a remarkable pace. It became clear that we needed to rework our source control system to support the scale of concurrent work from Codex.

[1]

We built a new Git repository backend called Pando, without interrupting any engineering work or changing how teams use Git. Today, all development work in OpenAI’s monorepo runs on Pando. Pando was designed to achieve two ambitious goals: first, to scale writes horizontally and optimize for concurrent pushes to a large number of branches; second, to maximize read throughput so that clients can download fast enough to saturate the available network bandwidth.

[1]

We achieved these goals while remaining compatible with the Git protocol and clients, so engineers and agents could adopt Pando seamlessly within their existing workflows. In production, Pando reduced median push latency to roughly one fifth of its previous value. Today, it serves nearly 1PB of Git data per day.

[1]

This post describes our motivation for building a new source control system and why we chose to remain compatible with Git. We compare the system with common approaches to scaling Git and explain why Pando meets OpenAI’s scalability needs in a distinctive way. We also discuss where we are headed and how we will continue contributing to Git to support agent-scale work.

[1]

Why we needed a new source control system

[1]

Codex changed the scale and pace of development at OpenAI, letting engineers work on more things in parallel. That means more branches, pushes, and merges, as well as more fetches and clones from development environments, research jobs, and continuous integration (CI).

[1]

These demands also compound. A single engineer can now prepare several changes destined for CI at once, and each push may trigger multiple jobs that fetch the same commit.

[1]

Starting around the end of last year, the systems supporting the monorepo increasingly struggled to keep up. Fetches and pushes became slow, merges failed, and reliability at one point fell below 90%. Were we hitting the limits of Git itself, or the limits of how the monorepo was being served? Git originated in a community that exchanged kernel patches over email. For more than twenty years, as the way software is built has changed, developers have kept adapting their tools around Git. When our own monorepo began to encounter resistance, it mattered greatly to us whether we could keep building on those foundations.

[1]

We saw a path: keep the familiar workflows while rebuilding the backend so it could handle pushes to different branches in parallel and serve the same history to many readers at once. Building on Git as the basis for source control workflows also means client improvements can benefit users beyond OpenAI. We hoped to contribute these improvements from the Git version we maintain upstream and share them with the broader community.

[1][2]

Git engineering at scale

[1]

Scaling a source control system mainly involves two dimensions: many writers pushing to different branches, and many readers fetching the same history. Pando optimizes for both.

[1]

First, Pando coordinates updates to each branch independently. Unrelated branches can update in parallel, and when a reader fetches a branch, it receives the history needed for that version. The cost is that when a reader looks at multiple branches, it may see them as of different points in time.

[1]

Second, Pando reuses packfiles—Git’s format for compressing multiple objects together—across fetch operations instead of generating a separate packfile for each client. A client may download some objects it already has, but the server can serve the same bytes to many clients with little computation.

[1]

These designs let us scale writes across branches and serve reads from cache. To understand how they work together, it helps to first look at how Git stores and transfers history.

[1]

A primer on Git object storage

[1]

Git must keep two parts of a repository in sync: objects and references.

[1]

A Git repository records file snapshots and the history connecting them as a graph of objects. An object can be a blob, a tree, a commit, or a tag. A blob holds the contents of a single file, while a tree associates names with blobs or other trees to form a directory structure. A commit points to a root tree and zero or more parent commits, forming the repository’s history.

[1]

Objects are identified by a hash of their type and contents. Objects are also immutable: recording a changed file creates a new blob, while unchanged files and directories can reuse existing objects.

[1]

Branches and tags are references (also called “refs”) that point to commits. Committing code on a branch creates a new commit and updates that branch’s reference to point to it.

[1]
Git objects reference each other by ID: commits reference trees, and trees reference other trees and blobs., OpenAI

Git stores objects either “loose” or “packed.” Loose objects live in individual files identified by object ID. Packed objects are stored together in packfiles, which allows similar objects to be stored as deltas relative to one another.

[1]
Git can store blobs as individual files or pack them together, encoding one blob as a delta relative to another., OpenAI

In Git, an object is reachable from a commit if you can find it by following links between parent commits, trees, and blobs starting at that commit. During a fetch, the client tells the server which commits it wants and which commits it already has. The server finds the objects reachable from the wanted commits, excludes objects the client is known to have, and sends the rest as a packfile in the same format Git uses on disk. A full clone starts with no objects, so it must fetch every object reachable in the history being cloned.

[1]

A push transfers objects in the opposite direction and asks the server to update one or more references. The client uses the set of references the server advertises to avoid sending objects the server already has. As a result, a sent pack may depend on existing objects: receiving that pack alone is not enough to reconstruct the new history.

[1]

Replicating a Git repository means making both objects and references available across multiple servers. Before a replica can serve a new value for a reference, it must first serve the objects reachable from that value. Serving also requires coordinating competing reference updates—pushes that try to move the same branch from the same old branch head to different new commits. If a system imposes a single order on all writes to the repository, pushes to unrelated branches may also have to wait on each other.

[1]

Existing approaches to distributed Git serving

[1]

When designing Pando, we evaluated conventional approaches to scaling Git source control: one uses three-phase commit (3PC, a protocol for coordinating commits across multiple nodes) to coordinate reference updates among repository replicas; another orders updates through a shared write-ahead log (WAL, a log of changes written before they take effect) in blob storage.

[1]

Three-phase commit (3PC)

[1]

In the 3PC design we modeled, the Git service keeps full copies of the repository on multiple replicas. When any server receives a push, the incoming packfile is copied and then sent to all replicas in parallel. For the push to take effect, a majority of replicas must accept the reference update. The server coordinating this process is the coordinator, and it needs multiple rounds of communication with each of the other replicas.

[1]

To accept a reference update, each replica locks its copy of the reference and checks that it still points to the commit the client expects. The coordinator then sends a pre-commit message to the replicas that accepted the update. Once a majority of replicas acknowledge the pre-commit message, the coordinator tells them to perform the update. After that, any updated replica can advertise the new branch head based on its local copy of the repository.

[1]

Keeping full copies allows reads to be served locally and ensures that a client sees a consistent view of all references no matter which replica it selects. In exchange, references can only be updated one at a time, and each push requires multiple round trips to coordinate the reference update across replicas.

[1]

Because a push must wait for a quorum of replicas to respond, replica disk performance and communication latency become constraints on the push path. As write volume grows, replicas must both keep up with incoming packs and handle read traffic.

[1]

Write-ahead log (WAL)

[1]

In the WAL design we modeled, the Git service uses a shared manifest in blob storage to order updates to the entire repository. When a server receives a push, it uploads the incoming packfile to blob storage and prepares the reference update in its local copy of the repository. For the push to take effect, it adds an entry to the shared manifest in blob storage that records the reference update and points to the corresponding packfile. The Git server then updates the manifest with a compare-and-swap operation, which either replaces the manifest atomically or rejects the change. If another writer updated the manifest in the meantime, the server reads the entries added in between, checks whether its own reference update is still valid, and retries with the uploaded packfile.

[1]

Writers can upload packfiles in parallel, but even pushes to unrelated branches must update the same manifest. The round-trip time required for a successful compare-and-swap limits how often the repository can publish a new manifest. Low-latency blob storage speeds up this step. Batching allows one manifest update to update multiple references at once, at the cost of queuing updates and adding latency.

[1]

Blob storage can accept packfiles in parallel, but updates to the shared manifest still contend with one another. Adding blob storage capacity alone cannot remove this bottleneck. Each replica must still read packs from blob storage and build indexes before it can serve them locally. If writes arrive faster than this work can be done, replicas fall behind and clients wait longer to fetch a just-pushed commit.

[1]

Pando’s architecture

[1]

So we built Pando: a new architecture for serving Git repositories, designed to scale to operations where many clients push concurrently. It works as follows:

[1]

Revisiting the constraints

[1]

Even before building Pando, we had a hunch that we could meet our needs without giving up Git. But we did need to trade away requirements that most Git systems treat as essential:

[1]
  • Global repository consistency: providing a consistent snapshot of all references at a single point in time requires coordinating across the entire repository. In a system that orders all reference updates, pushes to unrelated branches also contend on the same coordination point.
  • A dedicated packfile per client: if two clients with different local histories fetch the same branch, the server may need to generate different packs to avoid sending objects a client already has. Producing these responses consumes CPU and disk I/O, making it hard to scale to many readers.
[1]

Instead, Pando uses a looser consistency model (causal consistency) to scale writes and reuses packfiles to scale reads.

[1]

Causal consistency (CC)

[1]

When a client pushes to a branch, Pando saves the incoming packfile as an immutable blob in blob storage. Every time a branch’s target changes, Pando records a reference version in a metadata store, containing the new branch head, the pack that provides it, and all earlier reference versions that pack depends on. Both blob storage and the metadata store scale horizontally.

[1]

Fetching commits or references from Pando replays a set of reference versions (packfiles) to the client, reconstructing the state the client that created the fetched reference version had at the time. This lowers consistency across the repository as a whole while guaranteeing serializability of updates to a single reference. Clients conflict only when they push to the same reference at the same time. When a client reads multiple branches, it cannot assume those reads reflect the repository at a single point in time.

[1]
A push to main adds an incremental pack containing one or more commits. Each push to a side branch includes that topic’s earlier commits again. As a result, a client that has the advertised main version can fetch the topic with a single pack., OpenAI

This is one form of causal consistency. To fetch a reference, a reader observes the history of the writer that produced that reference. During a push, Pando controls the common history the client and server agree on, making the packfiles the client generates easier to share.

[1]

Pando therefore does not provide a single-point-in-time view of all references during Git operations, nor does it guarantee the order of reference updates within a clone or fetch. Concretely, suppose branches foo and bar are both updated during the negotiation of a full clone. During that negotiation, one client might observe foo at version 1 and bar at version 2, while another client sees foo at version 2 and bar at version 1. In practice, users and agents do not rely on a global order of reference updates; they rely on the update order of a single reference.

[1]

Comparing the approaches

[1]

In this simulation of three consistency models, we configured 1,000 clients, each choosing a different branch, then repeatedly pushing commits unique to itself, and measured both wall-clock time and push-to-fetch latency. The latter is an important measure of the workload because it reflects the round-trip time users and agents need when collaborating or using other systems that depend on version control. The simulation covered virtual machines and blob storage systems ranging from modest to high-end configurations. In this simulation, we relaxed the 3PC requirement for global repository consistency.

[1]

Simulated Git server implementation: tracks each writer pushing repeatedly and separately measures when an independent reader can check out each commit.

[1]

Under load, the 3PC system in the simulation showed significantly higher write latency as disks saturated; the WAL system likewise showed significantly higher read latency for the same reason, because servers struggled to read the log in time. Both in our measurements on the monorepo and in this simulation, Pando supported thousands of concurrent clients and more without degrading performance under load.

[1]

When handling a push, Pando streams the incoming packfile into blob storage while validating it, without unpacking it into a local repository. When a client fetches, Pando selects the stored packs the reader needs, and the reader downloads them. No server needs to apply packfiles to a local repository or perform costly unpacking and repacking. Because Pando servers mainly perform negotiation and pack selection, they can run on ordinary hardware.

[1]

This lets Pando keep scaling until it reaches the capacity limits of the clients, the network between clients and Pando, or the blob storage service. As long as capacity is sufficient, clients working on independent branches can transfer packs at the highest speed their connections allow. To serve more clients at that rate, we can add Pando servers and scale the metadata store and blob storage along with them.

[1]

Pushing and fetching branches in Pando: Pando stores the writer’s packfile in blob storage and records a reference version in the metadata service. On fetch, Pando selects the packs the reader needs, and Express serves them.

[1]

An agent edits files locally and creates a commit, then runs git push, packing those changes into a packfile to update the branch. Pando receives the pack and streams it into blob storage. After validating the incoming push with a single-pass decode, Pando records the reference version in the metadata store using a multi-key transaction and updates the reference pointer atomically. This lets Pando provide read-your-writes consistency. The entire write operation requires O(1) metadata reads and writes.

[1]

When another client fetches that branch, Pando selects a set of stored packs based on the history the client already has. This operation requires O(log Δ) metadata reads, where Δ is the shortest distance, measured in reference versions, between the version the client has and the version it needs. The server returns packfile URIs, and the client downloads the packfiles through the Express service, which stores them in a regional cache.

[1]

This design relies on three core services in Pando’s architecture: push, fetch, and compaction.

[1]

Scaling pushes

[1]

When a client pushes, a traditional Git server is like a poker player laying all its cards on the table: it shows the client every branch it has. The client then gathers commits, trees, and blobs, creates a packfile, and excludes objects it knows the server already has.

[1]

Advertising more references can reduce the amount of data pushed. But it can also make packs harder to reuse, because other clients may lack the objects the writer omitted.

[1]

Pando takes a different approach. Instead of showing all its cards, it advertises only a selected set of branches to the client, for two reasons:

[1]
  • Providing a consistent view of all references is expensive. When the number of branches reaches millions, the reference advertisement alone can exceed 100MiB. To provide that view, each server must either maintain an up-to-date mapping with substantial coordination overhead or run database queries whose cost grows with the number of references.
  • Advertising only a subset of references to the client makes the pack the client generates depend only on objects the server explicitly allowed it to exclude. By tracking dependencies, Pando can reuse a packfile a client generated during a push as the response to a later fetch request.
[1]

The more references a Git server advertises, the more grounds the pushing client has to exclude objects and produce a smaller pack. However, to reuse those packfiles, the server must confirm that the fetching client has all the dependencies. Otherwise, the packfile may omit objects the client needs.

[1]

On the other hand, if a Git server advertises no references at all, the client generates a packfile containing the repository’s entire history. Any other client can use that packfile, but at great cost: fetching any branch is effectively a full clone.

[1]
The more references advertised, the smaller the resulting packfile. Advertising just one reference can achieve most of the size reduction., OpenAI

By default, when a client pushes a new feature branch, Pando advertises only one designated mainline branch as the base. This keeps the advertisement size constant even as the repository’s branches keep growing, but it too involves a tradeoff. When an engineer pushes to the same branch repeatedly, or stacks one feature branch on top of another, the client must resend everything outside the mainline.

[1]

That makes subsequent branch pushes larger, potentially including redundant objects and consuming extra client bandwidth. In our monorepo, packfiles generated this way have a median size below 20KiB and a 99th percentile below 3MiB. For us, this is a reasonable tradeoff because a reader that already has the advertised mainline history can fetch the branch with just that one packfile.

[1]

Once Pando has chosen the set of references to advertise to the client, it accepts the push and updates the metadata store. Pando splits metadata updates into synchronous and asynchronous parts. Synchronous metadata updates ensure the client can immediately fetch the commit it just updated. This step writes a new reference version and updates the reference pointer mapping to point to it, storing the new branch head, the dependencies used when negotiating the packfile, and a link to the pushed packfile.

[1]

Meanwhile, asynchronous work such as scheduling compaction is recorded in the same transaction. For very large pushes, only some commits are written synchronously. This keeps the number of metadata store reads and writes constant regardless of push size.

[1]

Importantly, Pando servers can accept pushes to unrelated references independently. The only key that contends is the reference pointer, which we protect with an atomic compare-and-swap-like operation. We can increase write throughput by adding Pando servers, metadata store scaling units, or blob storage.

[1]

Line-rate fetch and clone performance

[1]

When a client fetches, it gives the server two sets of commit IDs, called “have” and “want” in the protocol. A traditional Git server computes the difference between objects reachable from the wanted commits and objects reachable from the commits the client has, compresses it, and sends it to the client. Although open source Git servers maintain various local indexes to speed this up, generating these packfiles can be computationally expensive and is often hard to cache effectively.

[1]

Pando instead uses the commit mappings recorded during pushes to look up the client’s have and want, resolving them into a set of reference versions that contain those commits. Each reference version is associated with a packfile Pando received earlier. From this, the server determines what the client needs and selects the packfiles that cover the set of objects the client requires.

[1]

Planning a fetch in Pando: Pando compares what the client already has with what it needs, then selects the stored packfiles required, including all missing branch dependencies.

[1]

The Git protocol allows only one packfile in the HTTP response to a clone or fetch. However, an underappreciated feature of the Git protocol, “packfile-uri,” lets the server return links so that other packs can be downloaded separately. Pando relies entirely on this: the response body carries only an empty packfile. To support this, OpenAI contributed several improvements to packfile-uri upstream.

[1]

OpenAI’s systems run in multiple geographic regions, so we maintain Pando clusters with local caches in each region. The pack distribution service Express caches blob storage, while a separate service caches the metadata store. With these caches, Pando can respond to requests for commit IDs or special reads of references entirely from the cluster’s cached state. We route packfile requests to Express servers using consistent hashing, achieving a cache hit rate above 99%.

[1]

This caching system delivers very high throughput, enough to saturate the network bandwidth between clients and Pando. We have verified that, with these packfile URIs and local caches, clone and fetch operations can saturate a 10Gbps network link even using only a cloud provider’s standard virtual machines.

[1]

Compaction and time to first byte

[1]

For most Git servers, repacking and garbage collection are necessary to maintain performance as a repository grows. Both steps reclaim space, but both also require significant compute and I/O resources.

[1]

For a frequently updated repository such as OpenAI’s monorepo, sending a separate packfile URI for every push since the last fetch is not viable. Otherwise, clients would have to download tens of thousands of packfiles a day just to bring their local mainline up to date.

[1]

To reduce this overhead, Pando merges packs in the background, using a design similar to compaction in a log-structured merge tree. Each push produces a Pando “L0” packfile, the smallest unit of data Pando can transfer. Over time, background workers group these packfiles into coverage sets that span a range of reference versions, growing geometrically in size starting from L0. Today, our monorepo uses packfile coverage sets up to L4.

[1]

These coverage sets serve two purposes. Once a coverage set accumulates enough content, a compaction worker claims it and produces a single packfile. Rearranging the objects in the packfile improves compression. At the same time, the coverage sets act as a skip list over reference versions, improving fetch negotiation performance. By scanning the indexes of each level together, Pando can select a set of packs to send to the client in logarithmic time. Whether or not repacking has occurred, these packfile coverage sets provide a more efficient solution for fetch planning, lowering Pando’s throughput and latency requirements.

[1]

Compaction in Pando: small packfiles merge level by level into larger coverage packs, improving compression and speeding up fetches.

[1]

Unlike many Git servers, Pando keeps the packfiles at every level rather than discarding them or garbage collecting them. Depending on the have and want a client provides in a fetch request, packs at every level continue to serve clients. For clients using Pando through the API, reading an arbitrary object from a packfile usually requires less data from L0 than from L4, because the object is less likely to have been compressed.

[1]

Pando’s compaction both substantially reduces the total data transferred to clients and keeps pack planning overhead growing sublinearly with how far behind a client is. This matters especially for large, fast-moving repositories, which we expect to become the new normal for software development.

[1]

Building Pando

[1]

We built Pando with Codex, going from project kickoff to production in just 10 weeks. One engineer designed Pando’s core, multiple agent teams implemented it, and a few engineers deployed it. Pando began serving production traffic in April of this year, as part of the large source control toolchain OpenAI uses.

[1]

We used several approaches to validate Pando’s design. We applied the principles in building more secure software foundations. As a greenfield project, we chose to implement Pando in Rust with no legacy dependencies. We wrote a conformance suite so agents could test their changes against standard Git behavior. We also built a deterministic simulation test harness to check system invariants and properties, finding and mitigating subtle race conditions and regressions in negotiation and pack planning.

[1][3]

Many models contributed to the system; whenever a new model came online, we used it to improve Pando’s performance and reliability. With GPT‑6 Astra, agents wrote Lean and TLA+ formal descriptions, establishing a “Pando theory.” We used it to find and fix defects in the implementation while proving system properties. Multiple sessions ran continuously for hundreds of hours, repeatedly finding and fixing edge cases in Pando. We also ran agents around the clock, using models with Daybreak capabilities to red-team Git and Pando.

[1]

Deploying Pando

[1]

In its initial deployment, Pando ran as a read-through, write-through proxy in front of the existing source control system. This kept Pando in sync with the existing system and let us migrate traffic to Pando safely without downtime.

[1]

As part of its caching design, Pando can also deduplicate and coalesce requests before forwarding them through the proxy. This let us keep existing tools working while migrating systems to Pando one at a time. As more workloads moved to Pando, their pushes filled Pando’s cache and also improved the reliability of the original backend.

[1]

To optimize performance with Pando, we began pushing our publicly released Git distribution to developer machines and embedding it in the ChatGPT desktop app. We migrated clients to Pando in stages through an internal Git command-line (CLI) wrapper. We also built many other tools for change requests, code review, and automation APIs. Alongside Git traffic, we migrated hundreds of integrations that depended on legacy APIs, webhooks, and repository download files.

[1]

Codex itself also helped developers and teams complete the migration. We created skills that prepare existing checkouts for migration and guide agents in using the new system. As a result, developers only needed to ask Codex to migrate their development environments and services.

[1]

After switching to Pando, merge reliability improved and median push latency dropped by nearly 80%.

[1]

With just a small number of CPU cores, Pando serves 1PB of Git data per day. In one hour, Pando served more than 57TB of Git packs, with more than 99% of the data coming from local disk cache.

[1]

By reusing packs, many clients can download the same repository history while service nodes perform very little computation. This case involves a single repository, but Pando’s design can support many more. As demand grows, we can scale data distribution and Git negotiation independently.

[1]

Giving back to Git

[1]

Building Pando on the Git protocol and client helped us find defects in Git itself and opportunities to improve its performance.

[1]

For example, because Pando serves reusable packs directly to clients, downloading those packs and building indexes became critical to fast, reliable operation. This work exposed edge cases in concurrent downloads, cleanup after interrupted transfers, and resuming completed downloads. We fixed these code paths, added validation when accepting existing packs for fetches, and contributed these changes upstream.

[1]

We also needed to understand where time and bandwidth were going, so we added tracing for packfile-uri downloads and byte counters during pack generation, making it easy to tell whether a slow fetch was spending time generating packs or transferring them.

[1]

In the Git version OpenAI builds, clients can download independent packs in parallel and build their indexes. We introduced the concept of “explicit have,” letting the server separately advertise a branch’s current head commit and the history a pushing client may omit from its pack. On Pando, this helps clients use --force-with-lease to check that a feature branch has not changed while building a pack based only on the mainline. Afterwards, any client with that mainline history can use the same pack to fetch the branch.

[1][2]

Some of these improvements have landed in upstream Git, and many others are published in our public repository. We will keep working with the Git community so these improvements deliver value beyond Pando. You can follow the work through our public patch tracker.

[1][4]

Looking ahead

[1]

By revisiting conventional assumptions about scaling Git repositories, Pando lets us scale the monorepo without changing the Git workflows engineers and agents already use. In our monorepo, Pando has increased parallelism and merge reliability and shortened the time needed to ship code changes. Beyond the monorepo, we are exploring other uses for Pando inside OpenAI, including workloads that require many agents to collaborate in a shared Git repository.

[1]

As engineers and agents produce more software, more teams beyond OpenAI will encounter the source control bottlenecks we ran into. We are exploring how to share the technology behind Pando with users.

[1]

Pando builds on two decades of experience accumulated by Git repository users and operators. We will keep developing Pando while working with the open source Git community to share optimizations that benefit Git users broadly.

[1]