DEV Community

Yousef REMLI
Yousef REMLI

Posted on

Where the human gate goes: designing autonomy for coding agents

TL;DR: I let coding agents open and merge their own pull requests into an integration branch, but never into the branch that ships. On one project that turned 185 ticket pull requests into 62 bundle reviews in about three weeks. Dry-run-by-default scripts, a deny list and a stop-on-conflict rule hold the line. Below I show where each of them falls short.

1. The problem

When a coding agent writes the code, typing stops being the bottleneck. I become the bottleneck. In the first version of my workflow, I confirmed every pull request an agent opened. It felt safe, so I never questioned it.

Then I looked at what those confirmations were doing. Each ticket's pull request got a click from me, but the real review happened later, when I read the whole bundle of tickets together before shipping. My note from the day I changed it says it plainly: a confirmation per ticket pull request added waiting without adding a review.

So the question became: where does a human gate actually earn its keep?

2. Context and constraints

  • Two side projects, one developer, built mostly with Claude Code agents.
  • Work is split into small tickets. A bundle (at most four tickets) gets reviewed together.
  • A hard line already existed: agents never merge into the shipping branch.
  • No budget for hosted tooling, and, as I'll show below, no branch protection on my GitHub plan for a private repository.

3. What I built


The flow has two zones:

  1. Agent zone. An agent starts a branch for a ticket, writes the code, runs the checks, opens a pull request, and merges it into an integration branch. It doesn't ask for approval.
  2. Human zone. One pull request moves the whole bundle from the integration branch to the shipping branch. I review it and merge it. This is the only point where a human must act.

I put the gate here because this is the only point where work becomes real. Everything before it can be inspected, reverted or thrown away. Nothing ships until I merge.

Three mechanisms keep the agent zone honest.

Dry-run by default. The scripts agents call to change Git do nothing unless told to. A simplified sketch of the pattern:

# simplified illustration, not copied from any real project
import sys

def main(argv):
    plan = build_plan(argv)          # always computed and printed
    print(plan)
    if "--execute" not in argv:
        print("dry run: nothing was changed")
        return 4                     # refuse to act without --execute
    apply(plan)
    return 0

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
Enter fullscreen mode Exit fullscreen mode

The agent only passes --execute when its task says a human authorised that step. The printed plan is the useful part: when a run stops, I can read exactly what it was about to do.

A deny list. Headless agent runs get an allowlist (my own scripts, read-only GitHub commands) and a list of commands they may never run: direct merges, force-pushes, pushes to protected branches, history rewrites, inline scripts. With the Claude Code CLI it is passed per run:

# simplified: the real lists are longer
claude -p "$TASK" \
  --allowedTools "Bash(python scripts/branch_tool.py:*)" "Bash(gh pr view:*)" \
  --disallowedTools "Bash(git merge:*)" "Bash(gh pr merge:*)" "Bash(gh api:*)" "Bash(python -c:*)"
Enter fullscreen mode Exit fullscreen mode

Stop, don't force. A merge conflict stops the run and gets reported. A failed check on the integration branch doesn't block the bundle. Instead, the final pull request opens as a draft titled [checks failed], so I see it before I merge.

4. What went wrong, and what it doesn't catch

The guardrails blocked my own agent. I recorded seven headless runs, all on one day. Four didn't finish. Three of those four hit the permission system. Two were refused a command the workflow legitimately needed: the agent's own branch script, with --execute. The third had one recorded permission denial (an inline script, which is on the deny list), exited with code 1, and still logged its result as "success". The fourth stopped because a required tool path wasn't configured. Guardrails that have never blocked you haven't been tested. Mine were tested, and it cost me an afternoon.

The deny list is not a wall. I tested it against the real CLI in a scratch repository. A direct merge, a push to the shipping branch (written two different ways), a force-push, a raw API call and an inline script were all denied, and a push to a feature branch ran. But the list blocks the direct forms of a command, not every possible one. A plain git push while the shipping branch is checked out matches no pattern.

The deny list only covers part of the work. The most important thing I learned while writing this post: that deny list exists for headless runs launched from my small control panel. Most of the agent's pull requests didn't come from there. They came from interactive sessions, which have no deny list at all. There, the rule lives in the project instructions and the dry-run scripts, plus Claude Code's normal permission prompts. That's weaker than "a tested deny list", and I had been describing it as if the deny list covered everything.

I can't use the real fix. GitHub branch protection would close these gaps. It isn't available for a private repository on my plan. So the actual guarantee is a stack: the scripts, the deny list where it applies, the prompts, a separate worktree so headless runs never start on the shipping branch, and my review of the final pull request.

The audit trail can't tell me apart from the agent. The agent and I use the same GitHub login on this machine. All 62 bundle merges into the shipping branch show the same account. The rule says only I merge there, but the merge record alone can't prove it.

The flag informs, it doesn't block. Two bundle pull requests opened as [checks failed]. Both were merged in the end. That is what the design intends, but it means the flag is only as good as the person reading it.

My own documentation is behind. The decision record for this design is still marked "Proposed", and it still says the mutating scripts were only dry-run against the real repository. The workflow has been in daily use since then. The record hasn't caught up.

5. Numbers

Only counted numbers here, all from one of the two projects. I don't have a measured "time saved" figure, so I'm not giving one.

  • 185 ticket pull requests merged into the integration branch by agents, from 25 October to 17 November 2026.
  • 62 bundle pull requests merged into the shipping branch over the same period (the last one on 16 November). That is 62 review points instead of 185, about three tickets per review.
  • 2 of the bundle pull requests opened as [checks failed]. Both were merged.
  • 7 recorded headless runs, all on 25 October: 3 finished, 2 failed, 2 needed input. Three of the four that didn't finish hit the permission system.
  • The first bundle run that finished took about 11 minutes. The merge run that followed took about 2 minutes.
  • The deny-list test covered 6 denied commands and 2 allowed ones on a scratch repository. That is a spot check, not a proof.

The two populations are different: the 7 headless runs ran with the deny list; most of the 185 pull requests didn't.

6. What I'd do differently, and how you can apply it

  1. Put the gate where work becomes irreversible, not where it is easiest to add. For each gate, ask what the human adds. If the answer is "waiting", move it.
  2. Make destructive scripts refuse by default, and print the plan. --execute is cheap, it makes the agent's intent explicit, and the printed plan tells you what a stopped run was about to do.
  3. Test your deny list against the real tool, and check where it applies. Write down what it misses. And confirm that every way the agent actually runs gets it. Mine covered the path I tested, not the path I used most.
  4. Give the agent its own identity. If agents and humans share one account, your merge history can't show who crossed the gate. A separate bot account or token is the next change on my list.
  5. Keep a one-line stop rule. A conflict or a failed check should stop or flag, never get "fixed" quietly. A flag only works if someone reads it, so put it where the human already looks.

If you run agents on real repositories: where does your human gate sit, and what does it add?

Top comments (0)