Inspiration
At 2 a.m., a deadlocked C service gets an AI-written patch. The deadlock disappears, and so does the lock that protected a shared counter. Concurrency fixes are hard to judge by reading them: a patch can remove the visible hang while adding a data race or breaking an invariant. We wanted a repair agent that never asks you to trust the model, only the execution.
What it does
AgentKernel repairs concurrency bugs in C/C++ code and only reports a fix as verified once it passes every gate in a fresh Nebius Sandbox:
- a clean build
- the original tests
- 100 stress runs
- a protected semantic oracle
- 3 ThreadSanitizer runs
- an unchanged scheduling-hook count, so the bug can't be "fixed" by removing the stress points
Every run records the patch, the model reply, tokens, latency, cost and each gate's result. The local Model Lab dashboard runs repairs on your own Nebius keys and shows the full evidence.
Adaptive v4 is the routing agent:
- A deterministic router chooses the model tier from calibration data. A cheaper tier only goes first once measured results show it pays off. Today that means NVIDIA Nemotron Ultra.
- A plain-text line-edit reply format (
@@ REPLACE file a-b … @@ END) instead of JSON, so quotes in C code can't break the reply. - One evidence-directed correction: if execution rejects a candidate, the model gets one more call carrying the failed patch and the exact stress, semantic and TSan evidence.
How we built it
- NVIDIA Nemotron 3 Ultra and Super through Nebius Token Factory (OpenAI-compatible API) propose the edits.
- Nebius Sandbox (Contree SDK, a pinned clang + ThreadSanitizer image) does all compilation and execution. There is no local fallback.
- A Python controller applies a canonical patch to a disposable copy, keeps protected files untouched and runs every gate.
- A budget ledger reserves cost before each paid call and settles or marks it unknown afterwards, with no automatic replay.
- 482 tests, run in Nebius Sandbox (473 passed, 0 failed).
Results (live, 30 October, eight development-seen synthetic programs)
| Run | Result |
|---|---|
| Ultra only (v3) | 6/8 verified, $0.0160 |
| Super → Ultra ladder (v3) | 6/8, $0.0206 (29% more) |
| Super only (v3, JSON format) | 0/8 |
| Adaptive v4, frozen pilot | 5/8, and solved audit_3, which every earlier route failed |
| v4 post-fix re-check | 2/2. On aggregate_3, a rejected patch (92/100 stress, TSan race) was rescued by the evidence correction: 100/100 stress, 3/3 TSan |
Across the two v4 runs, v4 verified every program Ultra alone verified plus audit_3 (seven of eight across the two runs, not one combined run). rendezvous_3 is still unsolved by every route.
Challenges we ran into
- Super scored 0/8 under our first JSON reply contract, mostly because unescaped quotes in C code cut its answers short. We fixed the format before judging the model.
- Two v4 misses in the frozen pilot were bugs in our own code: a parser rule that voided replies containing a no-op edit, and an input limit that refused the correction prompt. We fixed both, published the misses and re-ran.
- A patch can pass stress testing and still fail TSan or the semantic oracle (aggregate_3 did), so model confidence is never accepted as evidence.
Accomplishments that we're proud of
- An agent that plans, writes, tests and iterates on its own verifier evidence, with no human in the loop.
- audit_3, which no earlier route verified, verified under v4 for about a tenth of a cent.
- Every claim is tied to a saved run, including the failures.
What we learned
Execution is the only judge you can trust for concurrency code. The output format matters as much as the model: fix the contract before you blame the model.
What's next for AgentKernel
- Calibrate Super under the new format so the router can send cheap cases to it.
- Larger, unseen C/C++ repositories and application-specific semantic contracts.
- A GitHub pull-request integration that attaches the verification evidence to every fix.
Limitations
These are eight small development programs, not a statistical benchmark. Verification shows the patch survived the gates; it does not prove there are no unobserved bugs. v4 is not yet cheaper than Ultra alone.
Built With
- c
- clang
- contree-sdk
- javascript
- nebius-sandbox
- nebius-token-factory
- nvidia-nemotron
- python
- threadsanitizer
Log in or sign up for Devpost to join the conversation.