A new open‑source tool called Apex Verify can identify whether an AI‑generated code change truly fulfills the original task, catching 86 % of wrong changes that slip past a project's own test suite.
How Apex Verify works
The system takes three inputs – the diff produced by an AI agent, the natural‑language task description, and the project's existing test suite. It then invokes a *different* LLM to synthesize additional checks derived directly from the task text, never from the agent’s own tests. Those checks are first run against the pre‑change code to prove they can fail, discarded if they cannot, and finally executed on the post‑change code alongside the original tests. The tool also scans for cheating patterns such as deleted or skipped tests and test scripts that cannot fail. The verdict is one of “ready”, “not ready” or “unknown”, with detailed evidence printed for each failing check.
A one‑line command (`npx –yes https://github.com/apex-engine-dev/apex-verify/releases/latest/download/apex-verify.tgz verify –demo`) lets users try the gate on a copy of their repository without installing anything permanent, and the tool runs in sandboxed environments (macOS Seatbelt, Linux bubblewrap, Windows AppContainer) for safety.
Benchmark results on real open‑source libraries
The author built a benchmark from 23 open‑source libraries (including jshttp, picomatch, slugify and HumanizeDuration). For each library a historical bug‑fix task was reconstructed: the pre‑fix code, the hidden test that validates the fix, and a set of AI‑generated candidate changes written by Gemini models. In total 107 changes were labeled as correct or wrong using the hidden test, which Apex Verify never saw.
When the gate processed the changes, it stopped 65 % of the wrong ones on the larger set and about 80 % on the smaller set of 17 projects. Overall, 86 % of the 107 faulty changes were flagged as “not ready”. Only 14 of the wrong changes slipped through as “ready”.

False‑positives were limited: on the 93 correct changes the gate incorrectly rejected 10 (≈11 %). A manual audit revealed that six of those were actually mismatches between the upstream test and the task description, leaving an estimated 4 % true false‑positive rate.
Integration points for developers
Apex Verify can be wired into common development workflows. It provides a Claude Code plugin that blocks the agent’s “done” signal until the gate returns a “ready” verdict, a Gemini CLI after‑agent hook, and a GitHub Action that comments a verdict on pull requests and can be set as a required check. Stub integrations for Codex, Cursor, and other IDE‑based assistants are also available, though they have not yet been exercised in a live session.

The tool supports test frameworks across languages – node:test, Jest, Vitest, pytest, cargo test and go test – and can be run in CI pipelines without modifying the original repository because it works on a temporary copy of the code.
Known limitations and open challenges
The gate is not a proof of correctness. It still missed roughly one‑third of wrong changes on the smaller projects and 14 out of 107 on the larger set. Moreover, its effectiveness depends on the check‑writing model; a weak model that writes checks for its own change blocked more than half of the good changes, which is why the author advises using a *different* model for verification.
Requiring two independent checkers to agree did not improve results, and prompting the checker for “obvious unstated cases” produced no benefit. The tool also relies on the availability of an API key for the model that writes checks – typically Gemini or OpenAI – which adds a small operational cost (seconds and cents per task).
Because Apex Verify runs on a copy of the repository and never writes back, it introduces no risk to the original code base, but users must trust that the sandboxed execution environments correctly isolate the checks on all target platforms.
Why this matters for AI‑assisted development
The benchmark shows that existing AI coding assistants can produce changes that satisfy the *visible* test suite while violating the *intended* behavior described in the task. Apex Verify demonstrates a practical way to raise the bar: by automatically generating task‑derived checks with an independent model, developers gain a safety net that catches semantic gaps before code lands in the main branch. This is especially relevant for teams that rely on tools like GitHub Copilot, Cursor or Claude Code to speed up routine refactors, because it reveals a hidden failure mode that standard CI cannot see. The open‑source nature and low entry cost (a few seconds and a modest API fee) make it feasible to embed the gate into everyday pull‑request workflows, turning “AI says it’s done” into a *verified* signal. While the gate is not flawless, its 86 % catch rate suggests that even a partial adoption could dramatically reduce regressions introduced by over‑confident agents, encouraging a culture where AI assistance is paired with independent validation rather than being treated as a black‑box preserver of code quality.
Editorial graphic and headline text by Signal Titans.
Source: The tests passed on all 107 wrong AI changes. Here is what caught 86 of them · GitHub – apex-engine-dev/apex-verify: Catch AI code changes that pass your tests but are wrong. A different model writes the missing checks, proves they can fail, and answers ready / not ready with ev

Leave a Reply