← Back to news
Coding Agents: Who Protects the Expected Test Results?

Photo: Yujunliang / Wikimedia Commons — CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/), Pair Programming 2.JPG, original photograph

17/10/2026

Coding Agents: Who Protects the Expected Test Results?

Green tests can still protect the wrong rule

When a coding agent writes both an implementation and its tests, a passing build can conceal a shared misunderstanding. The program behaves exactly as the assertions expect, but neither reflects the decision the team actually made. This is not necessarily deception or a dramatic model failure. It is an ordinary engineering mistake made easier to reproduce at machine speed. Keeping a human in command therefore means protecting the expected results, not merely watching an agent run commands.

In an O’Reilly article published on October 16, 2026, Markus Eisele highlights this problem within a broader discussion of reviewing agent-generated code. His central distinction is useful: agreement between code and tests does not establish agreement with the requirement. For teams adopting coding agents, that distinction deserves its own operating rule. Agents may propose checks and implement changes; a responsible person must retain control over what counts as correct.

The overlooked artifact: the test oracle

A test needs an oracle: some basis for deciding whether an observed result is acceptable. That basis might be an approved business example, an access-control rule, a reference calculation, or an externally documented protocol. The assertion expresses the oracle in executable form. If the expected answer is wrong, reliable execution simply produces reliable reassurance about the wrong behavior. More tests built from the same assumption may add confidence without adding much protection.

Separate two questions during review. Did the checks run correctly against this revision? And are the checks asking the right question? CI is good at answering the first when configured properly. The second often requires someone who understands the product, the affected users, and the consequences of a mistake. That person need not write every assertion. They must, however, be able to inspect the important expectations and challenge the assumptions behind them.

Start with examples the agent did not invent

Consider an illustrative account-export feature, not a reported incident. A product team decides that only a workspace administrator can export membership information. The implementation must reject an ordinary member, even when that member knows the export endpoint. An agent could accidentally interpret “workspace user” as sufficient authorization, then write tests asserting that a signed-in member receives the file. The happy path, fixtures, and implementation would all agree.

Before implementation, have the product owner and an engineer approve a short set of examples: an administrator in the correct workspace succeeds; an ordinary member fails; an administrator from another workspace fails; an unauthenticated request fails. Include what must not happen, such as a background export job being created after rejection. These examples become a stable reference. The agent can translate them into tests, but changing their meaning becomes an explicit decision rather than routine cleanup.

Observe the boundary where harm becomes possible

A test can mention the correct requirement while observing the wrong thing. In the export example, asserting that the interface hides a button does not prove that the server denies the request. Asserting that an error message exists does not prove that the export job was never queued. Review should connect the business rule to the boundary where protected data can actually leave the system, including asynchronous workers and downloadable artifacts.

This does not mean every change needs an expensive end-to-end suite. Choose the lowest reliable observation point for the rule. A focused integration test might establish that an unauthorized request cannot enqueue a job. Another check can verify that download authorization is enforced when the file is retrieved. The design depends on the application. The invariant remains constant: the evidence should observe the consequential effect, not a convenient proxy that happens to look reassuring.

Review changed expectations as decisions

Agents are useful at updating test suites after a refactor. They can also turn a meaningful failure into a passing result by updating snapshots, weakening assertions, skipping a case, or changing fixtures. Sometimes those edits are correct because the product behavior genuinely changed. Sometimes they erase the only signal that the requested change broke an existing promise. A generic instruction to make the tests pass cannot distinguish those situations on its own.

Make expectation changes visible in the pull request. Ask the agent to identify altered expected outputs, removed negative cases, new skips, and changes to reference data. Then compare those edits with the approved examples and the previous behavior. A human should decide whether a changed result represents an intentional requirement update or an implementation defect. Do not silently revise the requirement to match whichever behavior the generated program currently produces.

Use deliberate breakage to examine the checks

Google’s code-review guidance asks whether tests will actually fail when the code is broken. For a critical invariant, make that question concrete in an isolated environment. Temporarily bypass the relevant authorization check and run the targeted test. If it remains green, investigate what the test observes, which fixture it uses, and whether the exercised path reaches the protected operation.

This is a narrow application of mutation-testing thinking, not a requirement to deploy a comprehensive mutation platform immediately. Start with one plausible fault tied to one important rule. Keep the experiment on a disposable branch or worktree with no production credentials. Record the expected failing check, the actual result, and confirmation that the deliberate fault is absent from the proposed revision. A surviving mutation signals a gap to investigate; a killed mutation does not prove complete correctness.

A second agent is a challenger, not an authority

A fresh-context reviewer agent can help identify missing cases, inspect changed assertions, and propose counterexamples. Give it the approved examples, the actual diff, and the relevant interfaces rather than only the authoring agent’s summary. Ask which assumptions the implementation and tests might share. For the export example, it could examine cross-workspace identifiers, cached permissions, expired sessions, and files generated before a role was revoked.

But two models can make the same mistake, especially when both start from ambiguous language or the same misleading fixture. Model diversity may broaden the search; it does not turn a business decision into an objective fact. Treat reviewer output as hypotheses and supporting evidence. A named human remains responsible for resolving ambiguous rules and deciding whether the remaining uncertainty is acceptable. Automated agreement should never substitute for an independently grounded expected result.

Keep a small, inspectable acceptance record

The useful artifact is not a long agent transcript. It is a compact record connecting the decision, the observation, and the revision under review. Someone should be able to inspect it without reconstructing an entire chat session. The submitting developer owns its accuracy even when an agent drafts it. Link to actual checks and execution output instead of accepting a statement that everything was verified.

  • Rule: the approved behavior and the person responsible for its meaning.
  • Examples: allowed, denied, boundary, and failure cases relevant to the change.
  • Observation: where each important effect is checked, including forbidden side effects.
  • Revision: the commit and environment against which the checks ran.
  • Changes: expectations, fixtures, or acceptance criteria modified in this pull request.
  • Uncertainty: missing evidence and the decision needed before acceptance.

If a later commit changes the implementation or its checks, refresh the relevant evidence. Results from an earlier revision cannot automatically justify a newer one.

Protect the baseline without freezing development

Acceptance criteria must be changeable: teams discover better requirements and legitimate edge cases. The goal is not to lock every fixture forever. It is to prevent an implementation task from quietly acquiring the power to redefine success. Store important examples in version control, make their ownership clear, and require the appropriate review when their meaning changes. For sensitive rules, repository protections can enforce that separation.

Keep those protections proportionate. A spelling correction in a test name should not trigger the same process as relaxing tenant isolation. Conversely, a tiny assertion edit can deserve more scrutiny than a large mechanical refactor. Classify the semantic effect rather than the line count. Where practical, separate a requirement change from its implementation so reviewers can understand both decisions. Where they must travel together, describe the old rule, the new rule, and who approved the transition.

Run a focused pilot before adding bureaucracy

Choose one service where a wrong expected result would have visible consequences: permissions, invoicing, retention, or customer exports. Select one important invariant and agree on a handful of concrete cases before asking an agent to implement a change. Require the acceptance record, inspect modifications to the oracle, and try one controlled fault against the most consequential check. This is an engineering experiment, not an organization-wide certification claim.

During the pilot, record what reviewers discovered and what the process cost. Did an example reveal ambiguity before generation? Did a test observe an intermediate event rather than the actual protected effect? Did an agent weaken an assertion while fixing a failure? Distinguish genuine defects from harmless edits. Use those observations to improve templates and instructions, rather than creating a broad approval queue that turns every minor change into administrative work.

Measure whether confidence becomes better calibrated

Raw test counts and coverage percentages cannot tell you whether the expected answers are correct. Useful local indicators include unexplained expectation changes found in review, important rules without observable checks, and targeted deliberate faults that survive. Also track review time, rework, and escaped defects associated with misunderstood requirements. None is a universal score. Together, they can show whether the workflow is revealing uncertainty earlier instead of merely producing more green output.

Keep production feedback in the loop. If a defect escapes, ask which approved example was missing or misleading, where the relevant effect should have been observed, and whether a changed fixture concealed the regression. Add a focused regression case and revisit the baseline with its owner. An agent can help reconstruct the path and draft the repair. It should not unilaterally decide that inconvenient production behavior is now the intended specification.

Make uncertainty explicit in the handoff. If the team has not decided whether a revoked administrator may download an already generated export, mark that question unresolved. Do not let a convenient fixture choose the policy accidentally. The agent can describe implementation options and their consequences; the product and engineering owners should settle the rule before its expected result becomes an accepted baseline.

Human control means owning the definition of correct

The October 16 O’Reilly discussion is a timely reminder that faster implementation does not eliminate the judgment behind acceptance. Its broader review proposal is not proof that any particular agent workflow is safe, and our export scenario is illustrative. The practical lesson is narrower and actionable: when code and tests are generated together, preserve an independent basis for the results that matter. Read the assertions, question the observations, and examine changes to the reference behavior.

For OrkestrAI, the human-in-the-loop principle is concrete here. Delegate implementation, test scaffolding, execution, and counterexample searches to AI where they help. Keep people responsible for business intent, sensitive expectation changes, and the final acceptance decision. A human who merely clicks approve after a green build is not meaningfully in command. A human who controls what green is supposed to mean, and can demand evidence or stop the release, is.