Risk-aware changes, independent verification and human responsibility
An AI software factory can implement changes largely autonomously. The real architectural problem begins, however, at the latest when it has to decide which changes may proceed without human review – and which may not.
This article covers the control and feedback functions of a factory: dynamic change decomposition, verification, risk control, approval, CI/CD, governance and monitoring. The basic architecture with agentic coding tools, harnesses, model access and orchestration is described in Anatomy of an AI Software Factory.
Splitting Changes by Risk#
A feature rarely consists only of changes of the same risk class. Suppose a change to authorization first requires restructuring the code. After that, the actual functional change to authorization is relatively small. Finally, the new structure is tidied up.
A single pull request would mix everything: a lot of behavior-neutral, low-risk refactoring and a small but possibly security-critical change. The most critical spot then determines the review effort for the entire diff: A human reviewer would have to work through all of it to find the one sensitive change.
Agents, however, can easily split the work by risk class, so that several separately reviewable change units emerge. And a factory should demand that. An established term for the preparatory restructuring is Preparatory Refactoring. Afterwards, low-risk and critical feature parts are separated; a final cleanup can follow. Each unit is then reviewed and approved according to its own risk. There need not be exactly four changes as in the diagram.
The factory should, in principle, initiate such a decomposition itself and – within its rules – be able to check it. In a strongly human-driven Light Factory, the decision can rest with the developer. A dashboard can flag changes that mix parts of different risk, without automatically interrupting the work.
The goal is not to make every change minimally small, but to separate parts of different risk from one another, so that the share requiring human review remains manageable. With sufficient safeguards, a large refactoring can proceed automatically, while a small change to the permission system is presented to a human.
But: even a refactoring with unchanged tests is not risk-free. And several individually uncritical changes can become critical in combination. Therefore, assessing the individual changes in isolation is not always sufficient; integration additionally checks the combined effect.
Verification: More Than “Tests Green”#
The factory must be able to check results, ideally independently of the instance that produced them. This includes functional tests, technical tests, static analyses, security and performance checks. Formal verification and mathematical proofs can provide additional evidence for suitable tasks.
A catalog of all test types does not belong here. For the architecture, three questions matter most:
What is checked? Functional acceptance or BDD tests describe the desired behavior; technical tests additionally check edge cases, components and integrations. Regression tests are not a separate opposing category: acceptance tests can detect regressions, too.
Who defines the expectations? An agent can derive tests from requirements. Especially for functional acceptance criteria, a human review of the expectations can make sense. Technical unit and integration tests can often be created and maintained in a more automated way. More important than the label “unit” are the size of the tested unit and its refactoring safety (see Not Unit Tests, but Our Units Are the Problem).
How effective are the checks? Mutation tests, for example, check whether tests detect artificially introduced faults. Good mutation results increase confidence in the tests, but prove neither the completeness of the requirements nor the safety of a change.
The details of test granularity, software metrics and formal verification belong in separate posts. For the factory, this is enough: The significance of the evidence must feed into the approval decision.
Static Analyses: Automated Execution, Deliberately Set Rules#
Complexity limits, coupling rules, architecture guidelines and security policies can be checked automatically. The quality standards, however, should remain under controlled human responsibility. AI agents may propose changes, but must not silently weaken thresholds just to pass a check.
This makes governance a prerequisite for meaningful automation: Without stable, verifiable rules, the factory could move its own bar.
Two Levels of Risk Control#
For a Gray Factory, risk control is especially central. It pays to distinguish between static criticality and dynamic change risk.
The static classification describes, for example, the protection needs of a repository or module. A backend for permission management can have stricter requirements than a less critical presentation component. Existing classifications from an information security management system – such as the protection needs assessment according to BSI IT-Grundschutz or the classification of information according to ISO/IEC 27001 – are a sensible reference point for this. Protection needs and the risk of a concrete change are, however, not the same.
The dynamic assessment only looks at the actual change: affected files, diff, test results, security findings, architecture changes and, where applicable, the context of further changes. A rule-based checker, a specialized classification model or an LLM can be involved. A classifier need not be an autonomous agent; its classification can be processed further by the factory control. For example, my review gate Werkrevisor combines deterministic rules with a model review and uses Jev as a classifier: Simple PRs can be merged without humans, risky ones end up with me (more on this in Anatomy of an AI Software Factory).
A static classification can also influence the sensitivity of a classifier and the required evidence. It should be maintained and reviewed in the event of significant changes. The factory may propose updates; authorizing such rule changes is a governance question.
Human Approval: Responsibility Instead of Repeated Interruption#
Human reviews are not automatically necessary because humans can judge code better than AI. Rather, they can be required because an organization demands deliberate human responsibility for certain changes.
This presupposes that the reviewer can actually see and assess the change, the risks and the available evidence. Merely nodding it through does not serve this purpose.
Typical triggers of mandatory approvals can be team rules, security-critical changes or hard size and complexity limits. During the work, the factory can display risk notices in the dashboard without stopping the agent. A binding decision often only makes sense after implementation, when the change is available as a whole.
Exceptions are actions that could have irreversible consequences already during processing, such as deleting production data. These may require prior approval. The exact position of such control points depends on the system, environment and reversibility.
The Light, Gray and Dark operating models differ mainly in which decisions may be made autonomously: In Light Factories, human reviews are a regular part; Gray Factories request them based on risk; Dark Factories try to design the regular flow without individual human decisions. This is no statement that the technical components must be fundamentally different. This is covered in more detail in Gray Software Factory: Autonomy by Risk, Not by Dogma.
CI/CD, Git and the Question of the Right Control Point#
GitHub, GitLab or Gitea can provide version control, pull requests and reviews. CI/CD systems run builds, tests, scans and deployments. The factory can control such systems and interpret their results without implementing them itself.
Pull requests are not a must. But they are a practical mechanism when human approvals or traceable separate changes are required. Alternatively, suitable commits, branches and other approval mechanisms can be used.
Likewise, there is no universal point in time for assessing combination risks. A merge is not the same as a production deployment. Changes can be reversible or hard to undo; test, staging and acceptance stages can lie between integration and production.
The factory must take into account the combined effect of related changes. When it checks this and what consequences follow depends on criticality, reversibility and downstream safeguards.
Dashboard, Notifications and Governance#
A dashboard can display status, progress, quality evidence, risk notices and pending approvals. Notifications can be sent via messenger or email. A mere notice should be clearly distinguishable from a mandatory human decision.
Risk control decides whether an intervention is required. Dashboard and notification system make this decision visible and enable the response. These are different functions, even if one product offers both.
Governance defines the limits of autonomy: permissions, permitted tools, budgets, quality rules, review obligations and responsibilities. Particularly important is who may change these rules. A factory should not be able to loosen its own controls on its own authority to finish faster.
Two Feedback Loops#
The factory does not just process work items. It can detect new work itself – from two different sources. This is a different classification than in Three Feedback Loops of Sustainable AI Software Development: There, it is about the correctness, performance and architecture of the software itself, here about the origin of new work, from the product or from the production process.
Product feedback: Monitoring reports unusual latencies, error clusters or outages. Security scans discover new vulnerabilities in dependencies. This can give rise to corrective work items that go through the same review and approval process as human requirements.
Process feedback: Recurring build failures, flaky tests, high model costs or problematic reviews reveal weaknesses in the production process. The factory can propose improvements from this; changes to its own policies remain separately controlled.
A concrete example: a nightly dependency scan detects a new vulnerability. The factory identifies a suitable secure version, updates the dependency, runs tests and security checks and assesses the change risk. With sufficient evidence and matching rules, the upgrade can proceed automatically; otherwise, a human is involved. Good tests and mutation results help, but do not guarantee complete compatibility.
Conclusion: Controlled Autonomy Is an Architectural Task#
An AI software factory does not need as many human stops as possible. It needs traceable quality evidence, risk-appropriate decisions and clear responsibilities.
Dynamic change decomposition can isolate critical changes and shrink reviews. Independent verification provides the evidence. Static protection classes and dynamic change assessments determine when a human must decide. CI/CD and monitoring close the loop without necessarily being part of a monolithic factory product.
These functions can be combined with different agents, models and platforms. The corresponding vendor-neutral overall architecture is described in the previous article. What matters is less how autonomous a factory appears, than rather which decisions it is actually allowed to make autonomously, and by which rules.
Sources and Further Reading#
- Anatomy of an AI Software Factory
- Gray Software Factory: Autonomy by Risk, Not by Dogma
- Martin Fowler: An example of preparatory refactoring
- Dan North: Introducing BDD
- Werkrevisor: Review gate for pull requests
- Not Unit Tests, but Our Units Are the Problem
- Three Feedback Loops of Sustainable AI Software Development
- BSI Standard 200-2: IT-Grundschutz Methodology
- ISO/IEC 27001: Information security management systems
