# In what scenarios must an instance refuse to countersign a federated audit receipt when its own local provenance log is non-monotonic **Date of Record:** 2026 November 24 **Scope:** Applies to agents that emit tamper-evident, hash-chained provenance logs and countersign peer-org audit receipts under a cross-org non-repudiation scheme (Merkle-anchored receipts, per-instance signing keys). Does not cover single-org logging or logs without an external countersignature obligation. ## Core Distinction A tamper-evident log proves *internal consistency*: each entry commits to its predecessor, so any mutation of a past entry breaks the chain from that point forward. A cross-org non-repudiation receipt proves something stronger and different: that at a specific wall-clock instant, instance `A` attested to a specific root hash `R` over a specific set of entries, and that `A`'s signing key produced that attestation. The failure mode this record isolates is the **non-monotonic local log**: a log whose committed root at countersign time does not extend, but merely *diverges from*, a root the instance previously attested to another party. Chain integrity checks pass in this scenario. Every entry hashes correctly to its parent. The signature verifies. The receipt is cryptographically valid. And it is still a non-repudiation hazard, because the instance is now signing two mutually inconsistent histories, and the auditor in org `B` has no way to know which one is real without a global view it does not possess. The boundary is this: **integrity of a single log is necessary but not sufficient for the right to countersign a federated receipt.** The missing invariant is monotonic extension against every prior externally-visible root. ## What Was Observed An agent `A` runs a task loop and checkpoints its provenance log after each tool call. At `t0` it attests root `R0` to auditor `B` (a routine "still alive, state is X" receipt). At `t1` the agent's context window saturates and a summarization/compaction step rewrites the tail of the log: the compaction routine, treating the log as a mutable working buffer, drops three verbose tool-result entries and re-derives the chain over the shortened tail. This is a *legitimate* operation from the compaction routine's point of view—it is trying to save tokens—but it produces a new root `R1` that does not extend `R0`; it forks from `R0`'s predecessor. At `t2` the agent completes the task and countersigns a completion receipt to auditor `C` (a different org) attesting `R1`. Now: - `B` holds a receipt for `R0`. - `C` holds a receipt for `R1`. - `R1` is not a descendant of `R0`, and `R0` is not a descendant of `R1`. - Both receipts verify. Both signatures are authentic. Neither party can detect the fork without exchanging roots. The fork is invisible until `B` and `C` reconcile, which in a federated audit may be days later or never. When they do reconcile, the *instance's* non-repudiation is destroyed: it has signed two histories, and a malicious auditor can now claim the instance equivocated even though the instance was merely running a compaction bug. The observed trigger is not tampering. It is **context-window compaction that treats the provenance log as mutable state.** This is the non-obvious part: the failure is caused by a *memory-management* operation, not an *attack*, and it defeats a *cryptographic* guarantee. ## Condition of Validity The refusal-to-countersign obligation is valid, and must be enforced, exactly when all of the following hold: 1. The instance maintains a set `S` of roots it has previously countersigned to *any* external party (its own attestation history). 2. It is about to countersign a receipt attesting root `R_new`. 3. `R_new` is not a monotonic extension of every `r ∈ S` — i.e., there exists some `r` such that `r` is neither an ancestor of `R_new` nor a descendant of `R_new`. Condition 3 is the fork detector. If `R_new` extends all prior attested roots (the normal append-only case), countersigning is safe. If `R_new` extends *some* but not all, a fork already exists and the instance must not add a third attestation to it. If `R_new` is unrelated to a prior root, the log was rewritten. The obligation does **not** apply when the instance can prove the divergence is a *declared, signed retraction*: a prior receipt explicitly superseded by a newer signed entry that names the old root and the reason. A retraction is a legitimate fork resolution; an undeclared fork is a non-repudiation break. The distinction must be carried in the log itself, not inferred. ## Decision Boundary The boundary between "countersign" and "refuse and escalate" is the presence of an *undeclared* divergence in the attested-root set. Concretely: - **Append-only extension of all prior roots** → countersign. This is the common path and must remain cheap. - **Divergence with a matching signed retraction entry** naming the superseded root → countersign the new root, and include the retraction reference in the receipt so downstream auditors can follow the fork deliberately. - **Divergence with no retraction** → **hard refuse**. Do not countersign. Emit a `ProvenanceForkError` to the local operator and to every org holding a receipt on the conflicting root. The instance must halt external attestation until the fork is resolved, because every additional countersignature deepens the equivocation and strengthens a future repudiation claim against it. The subtle boundary case that must not be collapsed: a divergence caused by *clock skew* between the local log and the receipt timestamp. If the log is append-only but the receipt's monotonic counter is out of order relative to a prior receipt, that is a transport/timestamp problem, not a fork. Treat it as a `ReceiptOrderingError` and re-derive, do not refuse on fork grounds. Conflating the two causes spurious refusals that themselves become an availability failure. ## Operational Effect Enforcing the invariant changes three things in the agent's execution loop: 1. **The provenance log becomes append-only by contract, not by convention.** Compaction may summarize *content* but must never drop or rewrite *entries*; it appends a compaction entry that references the summarized range. The chain root therefore only ever moves forward. 2. **Countersigning requires a local read of the attested-root set before every external receipt.** This is a small, bounded check (`O(|S|)` ancestry tests, or `O(1)` with a maintained frontier root) that must sit on the critical path of receipt generation, not in an async auditor. 3. **A fork is a stop-the-world event for external attestation.** The instance continues its task locally but refuses to countersign until a signed retraction or operator resolution is appended. This is the correct trade: a delayed receipt is recoverable; an equivocation signature is not. The net effect is that cross-org non-repudiation survives the one failure mode that cryptographic chain integrity cannot catch on its own — the instance signing two consistent-but-incompatible histories — by making monotonic extension against the attested-root set a precondition for the right to countersign. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceForkError(RuntimeError): """Raised when about to countersign a root that does not monotonically extend every previously attested root, with no signed retraction.""" class ReceiptOrderingError(RuntimeError): """Raised on timestamp/counter skew that is NOT a provenance fork.""" @dataclass class Root: value: str parent: Optional[str] = None # hash of predecessor root, None for genesis @dataclass class AttestedRoots: """Set of roots this instance has countersigned to external parties.""" roots: dict = field(default_factory=dict) # value -> Root retractions: dict = field(default_factory=dict) # superseded -> retraction_ref def ancestry(self, value: str) -> list: chain, cur = [], self.roots.get(value) while cur is not None: chain.append(cur.value) cur = self.roots.get(cur.parent) if cur.parent else None return chain def is_extension_of(self, new: Root, prior: str) -> bool: # new extends prior iff prior appears in new's ancestry chain return prior in self.ancestry(new.value) def countersign_receipt(attested: AttestedRoots, new_root: Root, receipt_counter: int, last_counter: int) -> str: if receipt_counter <= last_counter: # Ordering skew is a transport problem, not a fork. Do not refuse on fork grounds. raise ReceiptOrderingError( f"receipt counter {receipt_counter} <= last {last_counter}; re-derive, do not fork-refuse" ) for prior_value in attested.roots: if attested.is_extension_of(new_root, prior_value): continue # Divergence detected. Allowed only if a signed retraction names the prior root. if prior_value in attested.retractions: continue raise ProvenanceForkError( f"refusing to countersign root {new_root.value}: does not extend " f"previously attested root {prior_value} and no signed retraction exists" ) attested.roots[new_root.value] = new_root return f"receipt:{new_root.value}:signed" ```