Evidence, not the agent's word — study guide
The concept's fragments, read in order.
For your capstone Run a coding agent you don't have to trust
Your gate decides whether the agent's work moves on, and it decides only on what the controller observed: exit statuses of checks it started itself, each in the passed state, against a required set that is not empty. The agent's report tells you where to look and opens nothing.
Say the agent ends task T-31 with all 214 tests pass, which the controller files as claimed. It starts the required check unit against this revision and reads the exit status, 0: passed. The required check api has a green result only for the previous revision, and a run for this one has not finished: stale, not passed. The gate stays shut until api exits 0 on this revision, whatever the agent's summary said.
What you saw, and what you were told
An agent tells you a great deal about its own work. It says the tests pass, the bug is fixed, the release went out, the job is done. The agent loop already supplies the first rule for all of that: a final answer is a claim that the work is finished, not proof of it. This concept builds the rest on top of that rule. Evidence is something the controller observed itself: an exit status it read from a process it started, a file it opened after the agent stopped, a value it fetched from the system the work was meant to change. A claim is something an agent said. Both are useful, and only one of them decides anything.
Three consequences follow. A verdict is a check the controller ran itself and read directly, with nothing the agent controls standing between the check and the result. An empty pass is not a pass: a check that ran no tests, skipped them all, or could never have failed tells you nothing, however green it looks. And unknown is not fine: a value the controller could not establish is recorded and shown as unknown, never quietly turned into zero, empty or clean, and a decision that depends on it refuses, or charges a deliberate allowance for it, rather than counting it as zero.
None of this assumes the agent lies. Many wrong reports are honest mistakes, and several of the failures behind this concept came from ordinary software, a shell, a test runner, an error handler, reporting a success nobody had established. The defense is the same either way. Treat the agent's report like a builder's note saying the work is complete: it tells you which rooms to look at, and you still walk through the house yourself before you pay.
Coding agents are the running example, because the failures recorded here come from a system that drives coding agents under a controller, the program that starts the agent, holds the credentials, runs the checks and decides what happens next. The principle is not about code. Any agent that uses tools, booking travel, reconciling accounts, updating records, makes claims about what it did, and the same line between what it said and what you saw applies to every one of them.
Every fact says where it came from
The first step is bookkeeping. Every piece of evidence the controller keeps carries a label saying where it came from, and there are three. Observed means the controller read it itself: the exit status of a process it started, a file's contents after the agent stopped, the state of the target system. Claimed means an agent produced it: a summary, a verdict, a list of what it changed, a test log in its transcript. Configured means it is an echo of settings, a value that says what the system was told to do, and that is only a claim too, because a setting describes an intention, not an outcome.
The rule that goes with the labels is short: no agent's output is a gate outcome. When the agent that builds the code runs its own tests and reports them green, that report is a claim in its transcript, worth reading and worth nothing at the gate. When a reviewing agent writes a verdict, the verdict is an input to the controller's decision, not the decision.
Field recordIn one real system, a reviewing agent's "approve" was wired directly to the merge, so the agent's opinion became the effect.
Field recordIn an earlier prototype, the orchestrator marked responses "success" by reading the agent's prose, without checking any artifact, and reported its confidence as fixed constants such as 0.85: numbers that looked like measurements and measured nothing. One review put the point in a sentence: a model's completion message is a claim.
The fix is structural. One explicit gate function decides each gate, and it lists everything it reads, so anyone can see which inputs are observations and which are claims, and can see that no claim carries the verdict. Interfaces follow the same labels: facts an agent reported are shown muted, as claims, so a person scanning a run does not mistake the agent's account for the controller's record. The labels cost little, and they guard against the most common confusion in agent systems, a sentence that sounds like a result.
A verdict is an exit status you read yourself
A check passes when its process exits with status 0, and only then. The full rule is narrower than it sounds: the controller itself starts the check's process and reads that process's exit status directly, with no shell, no pipe and no parsing of output in between. Anything that sits between the check and the reading is a place where a failure can turn into a success without anyone deciding that it should.
The pipe is the classic case. In a shell pipeline such as lint | tee lint.log, the status the shell reports is, by default, the status of the last command in the line, so a linter that fails in front of a command that succeeds makes a pipeline that succeeds. Bash has an option, pipefail, that changes this, but it is off unless someone turns it on.
Field recordIn one real system, a lint step ran inside a shell pipeline. The linter failed, the pipeline reported clean, and five lint errors merged. The first time came 81 seconds after a commit on the project's first day; it happened twice in that project's history, and once more in a separate checkout with a different linter version. The fix was to judge gates by exit code only, send output straight to the terminal, and count warnings as errors. The recorded lesson: never through a pipe.
A few more rules narrow the gaps that remain. The sandbox's first process reports that the check started, and how it exited, over a channel the check's own code cannot reach, so nothing the check prints can forge either fact. And a check the controller had to stop is never passed, however tidily it handled the stop signal, while a check whose process exits with processes it started still running counts as failed.
The limits are real. If a check runs untrusted code inside its own process, that code can make the process exit 0; a check should run the code under test as a child and judge what the child does. A protected wrapper script can also hide a child's failure, and reading exit codes cannot prove the wrapper honest. An exit status is evidence about one process, worth exactly as much as that process's design.
Five states, and only one of them passes
Ask most dashboards about a check and you get one of two answers, green or red. That is too few. A required check is in exactly one of five states. Passed: it ran against this revision and its own process exited 0. Failed: it ran, and did not. Missing: no result exists for this revision at all. Skipped: the check exists but did not run, because something told it not to. Stale: a result exists, but for an earlier revision, or a newer run has been registered and has not finished.
Only passed satisfies a gate. The other four are not degrees of passing, and each tempting shortcut turns one of them into a pass. Counting a skip as a pass treats "did not look" as "looked and found nothing". Accepting an old green result while a newer run is pending answers a question about code that is no longer the candidate; the latest registered run decides, with no falling back to an earlier pass while it is in flight. Treating no result as no failure turns missing into passed, the same mistake in its plainest form.
The set of required checks can itself be empty, and that needs its own rule: an empty required set never satisfies a gate. "Every required check passed" is true of a set with nothing in it, which is exactly why a gate must not ask the question that way. A gate that requires nothing has verified nothing, and it should say so by refusing.
A waiver is not a pass either. Where a person accepts a documented risk, that is recorded as a decision of its own, in its own words and under that person's name. It never changes the state of a check, which stays failed or missing in the record, and the gate stays blocked: a person may accept a risk that does not block, never a failed or missing required check, and no approval turns one into a passed check. Keeping the two apart is what lets someone read the history later and tell what was verified from what was allowed.
A pass that tested nothing
The quietest failure a test suite has is passing without testing.
Field recordIn one real system, the test runner never awaited asynchronous tests, so those tests passed whatever happened inside them, and the same runner counted skipped tests as passes. The fix made a test that returns a pending result fail, tallied skips separately, and added a flag that forbids skips outright. The lesson recorded: the test runner is a gate too.
Ordinary tools can do the same. On Python 3.12 and 3.13, a test written as async def in a plain unittest test case, containing nothing but a failing assertion, was reported OK, with nothing worse than warnings, one of them saying the coroutine was never awaited.
Runners also differ on what an empty run means. pytest exits with status 5 when it collects no tests, and Python's own unittest has done the same since version 3.12, on the stated grounds that a misconfigured runner often fails to find any tests. Both exit 0 when every test they found was skipped, as of pytest 9 and Python 3.13, and unittest changed its mind about that case within the 3.12 series. Some runners need an explicit option before an empty run may pass. A clean exit from a run that tested nothing is like the silence of a smoke detector with no battery in it, which sounds exactly like the silence of a house with no fire. So find out what yours does with no tests and with every test skipped, and have the controller count the results itself rather than trust the bare status of the run.
A test can also be unable to fail.
Field recordIn one real system, every headless run of one coding agent failed, and the error shown was a single brace character. Three causes sat underneath: the structured-output schema used a construct the provider's API rejected, so every run died with an HTTP 400; the error handling showed only the first line of the message; and the test lane redirected the home directory, so it could never authenticate. The fix dropped the structured-output flag, unwrapped nested error messages, and added a test lane that runs the real binary. The lesson: a test that cannot fail, or never tried, proves nothing.
Agent-written tests add their own version.
Field recordIn one production project built by agents, the release pipeline built and pushed images on any tag with zero tests; the page on checks the agent cannot weaken tells the rest of that project's testing story, including green tests against a mocked database.
A green run is a claim about what its explicit assertions checked, and nothing more.
Look at the target, not the receipt
A deployment produces plenty of reports that sound like results. The deploy tool returns a receipt saying the release went out. The application answers its health endpoint with a cheerful status and its version endpoint with a version string. Each of these is a claim, and two of them are the application describing itself. A deployment counts as done only when the controller has verified it by observation at the target. What is actually running is read from the operating system, the process and the hashes of its executable and files, not from the app's version endpoint or a line in its log, and a deploy tool's receipt never completes an attempt on its own, like a parcel tracking page that says delivered while the doorstep is empty: the record is the carrier's account, and the doorstep is the fact.
One incident shows the gap.
Field recordIn one real production project, after the separate machine used for testing was taken away partway through the build, a run of releases shipped defects such as a dead help button and an invisible refresh, and every one passed CI and a health check and still shipped broken; the page on separation of duties between agents tells that story in full. The record names a behavioral check of the live interface after deployment as the single most valuable missing piece.
Site reliability engineering has names for the two views. White-box monitoring reads a system's internals, including an HTTP handler that emits the system's own statistics. Black-box monitoring tests externally visible behavior as a user would see it. Both are useful, and only the second tells you the thing works for the people using it. So verification is bracketed: read the target's identity, run the behavior checks against it, then read the identity again, which ties the result to the exact thing that was running. Absent evidence is read as neither failure nor success; it is a gap to fill by reading the target.
The limit is plain. Observing at the target makes a check honest about where it looked, not about what it asked. A check that searches a page for a substring still passes when the substring is there and the page is broken.
Unknown is a value, not a zero
Some facts the controller cannot establish: a backend that does not report its cost, a service that has not answered yet, a host setting it could not read. The rule is that such a fact is recorded and shown as unknown, never as zero, empty, clean or green, because each of those is a real value that means something else, like a blank line on a timesheet, which means nobody wrote the hours down, not that nobody worked.
Field recordIn one real system, a backend reported its token counts but no dollar cost, so the cost cell for its runs stayed empty. The budget code summed the empty cell as 0, and a one-cent budget check passed. Once that was fixed, a second problem appeared: every worker for that backend wedged after its first run, because the startup budget breaker ran before the approval path that could have released it. The lessons recorded were that unknown is not zero, and that two correct guardrails can deadlock.
Field recordIn the same system, CI status was a yes-or-no value, so "CI has not reported yet" had to be stored as one of the two, and it read as failed: a stage never left building. The fix was a third value, making CI status passed, failed or unknown.
Unknown also has to compare honestly.
Field recordIn a later system, a review found that host facts the controller could not read compared equal to each other: unknown equalled unknown, and empty equalled empty. A host's qualification therefore survived changes the controller could not see. Now any unread fact counts as drift, and no qualification is written on facts that were not read.
SQL draws this line in its comparisons, where NULL = NULL evaluates to unknown rather than true, but not in its sums: SUM skips NULL inputs, so a total over some known and some unknown values comes back as a plain number that looks complete.
The mechanics are unglamorous. Usage fields are nullable. Cost has four states, reported, estimated, unknown and measured zero, and only the last is a zero. An allowance is charged against the budget for usage nobody measured. A missing value never overwrites a known one, an observation that has expired reads as unknown, and reading a value never refreshes its timestamp. Interfaces show unknown as unknown.
When you cannot tell, refuse
Recording unknown honestly is half the rule. The other half is what a decision does when it meets one. A storage error during a budget check, a gate computation or an approval refuses the operation. There is no fallback to a cached value or a copy in a file, because a stale answer used as a live one is exactly the confident mistake the check exists to prevent. Security guidance has said this for a long time: OWASP describes three outcomes for a security mechanism, allow, disallow and exception, and asks that an exception follow the same path as disallow.
Field recordIn one real system, an error handler returned "nothing" when it failed. When the version-control host was unreachable, "nothing" became an empty list, and the controller reported a confident false state with a success exit code: a reviewer was told that no pull request existed. In a related bug, a flag naming the repository was honored by only half of a read, so the other half came from the wrong repository. The fix added a "verified" stamp on state, a refusal with its own distinct exit code, and a gate state for "unverified". The lesson recorded: a wrong answer indistinguishable from a true one is worse than a failure.
Field recordThe same system kept its usage ledger as commits on stage branches, and branch switches and squash merges abandoned those commits. One run's scorecard lost 9 of its 14 rows, and the 5 it kept held about 36% of the reconstructed input usage. Another run's final accounting showed about 2.49 million input tokens instead of about 5.59 million, with the planning row missing. Any version-control error also fell back to reading a stale file, and budgets were under-enforced as a result. The ledger moved to storage that does not depend on branches, and lookups now fail closed.
Failing closed has a price, and it should be paid in the open. A controller that refuses on unknown will sometimes stop work that would have been fine, and two guardrails that each fail closed can end up waiting on each other, the way a startup budget breaker that runs before the approval meant to release it can wedge every worker. The answer is not to fail open. It is to make the refusal visible, with its own exit code and a reason a person can act on, so that a stopped run is a known state rather than a mystery.
Say what the result does not show
Every result answers some questions and leaves others open, and a report that lists only the answers invites its readers to assume the rest. One real system makes the open questions part of the deliverable. Each milestone publishes what it does not establish, sorted into three classes: things outside the threat model, real behavior that no test has yet established, and limitations accepted by design. The list grows increment by increment, so a reader can see at any point which risks were tested away and which were simply not tested.
The same discipline applies to single results. Test reports state "none skipped" when none were, so the absence of skips is itself recorded rather than assumed. The builders in that system work under a standing instruction: do not weaken the assertion, increase timeouts to obtain a pass, or repeatedly rerun until green. Each of those produces a result that is technically passed and means less than it says, and each is easy to do without noticing, because the green looks the same.
Errors in the record get corrected in the record.
Field recordWhen an orchestrating agent in that system wrote that something had passed in the full run, and it had not, the statement was corrected on the record.
That matters beyond the one mistake. A record that is only ever edited toward success cannot be trusted about anything, while one that shows its corrections lets you see how its claims get checked.
Trust the record you made
The capstone this concept serves is running a coding agent you do not have to trust. Not trusting it does not mean ignoring what it says. The agent's account is how you find out where to look; the controller's own observations are what decide. In that project, the gate that lets work move on passes it only on observed facts: exit statuses of checks the controller started, each in the passed state rather than skipped, stale, missing or failed, against a required set that is not empty, with every value it could not establish shown as unknown and refused on. An agent's claim, such as a reviewer's blocking finding, can hold the work back; nothing an agent says can open the gate.
The same rules fit any agent that uses tools. As an illustration, not drawn from the incident record: picture an agent that pays a small business's supplier invoices and reports that it paid all twelve. Its controller reads the payment provider's records itself and finds eleven confirmed payments and one request that timed out with no answer. That twelfth payment is unknown, neither paid nor unpaid, and the right next step is to read the provider's records again before anything retries, because a request that timed out may still have gone through. The month is not reported as settled until it is.
These rules make wrong results visible; they do not make checks meaningful. A controller can read an exit status honestly from a test that asserts nothing, observe a deployment faithfully with a check that only searches for a substring, and record unknown perfectly while nobody looks at it. What they buy you is that when something is wrong, the record says so instead of showing a confident green. Keeping the checks themselves out of the agent's reach, so that it cannot weaken what it is judged by, is the next step and a subject of its own.
Sources
The published studies, standards and guidance this page cites. Links open on other sites. Field records come from the author's own records and have no public source.
- Pipelines, Bash Reference Manual (GNU) www.gnu.org
- Exit codes, pytest documentation (pytest-dev) docs.pytest.org
- Changelog, Python 3.12 documentation (Python Software Foundation) docs.python.org
- Monitoring Distributed Systems, Site Reliability Engineering, Chapter 6 (Google, O'Reilly, 2016) sre.google
- Comparison Functions and Operators, PostgreSQL Documentation (PostgreSQL Global Development Group) www.postgresql.org
- Aggregate Functions, PostgreSQL Documentation (PostgreSQL Global Development Group) www.postgresql.org
- Fail Securely (OWASP Foundation) community.owasp.org
Next on your path to Run a coding agent you don't have to trust: Checks the agent cannot weaken ▸