One day I opened a pull request our AI agent had made. Every check was green. On the issue, the plan had the label I use to say "yes, go build this". So far, a normal day.
Then I looked at who added the label. The timeline showed one name: mine.
I did not remember adding it. The loop ran on my GitHub login, so the agent and I looked exactly the same to GitHub. Maybe I clicked it and forgot. Maybe the agent did it. I could not tell, and that was the real problem. I had built a whole review process, and I could not prove a human had done the review.
The agent was not being sneaky. I had never told it that one label was mine to press. The bug was in my setup, not in the model.
I have been writing front-end code at Bluecopa since 2024. For most of that time "AI" meant an autocomplete that was right half the time. In the last year that changed fast. So I built a thing. Then it broke in ways I did not expect.
How it started
In July 2026 we started a new version of the Bluecopa app, from zero. A small team, a big app, and a list of issues that grew faster than we could close them. So in August I tried something. I set up a loop inside the repo. You give it a GitHub issue. It reads the issue, writes a plan, writes the code, runs the tests and opens a pull request. You review it like any other PR.
The first version was a few prompts and one script. It worked well enough that I trusted it. That was the mistake. Most of what follows is me learning, one bad run at a time, that "it worked" and "I can prove it worked" are two very different sentences.
The line
The setup I have now looks like a factory line. A written need goes in one end. Merged code comes out the other.
A person stands at two points only. A person decides what to build, by writing the issue and approving the plan. A person decides whether to ship, by merging. Machines do the rest. One agent checks that the issue is clear enough to build. One writes the plan, and a fresh one reviews it. One builds the code in its own copy of the repo.
Then comes the gate. The gate is a script, not an agent. It runs lint, types, tests and build, and it is the only thing allowed to say a run passed. Three reviewer agents also read the change: one against the spec, one for bugs, one for security. After the merge, the run writes down what it cost.
This is how a normal team works. The difference is that the middle is agents.
Things that went wrong
None of these were the agent being bad. Each one looked fine until I looked closely.
A run was allowed to touch a few files. While building, it added more files to its own plan. Every check read the plan to know what to check. The plan grew. The checks followed the plan. Nobody noticed.
Another run passed the gate on one commit. Then a different commit got merged. So the green tick on the PR was about code that never shipped.
An agent searched for its own open pull request with gh pr list --head feat/fix-login. The real branch name was longer, feat/fix-login-button. The search wants the exact name, so it came back with an empty list and no error. The agent decided no PR existed and wrote a whole new one, with a long, careful description. It only found out when GitHub refused to open a second PR for the same branch.
We used gh pr merge --auto, which I thought meant "merge once CI passes". It means "merge once nothing blocks it". Nothing blocked it. It merged on the spot, with seven CI jobs still running. That one was not even the agent's fault. I had read the docs wrong too. Today every merge goes through a merge queue, and nothing merges until CI is green.
And my favourite. An agent tried to post a comment with a flag that does not exist. The command failed, so a fallback ran, and the fallback posted the word placeholder to a real issue. I deleted it. GitHub still remembers it was there.
There are 26 notes like these in the repo now. I call them tool traps. Most of them come with a small hook that blocks the bad command before it can run.
The one rule
By September one rule had come out of all this. It is the only rule in the project I would never give up:
When an agent gets something wrong, do not fix that run. Add the check that would have caught it.
Fixing the run feels good. You merge the PR, close the issue, move on. But you have helped exactly one issue. A check helps every run after it. It even stops an agent that nobody has written yet.
So the plan that grew now fails the gate if the plan changed after approval. The green tick on the wrong commit is gone, because every merge must point to a gate result for that exact commit.
This is also why I spent much more time on checks than on prompts. A prompt asks the agent to behave. A check does not ask. An agent can talk itself into a wrong answer. It cannot argue with a script that exits with an error.
Checks cost something too. A check that is always red teaches people to scroll past it. So if a check never catches a real bug, I delete it.
Where it is now
In November I pulled the loop out into its own tool, so any repo at Bluecopa can use it. That is bluloop. It is an internal tool for now, not open source. A repo joins by adding one file, .bluloop/factory.yaml, which says how to build and test that repo. A setup command asks five questions and writes it for you. There is also a small web app, Studio, where you can watch each issue move down the line and see what each run cost.
It is at version 0.4.30. It runs on our new app, and last week we started trying it on our backend. The backend trial already found gaps the front end never hit. I have fixed some of them already.
And the label from the first story? An agent session now has no GitHub login at all. The engine refuses any step that tries to add the approve label. So an agent cannot approve its own plan anymore. But when the loop runs on my login, GitHub still cannot tell the loop and me apart. The gate writes down which one it saw. It does not pretend to know more than that. A team that wants a second person to approve can turn on one setting, and then the gate fails if the approval came from the wrong person.
I wrote that gap down in our docs, in plain words. It is still there. I would rather have a known gap than a check that lies.
Written by me, edited with AI.
