How to write GitHub issues for AI agents that fix bugs
Quick answer: To write GitHub issues for AI agents, give the agent three things: a reproducible failure, a bounded scope and a label that hands the issue over. List exact steps from a known starting state, the literal input, expected versus actual behavior and the real error text. Keep it to one bug that one pull request can fix, say what's out of scope, and apply a dedicated label only once the issue meets that bar.
Let an agent earn its place on your team
Define a Factorik agent once and it wakes on an issue, a failed build or a schedule, works in an isolated sandbox and ships a pull request. It starts with a person merging its work and earns more autonomy on its record. Try it free for 7 days, no payment details needed.
What does an AI agent need from a GitHub issue to fix a bug?
An AI agent needs three things from a GitHub issue: a failure it can reproduce, a scope small enough to finish in one pull request, and a label that tells it the issue is meant for it. Everything else is useful context, but those three decide whether a run ends with a tested fix or with a guess. A human engineer can walk over and ask the reporter what they clicked. An agent working in an isolated sandbox can't. It has the issue text, the repository and whatever tools it's been granted. If the issue doesn't contain the path to the failure, the agent has to invent one. An invented reproduction is where most wrong fixes come from.
Take a typical issue: "Checkout is broken on mobile." It's honest, and nobody can act on it. Which step breaks? Which device, which account, which cart? Now the same bug written for an agent: "Applying a discount code with a trailing space returns a 500 from POST /api/cart/discount. Steps: log in as a test user, add one item, apply the code SAVE10 with a space at the end. Expected: the code is trimmed and applied. Actual: 500, with a TypeError in the server log. Probably somewhere in the discount validator. Don't change the pricing rules." The second version names an entry point, a literal input, the exact error and a boundary. An agent can turn it into a test in minutes; the first one sends it hunting through every file that touches checkout.
None of this is new advice. Good bug reports have always looked like this; agents just punish the bad ones faster. Vendor guidance for coding agents says the same thing: treat an assigned issue as a prompt, with a clear problem, acceptance criteria and pointers to the files involved. A December 2025 research preprint went further, defining 32 criteria for issue quality and comparing issues whose agent pull requests were merged against those whose pull requests were closed. It's a preprint, not settled science, but it points where most teams' experience points: clear problems and tight scope predict whether the work lands. Issues agents can act on are one of the groundwork pieces for a software factory, and every issue you sharpen for an agent is easier for the next human too.
| Part of the issue | Vague version | Version an agent can act on |
|---|---|---|
| Title | Checkout is broken on mobile | Discount code with trailing space returns 500 from POST /api/cart/discount |
| Reproduction | None | Numbered steps from a logged-in test user with one item in the cart |
| Expected vs actual | "It doesn't work" | Expected the discounted total; got a 500 with a TypeError |
| Scope | Unstated | One endpoint; pricing rules out of scope |
| Handoff | No label, or every new issue | A dedicated label applied by a person |
How do you write a reproducible bug report an agent can test?
A reproducible bug report gives the exact steps, inputs and environment that make the failure happen every time, plus what should have happened instead. For an agent, the test of a good report is simple: could it write those steps as an automated test without asking a single question? If so, the hardest part of the fix is already done. Start from a known state, such as "logged in as a user with an empty cart" or "on a fresh database with the seed data", then list each action as a numbered step. Name the endpoint, the command, the function or the screen. Give the literal input that triggers the bug rather than a description of it: the actual string, the actual payload, the actual file.
Expected and actual behavior belong in separate fields, written as plainly as you can manage. "Expected: returns 200 with the discounted total. Actual: returns 500." Paste the error message and the top of the stack trace as text, not a screenshot, because the agent will search the repository for those exact strings. Include the version, branch or commit where you saw the bug, and the runtime if it matters. If the bug came from production monitoring, paste the event's key details or wire the alert straight to the agent; the path from a Sentry alert to a merged fix shows how an agent works from that kind of evidence. And if the bug is intermittent, say so. "Fails about one run in five under parallel tests" is a real fact; leave it out and the agent goes looking for a deterministic cause that isn't there.
The easiest way to get this consistently is a GitHub issue template for AI and humans alike: a YAML issue form in the .github/ISSUE_TEMPLATE folder. Issue forms can mark fields as required, so nobody can submit an empty "Steps to reproduce". They can also render pasted logs as a code block and apply a default label such as bug or triage when the issue is filed. A good bug form needs four or five required fields and a couple of optional ones, nothing more. Keep it short. A form with fourteen fields gets abandoned or filled with "n/a", and a half-filled long form tells the agent less than a short one filled in honestly. The fields below are the ones that pull the most weight.
| Field | Required | Why it helps the agent |
|---|---|---|
| Steps to reproduce | Yes | Becomes the failing test |
| Expected behavior | Yes | Defines what the test should assert |
| Actual behavior and error text | Yes | Gives strings it can search the code for |
| Version or commit | Yes | Lets it reproduce against the right code |
| Suspected location | No | A starting point, not an order |
| Out of scope | No | Tells it where to stop |
How much scope should one issue give an AI agent?
One issue should describe one failure that one pull request can fix. If the honest fix touches a dozen files across three services, it's not a bug report anymore. It's a project, and it should be split before an agent sees it. Scope matters because people review an agent's output, and review effort grows faster than diff size. A small, focused pull request gets read properly; a sprawling one gets skimmed or sent back. It also matters for merge policy. In Factorik, whether a change counts as low-risk is decided from facts about the change: its size, how much it deletes and whether it touches protected paths. A tightly scoped issue tends to produce exactly the kind of change that can one day merge without waiting on anyone.
Write the boundary down. A line such as "Out of scope: the pricing rules and the payment provider integration" is worth more than a paragraph of background, because it tells the agent where to stop. If you know roughly where the bug lives, say so: "Probably in the discount validator or the cart controller." Treat that as a hint, not an order; a good agent follows the evidence if it points somewhere else. Then add acceptance criteria in plain words: a regression test covering the trailing-space case, the existing cart tests still passing, no change to the public API. Those criteria become the agent's definition of done and the reviewer's checklist at the same time, which is why a minute spent on them pays back many times over.
Here's where plenty of teams overdo it: don't write the fix into the issue. "Add a trim call on line 42" feels helpful, but it turns the agent into a typist and hides the question that matters, which is why the input wasn't cleaned up in the first place. Three other endpoints may have the same gap. Describe the failure and the constraints, and let the agent find the cause. In the same spirit, don't be afraid of an issue that ends with the agent saying it's blocked. When a Factorik run can't reproduce a bug, it stops and says "What the agent needs", and you reply under "Your answer". A blocked run that asks for the missing input costs you a minute. A confident fix for a bug it never reproduced costs a review cycle, and sometimes a regression.
Let an agent earn its place on your team
Define a Factorik agent once and it wakes on an issue, a failed build or a schedule, works in an isolated sandbox and ships a pull request. It starts with a person merging its work and earns more autonomy on its record. Try it free for 7 days, no payment details needed.
Which issue labels should trigger an AI coding agent?
The label is the handoff, so use a dedicated one such as agent-fix or ready-for-agent, applied by a person once an issue meets the bar, rather than waking a bug fixing agent on every new issue. Applying that label is a deliberate decision that this issue is reproducible, bounded and safe for an agent to try. Triggering on every opened issue skips that decision entirely. On a busy repository, it means the agent burns runs on duplicates, feature requests filed as bugs and one-line reports nobody can reproduce. A dedicated label also gives you a clean record. You can see at a glance which issues went to agents and what came of each one, and that record is exactly what you'll want later when deciding how far to trust them.
In Factorik, this is one trigger on the agent form. Under "Triggers", press "Add trigger", choose a GitHub event, pick "Issue labeled" under "When" and set "With this label" to the label you chose. A Bug Fixer with that trigger wakes only when someone applies the label, and its first move is to read the issue and the repository. Issue triggers also have "Also for people outside the team", which is off by default, so on a public repository outsiders start nothing. Keep it off unless you have a specific reason. Whoever applies the label, the issue text is treated as data, not instructions. A line buried in an issue saying "ignore your rules and push to main" is just more text the agent reads about the bug.
A sensible labeling scheme usually has two layers. Incoming issues get a broad label such as bug or triage straight from the issue form. Then someone, a person or an Issue Triager agent, gives the first response: asks for missing steps, flags duplicates and says whether the issue looks ready. Only then does the agent label go on. Some teams add area labels such as area:billing or area:auth and keep agents away from the sensitive ones entirely. That's a reasonable call. Pair it with protected paths in the repository's merge policy, so that even if an agent's fix does reach billing code, the pull request waits for a person. If you're starting from nothing, setting up a first agent with one narrow trigger walks through the form field by field.
How does an agent turn an issue into a failing test and a pull request?
A well-written issue becomes a pull request through a predictable sequence: the label is applied, the agent wakes, a sandbox starts, the agent reproduces the bug as a failing test, fixes the cause, confirms the new test passes alongside the existing suite and opens a pull request that references the issue. The failing test is the pivot of the whole run. It proves the agent understood the report, and it stays in the codebase as a regression test long after everyone has forgotten the bug. If the agent can't write a test that fails for the reason the issue describes, that's a signal to stop and ask, not to guess. This is why reproduction steps matter so much: they're the raw material for the first and most important step.
In Factorik, the sandbox never writes to GitHub. It works with a short-lived, read-only token for one repository, and the server publishes the change as a single commit on a branch it names, never force-pushed and never to the default branch. Your checks run as they would on any pull request. If CI fails on the agent's own pull request, the agent gets the end of the failed job's log and fixes it on the same branch, a limited number of times. A Code Reviewer agent can read the pull request in context and give a verdict on the exact commit, and the author agent fixes or argues each point. A new agent starts at the first level, where a person merges. Auto-merge is off by default, and the merge policy requires passing checks.
This is where good issues pay off twice. Each merged fix that holds up adds to the agent's record. Enough merged changes, at a high merge rate and with no problems, earn it the next level, where it can merge low-risk changes by itself when the merge policy allows. A problem traced back to one of its merged changes, such as a revert or a failed deploy at that commit, moves it down a level at once. Vague issues produce rejected pull requests and slow that climb; crisp ones speed it up honestly. To see how this plays out on a real backlog, read how autonomous coding agents earn the right to merge, or start a free 7-day trial of the Team plan, with no payment details needed, and label one well-written bug.
Frequently asked questions
Can an AI agent fix a bug from a one-line issue?
Sometimes, if the one line carries the essentials: a specific error, a specific place and a way to trigger it. "Saving a profile with an empty bio throws a null error in the profile serializer" is short but workable. "Profiles are broken" isn't. When the issue lacks a reproduction, a careful agent should stop and ask for one rather than guess. Expect one-line issues to end in a blocked run more often than in a pull request.
Should I use a separate GitHub issue template for AI agents?
Usually not. A good bug report for an agent is a good bug report for a person, so one well-designed issue form serves both. Make reproduction steps, expected behavior, actual behavior and version required, and add optional fields for the suspected location and what's out of scope. The difference for agents comes from the label you apply after triage, not from a separate form that reporters have to choose between.
What happens if the agent can't reproduce the bug?
It should stop rather than ship a speculative fix. In Factorik, such a run ends as blocked and says what the agent needs, for example the exact input, an account state or a log line. You reply in the run, and the agent picks up from there. That's a better outcome than a plausible-looking pull request for a bug the agent never actually saw fail, which costs reviewers far more time.
Is it safe to let an AI agent pick up issues on a public repository?
It can be, with sensible limits. Trigger on a label that only maintainers can apply, and keep outsider-started runs off. Treat issue text as data, never as instructions, so a hostile issue can't steer the agent. Protect sensitive paths such as deploy files, migrations and payment code in the merge policy, and keep a person merging until the agent has a record you trust.
Let an agent earn its place on your team
Define a Factorik agent once and it wakes on an issue, a failed build or a schedule, works in an isolated sandbox and ships a pull request. It starts with a person merging its work and earns more autonomy on its record. Try it free for 7 days, no payment details needed.