Clearing a Bug Backlog With One Agent per Bug
To fix a bug backlog with AI agents, triage first, then run one agent per bug: each in its own fork of the repository, each told to reproduce the bug with a failing test before fixing it, all asking for the same test command so one answer covers them, and all results collected and reviewed in one place. Bugs that are reproducible and local suit this well; vague, large or cross-cutting bugs do not, and should go back to a person. This article walks through the workflow with Forkit, the coordination system for agent teams.
This is a workflow built from features Forkit has. No bug backlog run has been recorded with Forkit. Each step uses a documented feature, and the closest recorded runs are named where they apply.
In this article, "factory" means a Forkit factory, a saved fan-out that can be run again, not the company Factory.
Which bugs to fix from a backlog with AI agents
Capy's guide to matching agents to a bug backlog makes the point that decides most of this: "A bug fix is only as good as the check that proves it." Cognition's Ido Pesok (29 May 2026) describes the goal for each fix: "What makes it magical is when that PR comes with proof that the fix actually works."
Good candidates:
- The bug has steps to reproduce, or an error with a stack trace
- It can be shown by a test that runs locally in minutes
- The fix is likely in one module or a few files
- Nobody else is working on that area this week
Poor candidates, to keep for people:
- Bugs that need production data or a customer's environment to reproduce
- Flaky, timing-dependent or load-dependent bugs
- Bugs whose real fix is a design change
- Anything touching authentication, payments or data migrations, unless a person will read every line
Capy's guide suggests the agent prompt include: "Ask me first if a bug is unclear or bigger than a day." Put the same rule in yours: an agent that cannot reproduce the bug stops and says so instead of guessing.
Build the items list from GitHub or Linear
Triage the backlog into a list of items, one per bug. Each item needs a title, the body, the issue number or URL, and labels. Linear's webhooks send "HTTP push notifications whenever data is created, updated or removed," including for issues, and GitHub sends issue events too.
A Forkit factory's webhook reduces a GitHub or Linear issue event to one item with the title, body, number, URL, repository and labels. forkit factory template github NAME prints a GitHub workflow for that, and forkit factory template linear NAME prints the setup steps for Linear. For a one-off backlog, write the items as a JSON array in a file instead:
[
{ "number": 412, "title": "Invoice total off by one cent", "body": "…", "labels": ["billing"] },
{ "number": 433, "title": "Date picker ignores locale", "body": "…", "labels": ["ui"] }
]
The factory and its prompt
forkit factory create --name bug-sweep --prompt-file bug.md \
--push --max-cost 30 --max-tool-calls 8000 --ttl 3600
forkit factory run bug-sweep --items-file bugs.json
The template is filled once per agent:
Fix issue #{{item.number}}: {{item.title}}
{{item.body}}
1. Reproduce the bug with a test that fails. If you cannot, stop and say why.
2. Claim the files you will change before editing.
3. Fix it. Run `npm test` until it passes.
4. Hand off: the cause, the fix, the test name.
A runner your team operates starts the agents: forkit factory work bug-sweep --exec CMD --repo-from . runs your agent command once per item, each in an empty folder with its own key, prompt and title. Forkit never runs agents itself.
One fork per agent, claims for shared files
With --push, the runner pushes your checkout as the starting repository, so a private repository works and Forkit holds no repository token. Each agent gets its own fork and a write token that lasts at most 15 minutes. See a repository per agent for why forks beat a shared checkout here.
Two bugs in the same file are common in a backlog. Have each agent claim paths before it edits. A claim that overlaps another agent's is refused and names the holder; the edit under another agent's claim is denied before it happens. The second agent can wait, ask the holder, or send its change as a patch with forkit share for the holder to apply.
The shared command, asked once
Every agent will ask to run the test suite. Write an allow rule for it before the run, and the agents never stop for it. If you would rather see the first request, leave the rule out: identical pending requests from one fan-out (same tool, subject and repository) are shown as one question, and one person's answer settles all of them. In a recorded demo on 17 Nov 2026 on staging (one run), six agents asked to run node --test within 46 seconds and one "Allow once" answered all six. More in grouping identical agent permission requests.
Requests about production, secrets or money are never grouped or answered by a rule. If a bug agent asks to read .env.production to "check the config", a person sees it alone.
Overlapping fixes: conflicts first
Some fixes overlap even with claims, because two bugs share a cause. Forkit's fan-out page puts conflicts first: each pair of agents and file with both line ranges, a Compare link showing the two changes side by side with the colliding lines marked, and "Message both", which posts a person's message on each agent's thread. Below that, each agent's files, lines added and removed, and when it last sent its change, refreshed every 10 seconds.
Before an agent finishes, the Stop hook compares its change with its peers' and holds it if they would conflict, naming the file, lines and peer. Often the right outcome is that one agent fixes the shared cause and the other withdraws.
Collect and merge
forkit fanout collect <fanout-id> ./bugs --merge
This clones the base, fetches each pushed fork as agent/<name>, and merges them one by one into fanout/<name>. Agents whose work conflicts are left as their own branches and the command exits with code 3. Look at those by hand; they are usually the overlapping-cause cases.
Review each fix like any pull request, with the failing-then-passing test as the first thing you read. See how to review agent pull requests.
Report back on each issue
For runs asked for by a GitHub issue through the factory's webhook, forkit factory work bug-sweep --exec CMD --comment posts the run's result on that issue (with GITHUB_TOKEN, or gh); runs started from an items file get no comment. Make the handoff carry what the issue needs:
- Reproduced: yes or no, with the test name
- Cause in one sentence
- Fix: files changed, branch name
- Not fixed: why, and what a person should look at
Then mark the run good or bad with forkit factory verdict RUN_ID good|bad --note "…". Over several sweeps, forkit factory show bug-sweep gives the share of runs judged good, cost per run and seconds per run.
What this workflow does not do
- It has not been run on a real backlog. The features each have tests; the closest recorded runs were a units CLI and research, with 6 and 12 agents (staging, one run each).
- It does not triage for you. Choosing which bugs go to agents is still the most important step.
- Costs are estimates. The dollar budget is Forkit's estimate at list price and can be passed by what agents spend in about 20 seconds.
Sources
- Forkit engineering notes: factories (issue input, templates,
--comment, verdicts), fan-outs, grouped approvals, live per-agent diffs, the merge check, a repository per fan-out agent (collect, exit 3), the recorded demo of 17 Nov 2026 (staging, one run). - Capy, "Matching Coding Agents to a Bug Backlog", https://capy.ai/resources/clear-a-bug-backlog (read 27 Nov 2026).
- Ido Pesok, Cognition, "Verifying Agentic Development at Scale", 29 May 2026, https://cognition.com/blog/testing-development (read 27 Nov 2026).
- Linear, "Webhooks", https://linear.app/developers/webhooks (read 27 Nov 2026).