Building with agents, lesson 8.3
From an issue to a pull request
If you can write the issue well, an agent can often take it all the way to a pull request. This lesson follows one issue from the words you write to the moment you merge, and shows where a person must stay in charge.
Every example below changes to fit what you pick. The businesses are made up for teaching.
The picture, one step at a time
Each box is one stage. The picture lights up as you scroll.
An issue on its way to a merged pull request
1An issue written as a spec
The goal, where in the code, what done looks like, and what is out of bounds.
2Handed to an agent
Someone with write access assigns it, or adds a label, and the agent starts.
3Its own branch
It works away from main, under the same branch rules as everyone.
4A pull request comes back
Linked to the issue, saying what it changed and why.
5The checks run
Tests and the security scans, the same as for a person.
6A person merges
You review it like a colleague's. Merging closes the issue by itself.
Goal, where, done when, out of bounds.
Step 1 of 6
The issue is the prompt
When an agent picks up an issue, the issue is all it knows. So write it like a short spec. Goal: what should be true when it is done. Where: the files or pages it touches. Done when: the test that passes, or the thing you can see. Out of bounds: what it must not touch. For the shop's site, try it on the next small bug you file.
Step 2 of 6
Hand it over, carefully
You assign the issue to the agent, or add a label your pipeline watches for. Who is allowed to do that matters. If anyone who can open an issue could also start an agent, a stranger could write the instructions (lesson 7.2). Only people with write access to the repo should be able to start one.
GitHub's docs for its own cloud agent say its automations ignore events from users without write access to the repository by default (read November 2026).
Step 3 of 6
It works on its own branch
The agent never works on main. It makes a branch, edits and tests there, and is bound by the same branch rules and required checks as everyone else. If something goes wrong, you delete the branch and nothing is lost.
GitHub's cloud agent, for example, gets a new branch whose name begins with copilot/ and can push only to that branch. It is "also subject to any branch protections and required checks" (read November 2026).
Step 4 of 6
A pull request, linked to the issue
It opens a pull request that says what it changed and why, and names the issue with a closing word, like "Fixes #123". The link keeps the conversation in one place, and closes the issue for you when the pull request is merged.
GitHub recognises close, fix and resolve, in any of their forms. "When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed."
Step 5 of 6
The checks run, with one extra look
The tests and the security scans from lesson 7.1 run on the pull request, as they would for a person. One file deserves an extra look: the one that tells your build system what to run. An agent's change there could reach the secrets your builds use, so read it before any build runs it.
GitHub, for its own agent: by default, builds are not run on its pull requests until its code is reviewed and someone with write access approves them. It cannot approve or merge its own pull request, and the person who asked for it cannot approve it either (read November 2026).
The agent's pull request changes the file that tells your build what to run. What do you do?
Step 6 of 6
A person merges
Review it like a colleague's work. Does it do what the issue said, and nothing else? If not, comment on the pull request, and the agent tries again on the same branch. When it is right, you merge, and the issue closes itself.
The pull request does what the issue asked, and also tidies three other files. What now?
Ready for an agent?
Here are four issues in your business. Ready: it says the goal, where, what done looks like and what is out of bounds. Needs more: an agent would have to guess. Keep it for a person: it is a decision, or it touches something live.
1"Returns: change the 14-day window to 30 days, in the page text and in the date check. Done when the returns test passes for a 25-day-old order. Touch nothing else."
2"Make checkout better."
3"Choose which payment provider we move to."
4"Some customers get two order emails." No steps to make it happen, no order numbers.
0 of 4 right so far, 4 to go.
A pipeline issue template
This is what you keep: the headings every agent issue carries, and the two rules around the hand-over.
A pipeline issue template
- Goal: one sentence on what should be true when this is done.
- Where: the files, pages or modules it touches.
- Done when: the test that passes, or the thing you can see, that proves it.
- Out of bounds: what it must not touch, and any decision it must not make.
- How to check: the steps a reviewer follows to see it work.
- Only someone with write access hands it over, and the pull request says "Fixes" with the issue number.
If a new colleague could not finish it from the issue alone, neither can the agent.
Next: Lesson 9.1: One door to your tools, with permissions. How a company puts every agent's tools behind one sign-in and one policy.