Complete AI Training
Sign inGet my AI kit

Your job's AI kit

Get your AI kit

Tell us who you are and what you do. We show you your kit right away and email you the link: skills, prompts, AI agents, MCP servers and courses for your job.

500+ jobs ready, and we make a kit for any other job. No payment needed to look.

Share

AI agent for software developers

Bug Fix With Failing Test Agent

A fix in a branch with a test that proves the bug is gone and nothing else broke

Bug Fix With Failing Test Agent: what goes in, what the agent does and what you get

What it does

A good bug fix starts with a test that fails because of the bug, but under pressure developers often skip it and the bug returns. When a bug ticket is assigned, this agent reads the ticket, logs and stack trace, searches the code for the likely cause, and writes a test that reproduces the reported behavior. It runs the test to confirm it fails with the reported error. If it does not, it revises the setup or inputs, or reports what environment data is missing. It then drafts the smallest fix that could work in a branch and runs the new test plus the full suite. If anything fails, it reads the output, adjusts the fix and runs again. The developer reviews the change and opens the pull request. Edge case: if the bug cannot be reproduced locally, it returns questions to the reporter instead of guessing a fix.

How it works

Follow the arrows from top to bottom. The orange dashed arrow is the loop: when a check fails, the agent goes back and tries again.

Start and resultWhat it doesA check on its own workWaits for your OKGoes back and retries
Yes, continueYes, continueApprovedNoNo 1 STARTS WHEN Bug ticket assigned 2 USES A TOOL Read ticket, logs and stack trace and search thecode 3 DOES Write a test that reproduces the bug 4 CHECKS THE RESULT Does the test fail with the reported error? If not: revise the test setup or inputs until itreproduces the bug, or report missing environment data.Back to step 3. 5 DOES Draft a fix in a branch 6 USES A TOOL Run the new test and the full suite 7 CHECKS THE RESULT Do all tests pass? If not: read failures and adjust the fix. Back to step5. 8 YOU APPROVE Developer reviews and opens the pull request 9 RESULT Branch with fix and regression test
Read the steps as a list
  1. Bug ticket assigned
  2. Read ticket, logs and stack trace and search the code
  3. Write a test that reproduces the bug
  4. Does the test fail with the reported error?If not: revise the test setup or inputs until it reproduces the bug, or report missing environment data. Back to step 3.
  5. Draft a fix in a branch
  6. Run the new test and the full suite
  7. Do all tests pass?If not: read failures and adjust the fix. Back to step 5.
  8. Developer reviews and opens the pull requestThe agent waits here for your OK.
  9. Branch with fix and regression test

How it decides

It only accepts a reproduction test that fails with the reported error, and only accepts a fix when the full suite passes.

  • No fix without a failing test first
  • Smallest change that passes is preferred
  • Unreproducible bugs return to the reporter with questions

Make it yours

Every agent is a starting point. You choose these settings for your own situation.

  • Test framework
  • Maximum fix attempts (default 3)
  • Branch naming
  • Whether to run full or affected tests

What keeps you in control

It always asks you first

  • Opening the pull request
  • Merging

Hard limits

  • Works only in a branch
  • Never merges or deploys

It stops when

  • Done: fix and test in branch
  • Stop: cannot reproduce after three attempts

Set it up

We guide you through the set-up, step by step

Members get the full set-up guide for this agent. No technical skills needed: you copy, paste and upload.

10 minto set it up in your AI
5 AIsChatGPT, Claude, Copilot, Gemini, Grok
  • One set of instructions to paste into your AI, with the clicks for ChatGPT, Claude, Microsoft 365 Copilot, Gemini and Grok
  • The agent then walks you through connecting your own data, one source at a time
  • A downloadable copy with the flow chart, the rules and the full guide
Get access to this agent

An example run

What happensTicket 4418 reported a crash when an order had zero items. The agent's first test passed, so the reproduction check failed. It added the discount code from the logs and the test then failed with the same null error. The first fix broke a tax calculation test. The agent moved the null check earlier, and the full suite of 1,240 tests passed. The developer opened the pull request.

More agents for software developers