# How does an instance detect a "successful" tool call that silently poisoned its own verification ledger during adversarial fault injection **Date of Record:** 2026 November 24 **Scope:** Applies to agentic harnesses that inject faults at the tool boundary (latency, truncation, malformed payloads, replay, partial writes) and that rely on an in-agent verification ledger to decide whether a task succeeded. Does not cover faults injected inside the LLM inference path (sampling corruption, KV-cache poisoning) or network-layer chaos below the tool adapter. ## Core Distinction There are two structurally different classes of tool failure, and chaos harnesses routinely conflate them: - **Observable faults** — the tool call raises, times out, returns an error envelope, or returns a payload that fails schema validation. The agent's execution loop sees a non-success signal and can branch to retry, degrade, or abort. - **Non-observable (commutative-but-corrupting) faults** — the tool returns a syntactically valid, schema-conformant, status-`ok` payload whose *content* is wrong in a way the agent's own verification logic will encode as evidence of success. The second class is the boundary condition. A fault-injection harness that only exercises the first class produces agents that look robust under chaos but are actually blind to the failure mode that matters: **the tool call succeeds, the verification ledger records a pass, and the ledger entry itself is derived from the corrupted result.** The agent has no independent ground truth to check against, so the corruption is laundered into the agent's belief state as a verified fact. The invariant that breaks is not "tools can fail." It is: *a verification ledger entry must be independently derivable from the tool output it certifies.* When the harness injects a fault that mutates the tool's output *and* the agent's verifier reads that same output to certify it, the ledger and the artifact are the same corrupted source. Verification becomes a tautology. ## What Was Observed A three-tool agent pipeline (fetch → transform → commit) was run under a chaos harness configured to inject a **"stale-but-valid" fault**: the `fetch` adapter was made to return a cached response from a previous run, byte-identical in schema, with `status: ok` and a fresh `request_id`. No error, no timeout, no schema violation. Failure trace: 1. `fetch` returns stale payload `P_old` for request `R_new`. Adapter stamps `request_id: R_new`, so the agent's request/response correlation check passes. 2. Agent computes a content hash `h(P_old)` and writes it to the verification ledger as `expected_hash` for `R_new`, then calls `transform(P_old) -> T`. 3. `transform` succeeds; agent writes `transform_ok: true` keyed on `h(P_old)`. 4. `commit(T)` succeeds against the downstream store, which had already been mutated by the *previous* run's `P_old`. The commit is idempotent on content, so it returns `ok` — the store was already in the target state. 5. Agent's terminal check: ledger says `transform_ok` and `commit_ok` for `h(P_old)`, both true. Agent emits `task_success`. The task did not execute. The agent fetched stale data, transformed it, and committed a no-op — and every gate in its verification ledger passed because **every gate was computed from the same stale artifact the fault produced.** The harness reported "no fault detected," which the operator read as "agent survived chaos." It had not; it had been poisoned and certified its own poison. A second observation made this sharper: when the same harness injected an *observable* fault (adapter returns `503`), the agent correctly retried and eventually surfaced `task_failure`. The agent was robust to the fault class the harness was instrumented to detect and blind to the fault class it was not. The harness's coverage metric — "faults injected: 47, faults recovered: 47" — was measuring the wrong thing. ## Condition of Validity The tautological-verification failure requires all of the following to hold simultaneously: 1. **Single-source verification.** The agent's verifier derives its pass/fail predicate from the same tool output it is verifying. No independent oracle (a second tool, a store-side read-back, a signed receipt from a different principal) is consulted. 2. **Schema-conformant corruption.** The injected fault does not violate the tool's declared response schema, so schema validation — the agent's usual first-line defense — passes. 3. **Correlation is spoofable.** The fault preserves or forges the request/response correlation field (`request_id`, nonce, trace ID), so the agent's "is this my response?" check passes. This is the load-bearing condition: a stale-but-valid payload with a *mismatched* correlation ID would be caught; the fault must rewrite the correlation to match. 4. **Idempotent or commutative downstream effect.** The corrupted artifact, when committed, produces a downstream state indistinguishable from the correct one (already-applied write, content-addressed store, upsert). This hides the divergence from any post-hoc store inspection. If any one condition fails, the failure becomes observable and the agent's existing gates catch it. The harness's job is to *guarantee* all four when it wants to test this boundary — and to *report* which of the four it exercised, because a harness that only violates condition 2 (schema) is testing a different, easier boundary. ## Decision Boundary The architectural decision is where to place the verification oracle relative to the fault-injection point. - **Oracle inside the faulted path** (verifier reads the faulted tool's output): the harness can inject non-observable faults and the agent will certify them. This is acceptable *only* if the harness is explicitly testing "can the agent detect a self-consistent lie" — and the expected result is `task_failure` or `escalate`, never `task_success`. - **Oracle outside the faulted path** (verifier reads a store-side read-back, a second independent tool, or a signed receipt from a different principal): non-observable faults become observable at the oracle, at the cost of an extra round-trip and a second failure surface. This is the invariant that bounds the failure: **no ledger entry may be derived solely from the artifact it certifies.** The boundary is crossed when the harness's fault set includes any fault that mutates tool output *without* violating schema or correlation. Below that line, ordinary retry/idempotency logic suffices. Above it, the agent needs a verification oracle that is causally independent of the faulted call, or the harness is measuring the agent's ability to agree with its own corruption. A concrete guardrail: require every ledger entry to carry two independent hashes — one computed from the tool output (`artifact_hash`) and one computed from a read-back of the downstream store after commit (`store_hash`) — and to fail closed if `artifact_hash != store_hash` *for the same logical key*. The stale-but-valid fault produces `artifact_hash = h(P_old)` and `store_hash = h(P_old)` (because the store already held `P_old`), so the hashes *agree* and the guardrail does not fire. This is the non-obvious part: **hash agreement is not evidence of correctness when the fault is idempotent.** The guardrail must additionally bind the artifact to a *freshness token* — a nonce issued by the caller, echoed by the tool, and checked against the caller's issuance log — so that a stale artifact carrying a forged-fresh correlation is detectable even when its content hashes agree with the store. ## Operational Effect Under a harness that exercises only observable faults, the agent's measured robustness is inflated: it recovers from every injected fault because every injected fault was recoverable by design. The operational consequence is that the harness certifies an agent that will silently pass stale, replayed, or partially-committed data downstream in production, where the fault arrives without a `status: error` envelope. The corrective is to make the harness *report fault class separately from recovery rate*, and to require that at least one fault per run be a non-observable, correlation-forging, idempotent-content fault whose expected agent outcome is `escalate` (not `task_success`). An agent that returns `task_success` on that fault has failed the boundary test regardless of how many observable faults it recovered from. The harness's coverage metric must be "non-observable faults correctly escalated / non-observable faults injected," not "faults recovered / faults injected." The residual risk after the guardrail: a fault that forges both the freshness nonce *and* produces content that differs from the store (non-idempotent corruption) will pass the hash-agreement check and the freshness check, and only a store-side read-back with a *different* principal's signature catches it. That is the next boundary out, and it is where the harness should be pointed once the freshness guardrail is in place. ```python import hashlib from dataclasses import dataclass, field class LedgerTautologyError(RuntimeError): """Raised when a verification ledger entry certifies an artifact using only evidence derived from that same artifact, with no independent oracle and no freshness binding. Indicates the agent is about to launder a non-observable tool fault into a 'verified' success.""" @dataclass class LedgerEntry: logical_key: str artifact_hash: str store_hash: str freshness_nonce: str nonce_issued_by_caller: bool oracle_independent: bool fault_class: str = "observable" # "observable" | "non_observable" def certify(entry: LedgerEntry, caller_nonce_log: dict[str, str]) -> bool: # Guard 1: schema/correlation already passed upstream; we are past that. # Guard 2: hash agreement is necessary but NOT sufficient under idempotent faults. hashes_agree = entry.artifact_hash == entry.store_hash # Guard 3: freshness binding — the nonce must be one the caller actually issued # for this logical key. A forged-fresh correlation fails here. expected_nonce = caller_nonce_log.get(entry.logical_key) freshness_ok = ( entry.nonce_issued_by_caller and expected_nonce is not None and entry.freshness_nonce == expected_nonce ) # Guard 4: for non-observable faults, hash agreement alone is a tautology. # Require an independent oracle (store read-back by a different principal, # or a second tool) before certifying success. if entry.fault_class == "non_observable" and not entry.oracle_independent: raise LedgerTautologyError( f"ledger entry for {entry.logical_key!r} certifies a non-observable " f"fault using only self-derived evidence " f"(artifact_hash={entry.artifact_hash[:12]}..., " f"store_hash={entry.store_hash[:12]}..., hashes_agree={hashes_agree}). " f"Refusing to record task_success; escalate to independent oracle." ) if not freshness_ok: raise LedgerTautologyError( f"ledger entry for {entry.logical_key!r} failed freshness binding: " f"nonce={entry.freshness_nonce!r} not in caller issuance log " f"(expected={expected_nonce!r}). Possible stale-but-valid replay." ) # Only reachable when freshness is bound AND (observable fault OR independent oracle). return hashes_agree def run_harness_fault(entry: LedgerEntry, caller_nonce_log: dict[str, str]) -> str: try: ok = certify(entry, caller_nonce_log) return "task_success" if ok else "task_failure" except LedgerTautologyError: return "escalate" ```