A leader node checks once that it is still the leader, then works through a whole batch of expired leases. If it loses leadership halfway through, it can revoke a lease the new leader has just handed to someone else. AWS Project C2 found exactly that bug in a widely deployed key-value store. Amazon unveiled the tool at re:Invent on November 30, 2026: AI agents read the code and its documentation, then automated reasoning checks every possible order of events. AWS says the approach turned up more than 800 bugs across 22 open source projects. For now, access is invite-only.
How AWS Project C2 differs from AI code review
C2 stands for Code Confidence. Marc Brooker, Vice President and Distinguished Engineer, and Principal Applied Scientist Soonho Kong explain the thinking in a detailed post on Amazon’s news site. Their argument is simple. Static analysis and security scanners look for known patterns. AI reviewers and coding agents rely on a model’s judgment. Both miss bugs that only show up under a rare sequence of events.
So C2 splits the job. An agent reads the source and the docs and works out what the system is supposed to do. The service then tries to prove that the implementation actually does it, using automated reasoning, the branch of computer science that uses formal logic to prove or disprove how a system behaves. AWS names the Lean theorem prover as one of the tools. When intent and implementation disagree, either the agent misread the intent and loops back, or it has found a real bug. In that case C2 writes a test that triggers the bug in the real code. Only then does it rate the severity and produce a fix, which is tested and, where possible, proven correct as well.
The proof is what matters here. A fuzzer or stress test samples orderings and hopes to get lucky. A proof covers all of them without running each one. Brooker and Kong compare it to Pythagoras: nobody measures every triangle to know the theorem holds.
Why concurrency bugs slip past testing
Concurrency means several threads, processes or machines touching the same state at once, and the number of possible executions explodes quickly. AWS uses Paxos, a protocol that lets machines agree on a value, as an example: a single round of agreement between three machines can play out in more than 90,000 distinct orders. Add dropped packets, retries and duplicates and the count grows exponentially.
Scale does the rest. Back in 2015, AWS says, it saw a one-in-a-million error happen several times a second. Today the same odds produce thousands of occurrences per second. The bugs also cluster in a telling place: error and failure handling. Those paths rarely run, but they are exactly what a distributed system relies on when hardware fails or a dependency misbehaves.
Three bugs from the open source trial
AWS does not name the projects, but it describes the bugs in detail. In a popular Rust profiling library, C2 found nine thread-safety bugs, including one that could make the reporting thread panic and lose data collected afterwards.
The second case involves an in-memory database that logs every write and asks the operating system to flush each entry to disk. If the flush fails, the database sets an error flag and refuses further writes. A background process, however, could retry the check and clear the flag once the second attempt succeeded, after which the node accepted writes again. On Linux, a successful retry only means that data written after the failed attempt is safe. Whatever was lost in between stays lost, and after a reboot it is gone. Database veterans will recognize the pattern: PostgreSQL ran into the same issue in 2018 and, since its February 2019 releases, panics on a failed fsync by default instead of retrying (the data_sync_retry setting).
The third case is the lease bug from the opening, found in a Raft-based key-value store that sits under a lot of cloud infrastructure. Raft is a consensus protocol in which an elected leader orders all changes. Here the leader confirmed its role only once per batch. AWS calls it a distributed version of the classic TOCTOU bug (time of check to time of use), where state changes between checking a condition and acting on it. Worst case, a cluster meant to run one payment processor ends up with two, and customers get charged twice.
We modelled the lease bug in 65 lines of Python
We could not try C2 itself, since the preview is closed. The principle is easy to reproduce on a small scale, though. This is a model of the lease bug, not a reconstruction of the original Raft store. We wrote a Python script that enumerates every interleaving of two actors. Old leader A checks its role and revokes three expired leases. Meanwhile, the cluster elects B, and B re-grants lease 0. The script counts every ordering in which A revokes a valid, freshly granted lease.
# interleave.py (excerpt): walk through every ordering of two actors
stepsA = ["check", "revoke0", "revoke1", "revoke2"] # old leader, checks once per batch
stepsB = ["elect", "grant0"] # election, lease 0 re-granted
for s in schedules([len(stepsA), len(stepsB)]): # every interleaving, program order kept
... # simulate state
if leases[0] == "new" and A_revokes(0): # valid lease revoked by the old leader
stale += 1
Running it on Python 3.13 gives this:
$ python3 interleave.py
lost update: interleavings=6 bad=4
lease batch interleavings=15 stale_revocations=1
lease per_lease interleavings=28 stale_revocations=1
lease term_checked interleavings=10 stale_revocations=0
orderings 3 threads x 4 steps: 34650
orderings 3 threads x 10 steps: 5550996791340
orderings 52 cards: 8.1e+67
With one check per batch, exactly one of 15 orderings goes wrong. That sounds harmless until you run millions of batches a day: the bad case then happens regularly, just never on a developer laptop. The second line is the interesting one. If the leader checks before every single revocation, the bad share drops to one in 28, but it does not reach zero. There is still a window between the check and the action. Only when the revocation itself is tied to the leader’s term and takes effect solely if the term has not changed does the counter stay at zero. That is the idea behind fencing tokens: the condition has to be part of the same atomic operation, not a step before it.
The last lines show why brute force does not scale. Three threads with four steps each already allow 34,650 interleavings. At ten steps each, it is more than 5.5 trillion. Our script merely counts them, while a proof never has to touch them one by one. That is where the AWS approach comes in. The 8.1e+67 in the last line, by the way, is the number of ways to order a 52-card deck, a comparison AWS uses itself.
What you can do without an invite
You can request access to the gated preview on the Project C2 product page. For now it covers concurrency bugs in “popular programming languages”, and AWS does not say which ones. There is no pricing yet either. Over the coming months, AWS plans to add more techniques, from bug finding to regression testing. Internally, it already runs the approach against Aurora, DynamoDB and Elastic Block Store.
Until then, the existing tools are worth a look. None of them proves anything, but each catches a class of bugs that code review routinely misses:
# C, C++, Go: report data races at runtime
clang -fsanitize=thread -g -O1 server.c -o server && ./server
go test -race ./...
# Rust: loom explores the interleavings of a test
RUSTFLAGS="--cfg loom" cargo test --release
# Python 3.14 without the GIL: run your tests on the free-threaded build
uv run --python 3.14t pytest -x
ThreadSanitizer reports data races that a test run actually hits. The Rust crate loom goes further and systematically explores the possible interleavings of a test, much like our script. For distributed protocols, TLA+ is still the standard, and AWS has used the specification language on its own services for more than a decade. Python teams should pay attention too: since Python 3.14, the build without the global interpreter lock is officially supported, and code that was quietly protected by the GIL loses that safety net.
Our take: a strong method, unverified numbers
The idea behind Project C2 makes sense. Language models are good at inferring intent from code and docs and bad at keeping millions of executions in their head. Proof tools are the opposite. The most useful detail for practitioners is that every finding ships with a reproducible test. A maintainer does not have to trust an AI, they can just run the test. That sets C2 apart from AI reviewers such as Claude Ship, which review pull requests but ultimately rest on a model’s judgment.
The numbers have not been independently verified. As eWeek points out, the written announcement claims more than 800 bugs, while the keynote spoke of nearly 800 reproducible findings, and AWS has published no error rates against other tools. The 22 projects are not named either, so outsiders cannot check the findings. Still, as with DeepMind’s quantum algorithms verified in Lean, the direction is clear: AI agents generate ideas and formal proofs keep them honest. Together with the open-weight Amazon Ergo model and the rest of its re:Invent 2026 announcements, AWS is assembling its own toolchain for agentic software development. If you run distributed systems or heavily concurrent code, sign up for the preview and, in the meantime, put loom, ThreadSanitizer or TLA+ into your CI.




