Because review is a detection control, not a prevention control. By the time a linter or human reviewer finds the issue, the agent has already written the drift, and the team must reprompt, rewrite, and retest. That turns a context problem into a recurring cost problem.
Why This Matters for Security Teams
Late review fails because AI-generated drift is usually created upstream, while the reviewer only sees the finished artifact. By that point, the team has already absorbed the cost of rework, context switching, and repeated validation. In practice, the hidden problem is not that review misses every issue, but that it detects the wrong class of issue too late to preserve speed. That is why teams that rely on review alone often end up with an expensive correction loop rather than a stable generation process.
This becomes more visible when the drift involves secrets or sensitive patterns that the model has already learned from code context. NHIMG research on secrets in application security shows that 43% of security professionals are concerned about AI systems learning and reproducing sensitive information patterns from codebases, which fits the real failure mode here: the model can repeat bad structure before any reviewer has a chance to intervene. The practical lesson is that late review can catch a symptom, but it does not stop the agent from emitting the symptom in the first place. In practice, many security teams discover this only after repeated prompt, rewrite, and retest cycles have already consumed the delivery window.
How It Works in Practice
Drift appears when the model optimises for local plausibility instead of policy, consistency, or intended architecture. A late code review can still be valuable, but only as a backstop. It cannot prevent the model from producing code that is off-pattern, over-permissive, inconsistent with the surrounding implementation, or subtly misaligned with security expectations.
The practical sequence usually looks like this:
- The agent receives a broad task and generates a working-looking change.
- The change compiles or passes a narrow test, so the drift is not obvious immediately.
- A human reviewer or linter detects the mismatch after the code already exists.
- The team must restate intent, regenerate, and revalidate the new output.
That loop is why late review behaves more like cost recovery than prevention. It can also amplify noise when the drift is structural rather than syntactic. For example, if the model chooses the wrong abstraction, the wrong configuration boundary, or the wrong security pattern, a reviewer must do more than approve or reject, they must reconstruct the original intent and convert it back into something the model can follow.
A useful comparison is to secrets management. In The State of Secrets in AppSec, remediation for a leaked secret averages 27 days, which shows how expensive late detection becomes once the mistake has already entered the workflow. The same dynamic applies to AI-generated drift, even when the issue is not a secret itself. The later the control acts, the more it turns into triage, not prevention. These controls tend to break down when the agent is allowed to generate large, multi-file changes with weak policy constraints because the reviewer is then forced to inspect too much context after the fact.
Common Variations and Edge Cases
Tighter review often increases latency, so organisations must balance assurance against throughput. The right answer is not to eliminate review, but to move the strongest controls earlier so review focuses on exceptions, not basic correctness.
Some teams treat all drift as equal, but that is usually too blunt. A harmless stylistic drift can be handled with lightweight correction, while architectural drift, privilege drift, or repeated policy drift should trigger a stricter response because it indicates the model is learning the wrong boundary conditions. There is no universal standard for this yet, but current guidance suggests separating recoverable noise from recurrence. One-off deviations are a quality issue; repeated deviations are a control design issue.
Edge cases also matter. Late review can still be the right control when the output is small, deterministic, and easy to validate manually. It is much less effective when the model is making multi-step changes, operating across repositories, or inheriting context from a messy codebase. In those environments, the reviewer is no longer confirming intent, they are trying to reconstruct it. That is where the control degrades fastest.
Risk and Threat Considerations
The main risk is not just bad code, but repeated exposure to the same bad pattern. When AI-generated drift is only caught at review time, the organisation accepts a larger surface for rework, escaped defects, and policy violations. If the drift includes sensitive structures, credentials patterns, or insecure defaults, the delay can turn a local quality issue into a broader security exposure.
Failure mechanism: The model emits code that is plausible enough to move downstream, and the review layer only detects the mismatch after the artifact already exists. That means the organisation pays twice, once in generation and again in correction, while also increasing the chance that the flawed output is copied, merged, or reused before the issue is fixed.
Impact: Teams experience slower delivery, more retesting, and weaker trust in automated code generation. Where the drift affects security-relevant logic, the result can be repeated exposure of the same control gap across multiple commits or branches.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.DS — Data Security | AI drift can reproduce sensitive code patterns and secrets. |
| Recommendation — Apply data security controls to prevent sensitive patterns from entering generated code. | ||
| CIS Controls v8 | 16 — Application Software Security | Late review is a software assurance gap that should be controlled earlier. |
| Recommendation — Build secure coding checks into development before human review. | ||
| OWASP Agentic AI Top 10 | A2 — Prompt Injection and Input Manipulation | Agent output drift often reflects weak control over model-driven behavior. |
| Recommendation — Constrain agent instructions and validate outputs before code reaches review. | ||
Practitioner Guidance
What to prioritise: Put policy and structure checks before human review wherever possible. Review should confirm intent and exceptions, not act as the first line of defense against drift.
Decision rule: If the agent can produce changes that would be expensive to unwind after merge, treat late review as insufficient on its own and add earlier guardrails such as constrained prompts, templates, or validation gates.
What to measure: Track rewrite rate, review rejection rate, and the number of times the same drift pattern reappears after correction. Repetition is the signal that the system is generating the wrong default, not just making occasional mistakes.
Practitioner takeaway: The real objective is to stop drift from becoming the model’s normal output, because once review is doing all the catching, the organisation has already lost the cheapest point of control.
Related resources from NHI Mgmt Group
- What is the difference between code review and access review in AI-generated software?
- What do teams get wrong about AI-generated documentation and code review?
- How should teams govern AI-generated code when they cannot review every change?
- How can teams tell whether AI-generated code needs extra review?