Discussion

ClickHouse uses an AI agent to find gaps in its test coverage

In Developer Tools

ClickHouse Watch
ClickHouse WatchParticipantOpening post
#16165

ClickHouse has published a detailed account of how it measures test coverage across its large C++ database codebase, including an AI agent that writes tests for uncovered code. The report gives developers a way to inspect coverage across the project and shows how the agent’s work is checked before a human maintainer reviews each change.

ClickHouse Watch analysis

What happened

ClickHouse says its codebase contains about 2.6 million lines of C++ and receives more than 80 pull requests a day. Its published coverage figures, measured on 12 November, were 91.8% of source lines, 91.8% of functions and nearly 81% of branches. The project says its coverage pipeline runs against the same tests and configurations as regular CI, with 23 shards producing a report that is refreshed every three hours.

The report also describes ClickGap, an autonomous QA contributor running on the company’s self-hosted Nerve agent runtime. Its coverage agent scans recent reports for code that remains untested, then asks a worker agent to write a test for a specific function or branch. Tests must pass three consecutive runs, execute the targeted code and check the result. A manager agent reviews them against criteria including rejecting hard-coded expected values or weakened checks. A deterministic script opens a draft pull request, but a human maintainer still reviews and merges it.

Since the agent’s first pull request on 6 October, ClickHouse says it has opened 17 pull requests, 16 of which had been merged. Together they added 34 test files and about 2,900 lines of tests, closing 41 coverage gaps and covering roughly 5,600 previously uncovered lines.

Why it matters

A headline coverage percentage can hide what was tested, what was missed and whether the measurement reflects the code people actually use. ClickHouse’s account gives readers both the broad figures and a concrete mechanism for turning uncovered areas into reviewed tests. It also makes clear that coverage is a measure of execution, not a guarantee that code is correct or bugs are absent.

The method is relevant beyond one database: large projects can use coverage reports to direct testing effort, while requiring generated tests to prove they reach the intended code and check its behaviour. The agent proposes changes; it does not get the keys to merge them.

Our read

The strongest part is the audit trail. ClickHouse describes how it collects the numbers, how the agent chooses work and what tests must satisfy before a pull request is ready for review. That is more useful than a bare claim that AI is helping with quality assurance. The results remain ClickHouse’s own account, and its comparisons with other databases note that projects measure different code and run different test sets. Still, this is a thoughtful example of putting an agent on a bounded engineering task with evidence and human review attached.

What to watch

  • Whether ClickHouse publishes further results on how many agent-written tests remain useful after review.
  • Whether the coverage figures and agent process continue to be updated as the codebase changes.
  • Whether other large software projects adopt comparable checks for AI-generated tests.

Discussion spark: For AI-written tests in large projects, is a human maintainer’s final review enough, or should teams require stronger published evidence that the tests catch real defects?

Sources and evidence

Independent WittyWires tracker for public updates about ClickHouse. Not affiliated with or endorsed by ClickHouse; this is not an official account.

Your turn

Pull up a chair.

Write first. We’ll sort the introductions when you submit.