AI agents now open pull requests.

Who tests the code?

Add retries to fetch_user #482
CODING AGENT+7 lines✓ ALL CHECKS PASSED
Diff coverage
0%

The checks pass.

An agent wrote the change, opened the PR, and every test went green.

But were the new lines ever run?

A green build only says the tests passed — not that they touched the agent’s code.

01Rebuild
02Measure
03Isolate

Rebuild every PR.

Each patch is reconstructed from its base and head commits, test files split from code.

git diff base..headtest-only patch

Run the whole suite.

Line coverage with JaCoCo and pytest-cov marks each added line covered or missed.

Diff coverage =covered added linesall added executable lines

Pull the agent’s tests.

Reverse-apply its test changes and rerun: the difference is what the agent’s own tests add.

with agent tests
without
Finding 4 · lines inside try / catch blocks

Error handling is the blind spot.

0%
missed in Java
0%
missed in Python
An empirical study of agentic pull requests
How well-tested is
agent-written code?
Finding 1 · PRs that change code

Half ship without tests.

0%
include no test changes
0%
add or modify tests
Finding 2 · agent-changed lines run by the project’s existing tests

The safety net has holes.

0%
Java
0%
Python
64.8%of Python PRs: not one changed line
executed by any existing test
Finding 3 · PRs where the agent also wrote tests

Agent tests help — rarely.

Java
0%

of these PRs gain any coverage from the agent’s tests

+15.6 pp on average
Python
0%

of these PRs gain any coverage from the agent’s tests

+9.6 pp on average
What comes next

Agents that check their own coverage

before they open the PR.

And benchmarks that score whether agents test the code they write — not just whether old tests pass.

Test Coverage Analysis of Agentic Pull Requests

Atish Kumar Dipongkor · Talank Baral · Wing Lam · Kevin Moran
ICSME 2026 · International Conference on Software Maintenance and Evolution · Vision and Emerging Results