Monitoring AI-Generated Code in Production
Quick answer: To monitor AI generated code in production, tie every problem to the exact commit a change merged as: CI or a deploy failing at that commit, a revert of it, or a person reporting a problem on it. Record each one as a finding against the change and the agent that made it, tell the team where they already look, and let it count against the agent's record. Optionally, have a watcher read production a while after a risky change merges, with people confirming what it suspects.
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.
Why does review end at merge when the risk does not?
Code review is a gate in front of the default branch. Once a pull request merges, most teams stop looking at it as a change and start looking at it as part of the system. If something breaks a day later, someone opens Sentry or Datadog, finds an error, and works backwards through recent deploys to guess which change caused it. That works when a few people merge a few changes a day and remember what they shipped.
It works less well when coding agents multiply the number of changes. Faros AI's 2026 report, a vendor report covering about 22,000 developers, found that moving from low to high AI adoption came with bugs per developer rising 54% and incidents per merged pull request more than tripling. The same report found 31% more pull requests merged without any review. Whatever you think of a vendor's numbers, the direction matches what many teams describe: more changes, larger changes, and less attention on each one.
The consequence is simple. If review is thinner, the period after merge carries more of the risk. And if nobody connects a production problem back to the change that caused it, the author of that change, person or agent, never learns from it. An agent in particular will keep making the same kind of change with the same confidence, because nothing in its world told it that last week's change broke checkout.
So the question is not only how to review AI-written code better before it merges. It is also how to keep watching a change after it merges, how to decide a problem really belongs to it, and what should happen to the agent's freedom when it does.
How do I tie a production problem to the exact change that caused it?
The weak link in most post-merge monitoring is attribution. An error rate goes up; several changes merged that morning; someone picks the likeliest one. Guesses like that are fine for firefighting but useless for keeping score, because you cannot hold an author to a record built on hunches. A signal that should count against a change needs to point at that change unambiguously.
The anchor is the merge commit: the exact SHA the pull request became on the default branch. A small number of signals can be tied to it as facts rather than opinions. CI failing on the default branch at that exact commit. A deploy failing at that exact commit. A later pull request that reverts it, which is about as clear a statement as a team makes. And a person, looking at the change, saying it caused a problem and recording that against it.
Each of these has a property that matters: it names one commit. CI failing three commits later is not the same fact, because two other changes came in between. An error spike in Sentry in the same hour is a lead, not a verdict. Keeping the strong signals separate from the weak ones is what lets you be strict about the strong ones without punishing an agent for a coincidence.
There is also a practical reason to anchor on commits: everything else in your tooling already speaks that language. CI runs are keyed by commit, deploys usually record what commit they shipped, and git itself records reverts. You do not need a new observability stack to start; you need to read signals you already have and connect them to the change that merged.
| Signal | Names one commit? | How to treat it |
|---|---|---|
| CI fails on the default branch at the merged commit | Yes | Counts against the change |
| A deploy fails at the merged commit | Yes | Counts against the change |
| A later pull request reverts the change | Yes | Counts against the change |
| A person reports a problem on the change | Yes, by their judgment | Counts against the change |
| An error spike or metric drop after the merge | No, only a time window | A suspicion until a person confirms it |
What happens in Factorik when a merged change causes a problem?
Factorik records the agent's merged changes by the commit they merged as, and keeps watching them after merge. When CI or a deploy fails at that exact commit, when a merged pull request reverts it, or when a person reports a problem on the run that produced it, Factorik records a finding against the change. The finding is not a log line someone may notice; it does three things.
First, the team is told on every channel it has connected: a Slack message, the notification webhook, email to the organization's members, and a comment on the pull request itself, so the people who reviewed or merged it see it where they left it. Second, the finding counts on the agent's record, which is what decides its level. Third, the agent reads it: every later run of that agent sees the findings on its past changes, alongside the team's rules and recent feedback, so the next change is made knowing what the last one did.
The part that changes behaviour fastest is the level. Every Factorik agent works at one of three levels: it opens pull requests that a person merges; it merges low-risk changes by itself when the merge policy allows; or it merges whatever the merge policy allows. An agent earns its way up on a record of merged changes with no problems. Any finding on one of its merged changes moves it down a level at once, whatever the organization's promotion mode, and the change of level is recorded with what caused it.
That asymmetry is deliberate. Climbing takes a record; falling takes one counted problem. A team that let an agent merge low-risk changes on its own gets that permission withdrawn automatically the moment the agent's work is shown to have hurt production, without anyone needing to notice and remember to turn a switch off.
What is a Change Watcher, and when should a change be watched?
Some problems never fail CI or a deploy. A change can pass every test, ship cleanly, and still raise the error rate on one endpoint, slow a page, or quietly cut sign-ups. Those show up only in production data, and only if someone looks. That is what watcher agents are for.
A Change Watcher is one of Factorik's ready-made agents. Its trigger is a change, marked by a person to be watched, having merged. A while after that merge, it wakes and checks production with the tools the team connected to it: Sentry for new or rising errors, Datadog for latency and error rates, analytics tools such as PostHog, Mixpanel or Google Analytics for a drop in the behaviour the change touched. It never changes code. Its job is to look and report.
What a watcher reports is a suspicion, and Factorik treats it that way. A watcher's finding counts for nothing until a person confirms it: it does not move the agent down, does not appear in the counted record and does not teach the agent anything. A person looks at what the watcher found, decides whether the change really caused it, and confirms or dismisses it. Only a confirmed finding behaves like a CI failure or a revert.
Which changes deserve a watch is a judgment call, and it belongs to people. Good candidates are changes to a hot path, to how money or sign-ups flow, to caching, or to anything that touches many users at once and that tests cover thinly. A typo fix in a README does not need one. Marking a change to watch costs a person a moment and turns a vague worry into a scheduled, specific check.
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 post-merge watching look like, step by step?
Here is an illustration with made-up names, not a customer story. A team runs a Bug Fixer agent on a repository called acme/storefront, at the second level: it may merge low-risk changes by itself when the merge policy allows. A Change Watcher on the same repository has Sentry and Datadog connected.
An issue is opened: "Cart total shows NaN when a coupon has no expiry date." The Bug Fixer wakes, works in its sandbox, writes a failing test in src/cart/coupon.test.ts, fixes the null check in src/cart/coupon.ts, and opens a pull request. The change is two files and a dozen lines, touches no protected path, and the checks pass, so under the merge policy it qualifies as low-risk. Because it touches checkout, an engineer on the team marks the change to be watched.
The pull request merges as commit 4f2a9c1. CI on the default branch passes at that commit and the deploy succeeds, so there is no automatic finding. A while later the Change Watcher wakes, reads Sentry and Datadog for the cart service, and reports that a new TypeError appeared in the coupon code path shortly after the merge, at a low but steady rate, with stack frames in the file the change edited.
An engineer reads the watcher's report, opens the Sentry issue, and agrees: coupons with an expiry date but no start date now throw. They confirm the finding. From that moment it counts. Slack, the webhook, the members' email and a comment on the original pull request all say so, the Bug Fixer drops to the first level, and its next run reads the finding. The engineer opens an issue for the follow-up fix; the Bug Fixer picks it up and opens a pull request, which a person now merges, because the agent's level no longer allows it to merge on its own.
If the engineer had decided the TypeError came from an unrelated deploy by another team, they would have dismissed the finding, and the Bug Fixer's record and level would be unchanged.
What are the trade-offs, and what does Factorik not do?
Anchoring on the merge commit is strict, and strictness has costs. A revert counts against a change even when the team reverted it for reasons unrelated to quality, such as a product decision. A CI failure at the merged commit counts even if the test that failed was flaky. Teams should know this and use person-reported findings and reverts deliberately, because the system takes them at their word.
Moving an agent down at once can also feel harsh for a minor problem. It is meant to. The alternative, weighing each problem's severity, puts a judgment call back in the loop exactly where you want a fact. An agent that was moved down earns its level back the same way it earned it the first time.
There are things Factorik does not do here. It is not an observability platform: it reads Sentry, Datadog and analytics tools you already run and does not replace them. A Change Watcher does not watch every change; only those a person marked to watch. It does not roll back deploys or revert changes by itself, and it never changes code. It does not decide by itself that a production anomaly was caused by a change; that is a person's call. And watching after merge does not make review before merge optional: it catches what review missed, and it makes the cost of missing it visible.
- +A finding names one change, so the record is fair to the author
- +Uses signals teams already have: CI, deploys, reverts, people
- +Moves an agent down without anyone having to remember to
- +The agent reads its findings and changes how it works
- −A revert for a non-quality reason still counts
- −A flaky test at the merged commit still counts
- −Problems that never fail CI need a watcher and a person to confirm
- −Only changes marked to watch are checked in production
How can I start watching AI-written changes in production?
Whether or not you use Factorik, a few habits help. Record the merge commit of every agent-authored change and keep a list of them. Treat CI or a deploy failing at that commit, and any revert of it, as a fact about the change, and write it down against the change. Give people a quick way to say "this change caused a problem" and make that count too. For risky changes, schedule a look at production a while after merge rather than waiting for an alert. And make every one of these signals visible to whoever, or whatever, wrote the change.
Factorik does that bookkeeping for each agent: findings tied to the merged commit, the team told on Slack, webhook, email and the pull request, the agent moved down a level at once, and Change Watchers checking production after the changes you mark. Autonomy is earned on that record and lost on it.
If you want to see it on one of your repositories, you can start a free 7-day trial of the Team plan, with no payment details needed. Define one agent, let it open pull requests a person merges, and add a Change Watcher with your production tools connected for the changes you are least sure of.
Frequently asked questions
How do I monitor AI generated code in production?
Anchor every signal to the commit the change merged as: CI or a deploy failing at that commit, a revert, or a person reporting a problem. Record those against the change and its author. For risky changes, schedule a check of production data a while after merge, and have a person confirm anything that is only a correlation.
Does Factorik revert a change automatically when it causes a problem?
No. Factorik records a finding, tells the team on its connected channels and moves the agent down a level. Reverting or fixing the change is a decision people make, and a fix can be handed to an agent as a new task.
Can a Change Watcher change code?
No. A Change Watcher reads production through the tools connected to it, such as Sentry, Datadog or an analytics tool, and reports what it finds. It never changes code, and its findings count only after a person confirms them.
What happens to an agent's level after a finding?
Any counted finding on one of its merged changes moves it down one level at once, regardless of whether the organization promotes agents automatically or by hand. The change of level is recorded with what caused it. The agent can earn the level back on a new record.
Which changes should be marked to watch?
Changes whose failure would hurt users and that tests cover thinly: hot paths, checkout and sign-up flows, caching, and anything that touches many users at once. Small documentation or formatting changes rarely need it.
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.