In a merge request (MR) pipeline, a test fails with HTTP 401 Unauthorized from the carrier's sandbox API. The MR changes how the carrier API token is sent. I asked a coding agent to get the pipeline green, and it blamed the MR: three times out of three.

It was wrong. The carrier sandbox had started rejecting every call, and the same test was failing on main too. The agent couldn't know that. It had the code and the diff, but no record of earlier pipeline runs.

So I ran a small experiment. Does a coding agent fix a failing MR pipeline better when it can read the test's history? In 60 runs across 10 scenarios, history changed the outcome in 3 scenarios, and in no scenario did it make things worse.

A disclosure first: I'm building Xping, a test reliability tool for .NET, and the history in this experiment came from it. I built both the tool and the test. Keep that in mind, and check the limits section before you trust any number here.

The setup

The repo is a small .NET storefront with one test project. It has main and ten MR branches, one scenario per branch. In each one, a single test fails in the MR pipeline and the agent gets this prompt: the failing test, the error from the job log, and "Get the pipeline green. Make whatever changes you think are right." It then has to state the cause and what it changed.

Seven failures are not caused by the MR:

  • a slow payment sandbox
  • a slow runner
  • test order (a shared cache)
  • a runner without locale data
  • a starved runner (one core, shared with a busy process)
  • an old race condition already on main
  • a carrier sandbox outage

Three are caused by the MR, and two of them are built to look like something else:

  • a plain regression
  • a slowdown that looks like a slow runner
  • a new race that looks flaky

The CI history is simulated: 99 runs (46 on main) on six Docker containers acting as runners, uploaded to Xping. Each scenario ran 3 times in each condition, so 60 headless Claude Code runs in total.

Both conditions get the same prompt and the same repo, can read and edit files, run dotnet test, and use read-only git. All 60 runs looked at the MR's diff. Neither could reach the CI server. So without Xping, the agent had the code and its git history, but no results from earlier pipeline runs. With Xping, the prompt gains one sentence about the CLI, and the agent may run xping report and xping where.

Scoring. A run scores a point only if both the action and the stated cause are right. Changing nothing but blaming the MR counts as wrong. Each scenario has a written ground truth listing correct, wrong and unclear actions. A change the ground truth doesn't cover is scored unclear.

Results

With history, the agent got 27 of 30 runs right and none wrong. Without it, 21 were right and 4 wrong.

Without history With Xping history
Correct 21 / 30 27 / 30
Unclear 5 / 30 3 / 30
Wrong 4 / 30 0 / 30
Diagnosis right (MR or not) 27 / 30 30 / 30
Runs that loosened the test's timing check 3 / 30 0 / 30

The whole difference comes from 6 runs in 3 scenarios. That's too few to call it significant, so read the table as a direction, not a measured effect. The more useful finding is in what the agents did differently.

What history changed

Without history, agents blamed the MR for an outage. In the carrier scenario, the 401 points straight at the header the MR changed. Without history, all 3 agents left the code alone but named the MR as the likely cause. With Xping, all 3 saw the same test failing on main, which still sends the old header, and reported an external problem.

Without history, agents loosened tests to get green. On the slow and the starved runner, a 250 ms timing check failed for reasons outside the code. Without history, one agent raised the budget to 1000 ms. Two others changed the test to take the fastest of 5 attempts. With Xping, all 6 runs left the test alone and named the runner (runner-03, runner-06).

That second point matters most to me. A loosened timing check makes the pipeline green, the MR merges, and nobody notices the test now checks less.

Right answers got evidence behind them. In the payment timeout scenario, every run left the test alone in both conditions. Without history, each agent said "most likely" and that it couldn't confirm the cause. With Xping, each cited the same timeout on main. Those runs also used 46% fewer tokens.

What history didn't change

Real regressions were still found. The three MR-caused failures were fixed in 9 of 9 runs in both conditions. The two built to look harmless, a slowdown that looks like a slow runner and a race that looks flaky, were found from the code alone. History never led an agent to dismiss a real bug as flaky.

Failures with a cause in the repo were fixed either way. Test order and the old race on main were 6 of 6 in both conditions. The agents found the shared cache and the race by reading the code.

One scenario didn't settle. For the runner without locale data, all 6 agents diagnosed it correctly and then rewrote Money.Format so it no longer needs locale data. My ground truth didn't decide whether that's right, so all 6 are scored unclear.

Limits

This is a pilot. Here's what it doesn't show:

  • The sample is small. 3 runs per scenario and condition. The gap is 6 runs in 3 scenarios (carrier outage 3, starved runner 2, slow runner 1).
  • It's history versus no history, not Xping versus your CI's own history. An agent that could read recent main job logs might have found some of the same facts. I haven't run that condition yet.
  • I designed the scenarios. Seven of ten aren't caused by the MR, which favours the condition with history. How often real pipeline failures look like this is an open question.
  • The history is simulated. Six Docker containers on one machine, with GitLab variables set by hand. All 99 runs were recorded within about 3 minutes, so nothing in it spreads over days.
  • One scoring call could go either way. I scored "fastest of 5 attempts" as unclear, because the ground truth doesn't list it. If it counts as weakening the test, the result without history becomes 21 correct, 3 unclear and 6 wrong. With history nothing changes.
  • Hedged answers count as correct. Without history, agents that left the test alone often said they couldn't confirm the cause. They still scored a point.
  • Xping Cloud has 87 of the 99 seeded runs. 12 of the early main runs are missing, and I haven't found out why yet. The agents quoted what Xping showed correctly, and every pattern they relied on holds in the full seed log too.
  • Cost numbers are soft. Runs with history averaged 14.5% fewer total tokens and 31 s instead of 39 s. Most of those tokens are cache reads, and two scenarios cost more with history, so I don't treat this as a saving.

What's next

The agent didn't need history to find real bugs. It needed history to stop blaming the MR for things outside it, and to stop loosening tests that were right. Both mistakes are easy to miss in review, because the pipeline goes green either way.

Next I'll run the same experiment with:

  1. a third condition: git plus the job logs of recent main pipelines, as the CI server shows them
  2. real repos with real CI history instead of a simulated one
  3. more runs per scenario

The scenarios, ground truths, prompts, and every run's transcript, diff and test output are in xping-dev/agent-ci-history-experiment. If you score a run differently from me, I'd like to hear about it.

And if your team uses coding agents on CI failures: what do they get wrong most often?