GATE Blog
Let your AI agents open pull requests, not commits
If you are going to let an AI agent change your codebase, the single most useful rule you can adopt is this: agents open pull requests, they do not commit straight to the main branch. The agent works on its own branch, opens a pull request, reviews its own diff, and a human merges. That one boundary turns “an AI is editing our code” from a thing that should worry you into a thing you can actually run in production. This piece explains why direct-to-main AI edits are risky, what the pull request boundary buys you, and where the human stays in the loop.
Why direct-to-main AI edits are risky
An agent that writes straight to your main branch is making an unreviewed change to the thing everything else builds on. That is risky for the same reasons it would be risky from a human, only more so, because the agent moves faster and does not feel the social weight of breaking the build for everyone.
A model is confident even when it is wrong. It will produce a clean, plausible-looking change that misreads the intent, deletes a check that looked redundant but was not, or “fixes” a symptom while leaving the cause. With no boundary between the agent’s output and your trunk, that change is live the instant it is written. There is no moment where a person, or another system, gets to look before it lands.
It also destroys your ability to reason about what happened. When several agents are all committing directly, your history becomes a stream of changes with no unit you can point at, approve, or undo. You cannot say “this set of edits, for this reason, reviewed by this person.” You just have a moving target.
What the pull request boundary buys you
A pull request is not bureaucracy you bolt on to slow the agent down. It is the thing that makes autonomous code changes safe to allow at all. It gives you four things you do not otherwise have.
A review surface. The diff is a single, bounded artifact you can read. Everything the agent changed for this task is in one place, with the reasoning attached. You are reviewing a proposal, not archaeology.
A rollback point. The change lands as one unit that can be reverted as one unit. If it turns out to be wrong a week later, you revert the pull request, not a scattered handful of commits you have to reconstruct by hand.
An audit trail. Who proposed the change, what it was meant to do, what was discussed, who approved it, when it merged. For anything touching sensitive systems, that record is not optional, and a pull request produces it as a side effect of normal work.
A natural stopping point. The agent finishes its task and stops at the pull request. It does not barrel onward into the next thing carrying the assumption that its last change was correct. The boundary is also a checkpoint.
None of this is new. It is exactly the discipline good engineering teams already use with each other. The insight is just that an AI agent is a contributor like any other, and should be held to the same boundary rather than handed the keys to trunk.
Self-review before requesting a human
Here is the step people skip, and it raises quality more than almost anything else: the agent should review its own diff before asking a human to.
This sounds redundant, the same agent checking its own work, but it is not, and the reason is about altitude. When an agent writes code, it is thinking locally: this function, this file, this immediate problem. When it then re-reads the full diff with a different instruction, “you are reviewing this change, find what is wrong with it,” it is looking at the whole change as one object. Different question, different attention. It catches the debug line it left in, the value it hardcoded that should come from config, the edge case it waved past, the test that locks in the bug instead of the intent.
The gain is even larger when the reviewer is a separate agent with fresh context that never saw the original reasoning. It does not inherit the blind spot that produced the bug, so it is genuinely checking, not rubber-stamping. That is the same logic behind running multi-agent workflows: separate the writer from the checker and quality goes up. Either way, the human ends up reviewing a change that has already had one honest pass made over it, which means their attention goes to the judgment calls instead of the obvious slips.
Where the human stays in the loop
The point of all this is not to remove the human. It is to put the human at the one spot where their judgment matters most: the merge.
The agent does the heavy lifting. It reads the issue, writes the change, runs the build, reviews its own diff, and opens a pull request that explains what it did and why. The human reads a finished, self-reviewed proposal and makes one decision: merge, or send back with notes. That is a far better use of a person’s time than watching every keystroke, and a far safer arrangement than letting the agent merge itself.
How tight to make that gate is your call, and it should scale with stakes. A documentation typo can have a light touch. A change to authentication, billing, or anything that moves money or touches personal data should have a human reading every line, every time. The pull request boundary is what lets you set that dial deliberately, instead of having one blanket level of trust for everything an agent does.
The takeaway
Letting agents commit straight to main trades away your review surface, your rollback point, and your audit trail for a little speed you did not need. Letting them open pull requests instead keeps all three, adds a natural checkpoint, and puts the human at the decision that counts. Have the agent review its own diff before a person sees it, keep the merge in human hands, and tighten the gate where the stakes are high. You get the throughput of an agent and the safety of real review, which is the whole point.
Branch isolation, self-review, and a human-held merge are part of how GATE runs agents against real codebases, with the governance and audit trail that serious work needs. You can see how teams put it to work on production workloads. If that is the kind of guardrail you want around your agents, we would like to talk.
Putting agents into production?
GATE is the EU-resident foundation for multi-agent workloads, with memory, coordination, and governance built in. If you're building something serious, we'd like to talk.