I’m Denis Shokhirev, an Agentic AI Systems Architect in Freiburg im Breisgau, Germany, and at DennisCraft AI Studio I ship production AI systems for DACH B2B clients on Claude, Supabase, n8n, Doppler, and self-hosted Postgres. The ugly production moment is rarely “the model failed.” It’s usually this: the agent opens the PR, writes the tests, explains the diff, approvals go through, the merge is green, and two hours later a bug lands in production with no clear owner.
That is the real problem with AI-assisted pull requests. Not whether Claude Code can prepare useful changes. It can. The problem is that many teams let the system automate execution and accidentally automate accountability with it. Once an agent can generate code, summarize review, trigger checks, and push toward merge, you need a precise ownership model for generation, review, policy enforcement, merge, and runtime fallout.
The risk is not auto-PRs. The risk is ownership collapse.
I’m not arguing against AI-generated code. In low-risk paths, it is practical: fixtures, type fixes, repetitive refactors, boilerplate API wiring, test scaffolding. The failure mode starts when a team treats an AI summary plus green CI as equivalent to human judgment. “Claude looked at it and checks passed” is not an operating model.
OWASP’s LLM Top 10 highlights recurring issues around insecure output handling, excessive agency, and supply chain exposure. Source: OWASP, 2025, https://owasp.org/www-project-top-10-for-large-language-model-applications/. That maps closely to what I see in delivery work. On recent agentic deployments, I repeatedly caught the same pattern: the model made a valid business change but introduced a risky shortcut in SQL access, auth conditions, or secret handling around the edges.
Where ownership breaks
| Stage | What the agent does | Common failure | Who should own it |
|---|---|---|---|
| Generation | Writes the diff, tests, migration | Wrong assumption in business logic | Requester of the change |
| Static analysis | Runs semgrep, bandit, gitleaks | Warnings are treated as noise | Repository owner |
| Review | Summarizes the PR and risks | Reviewer reads summary, not diff | Assigned reviewer |
| Merge | Can trigger auto-merge | No explicit approval policy | Engineering lead / code owner |
| Runtime | Indirectly acts through shipped code | Bug appears after release | Service owner on call |
A workable model for AI-assisted approvals
My baseline rule is simple: the agent may prepare the change, but it may not become the final trust boundary. Even if you allow auto-merge for low-risk classes of changes, the decision should come from policy, not from model confidence. If your controls depend on whether the model sounds convincing, your process is already too weak.
1. Split changes by risk class
Not all PRs deserve the same path. Documentation, test data, and internal refactors with no contract changes can move quickly. Auth, billing, SQL, secrets, retention, and workflow automation should not. If the agent edits SQL queries, access logic in Supabase, or actions in n8n, that is not a low-risk change anymore.
2. Let static rules block merge before human debate starts
If you use Claude Code or the Anthropic SDK to generate PRs, keep the agent free to propose fixes but not to bypass policy gates. semgrep, bandit, and gitleaks are not enough by themselves, but they remove a whole class of avoidable mistakes before a reviewer gets pulled into style discussions.
name: pr-guard
on:
pull_request:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: returntocorp/semgrep-action@v1
with:
config: p/owasp-top-ten
- run: pip install bandit
- run: bandit -r app -x tests
- uses: gitleaks/gitleaks-action@v2
This does not make code safe by magic. It makes the process predictable. The model cannot talk the pipeline into ignoring known-bad patterns.
3. Bind approval to a named human owner
If you cannot answer who accepted the risk after an incident, you do not have governance. In regulated environments, that gap gets expensive quickly. I recommend storing three artifacts for every AI-assisted merge: who requested the change, who approved it, and which automated checks passed.
from datetime import datetime
import json
def approval_record(pr_id, requested_by, approved_by, checks):
return {
"pr_id": pr_id,
"requested_by": requested_by,
"approved_by": approved_by,
"checks": checks,
"approved_at": datetime.utcnow().isoformat() + "Z"
}
record = approval_record(
pr_id=1842,
requested_by="ops-agent",
approved_by="[email protected]",
checks=["semgrep", "bandit", "gitleaks", "tests"]
)
print(json.dumps(record))
Why “human in the loop” often fails in practice
Most teams technically have a human in the loop. The issue is that the human often reads the AI summary instead of the diff. That becomes dangerous when the agent is good at sounding certain. A clean explanation speeds up review, but it also reduces the chance that someone opens the one file where the real problem sits.
Anthropic’s documentation around Claude Code and tool use emphasizes bounded permissions, auditability, and controlled actions rather than unchecked autonomy. That is the right frame. Agents should operate inside narrow permissions and observable workflows, not as pseudo-senior engineers with final authority. Source: Anthropic Docs, 2025, https://docs.anthropic.com/.
A practical antidote
I use one rule on AI-assisted PRs: summary is not review. If the change touches auth, SQL, network egress, secrets, or data retention, the reviewer must inspect the file-level diff and mark that explicitly. It is slower. It is still much cheaper than a postmortem after a quiet production incident.
Where an autonomous reviewer helps, and where it must stop
Autonomous review is useful in domains that are well-bounded: dependency updates, lint fixes, test generation, repetitive integrations, internal documentation maintenance. The cost of error is limited and policy is easy to automate.
You should constrain the agent anywhere a mistake changes legal, financial, or operational consequences. For DACH B2B teams, that usually means customer data, billing paths, access control, industrial workflow actions, and anything likely to surface in an audit. If AI modifies the data path in Postgres or Supabase, I want more than a green checkmark. I want a service owner who knowingly signed off on that risk.
changed_files="$(git diff --name-only origin/main...HEAD)"
echo "$changed_files" | grep -E "(auth|billing|sql|migration|secret|retention)" >/dev/null
if [ $? -eq 0 ]; then
echo "High-risk change detected. Human approval required."
exit 1
fi
echo "Low-risk change set. Auto-merge may continue."
FAQ
Should an agent ever be allowed to approve PRs?
For low-risk changes, only if “approve” means the PR passed predefined policy checks. For high-risk code paths, I would not allow final approval without a named human owner.
Is CI plus tests enough?
No. Tests validate expected behavior in known cases, but they do not prove the absence of weak authorization, secret leakage, or dangerous assumptions. You still need policy checks and risk-based review.
What if the team is small and has no dedicated AppSec function?
Start with the minimum viable controls: semgrep, bandit, gitleaks, mandatory review on high-risk paths, and an approval log. That already gives you more operational control than “let the agent handle it.”
Should regulated teams ban AI-generated code?
No, not if they have traceability, release rules, and explicit ownership at every stage. The issue is not generation itself. The issue is shipping generated changes into a process that has no clear accountability model.
How can you tell your process trusts the agent too much?
If an incident happens and within five minutes you cannot name the person who accepted the risk and show which checks passed, your trust in the agent already exceeds your observability.
If Claude Ship or any other coding agent is already preparing PRs in your stack, which stage truly owns the risk in your pipeline today: static analysis, human review, policy gating, or the on-call engineer after release? I’d genuinely like to know where your team catches the most production issues. I run a free 30-min stack audit for DACH founders building AI in regulated markets. DM me on LinkedIn or write to @ger_dennis_ai.
I build agents like this for businesses in Germany and the EU.
Tell me in two sentences what eats your team’s time – reply within 24 hours.
Turn your process into an AI system
Production quality. DACH B2B focus.