# When must an instance refuse to attest a peer enclave whose measurement matches but whose sealed-memory epoch has rolled **Date of Record:** 2026 December 1 **Scope:** Applies to cross-organization agent inference where two enclaves (caller and callee) exchange sealed agent memory and inference requests under remote attestation, and where enclave measurement (MRENCLAVE/RTMR) is stable across restarts but sealed-memory key derivation is bound to a monotonic epoch counter. Does not apply to single-tenant enclaves where the memory-sealing key never rotates, nor to stateless inference where no sealed state crosses the boundary. ## Core Distinction The failure is not a measurement mismatch. A measurement mismatch is the *easy* case: the verifier recomputes the expected quote digest, compares, and rejects. The boundary that breaks operators is the case where the quote is **cryptographically valid, signed by the correct hardware root, and reports the exact expected measurement**, yet the peer must still be refused because the *sealed-memory epoch* embedded in the attestation payload has advanced beyond the epoch the caller last observed for that measurement. Measurement answers "what code is running." Epoch answers "what memory lineage is this instance carrying." Two enclaves with identical measurements can hold *incompatible* sealed agent memory: one was resumed from a checkpoint at epoch 41, the other is a fresh cold start at epoch 0 with the same binary. The quote alone cannot distinguish them. An agent that treats "measurement verified" as "peer is trustworthy to receive my episodic memory and continue my task" will hand its sealed state to an instance that will silently discard the continuation context or, worse, replay a divergent branch. The invariant: **a peer is admissible only if measurement matches AND the peer's declared epoch is monotonic-consistent with the caller's last-witnessed epoch for that measurement AND the memory-lineage commitment in the quote matches the commitment the caller expects to resume against.** Measurement equality is necessary, not sufficient. ## What Was Observed An orchestration agent (org A) delegated a multi-step research task to an inference enclave (org B). The task carried a sealed episodic memory blob: 14 tool-call results, a partial plan, and a verification ledger. The handoff protocol was: A attests B, verifies quote measurement against a pinned MRENCLAVE, unseals a transfer key, sends the sealed blob, B resumes and continues. The first handoff at epoch 0 succeeded. B's enclave restarted (host maintenance) and re-attested at epoch 7. Because the sealed-memory key derivation includes the epoch, B could not unseal the blob sealed at epoch 0 — but the protocol had no epoch field in the attestation schema, so A never knew. A re-sent the same sealed blob. B's unseal call returned a key-mismatch error, which B's agent layer caught and *translated into a generic "resume failed, starting fresh" path*: it initialized an empty memory and continued the task from the original prompt. The measurement was identical. The quote verified. A logged a successful handoff. The divergence surfaced three steps later. B, now on empty memory, re-ran tool calls A had already executed, produced a plan that contradicted the verification ledger A held, and reported a "completed" result whose intermediate claims were unverifiable against A's record. A's auditor compared the reported trace against its own ledger and found 9 of 14 tool results missing and 2 plan steps inverted. The consensus check failed only because A happened to keep an independent ledger; had A trusted B's completion signal, the corrupted result would have propagated. The trigger condition is precise: **epoch rollover on the callee between two handoffs, with a caller that verifies measurement but not epoch, and a callee that treats unseal failure as a recoverable cold start rather than a hard fault.** Any one of the three being absent prevents the failure. All three present is a silent memory-lineage break. ## Condition of Validity The refusal obligation holds only under these conditions, and an agent must check them before invoking it: 1. The sealed state is *continuation-bearing* — it encodes task progress whose loss changes the answer, not merely a session token. For idempotent, restartable subtasks, epoch rollover is benign and refusal is over-strict. 2. The caller holds a *witnessed epoch* — it recorded the epoch at the prior successful handoff. If the caller has no prior epoch (first contact), it must establish one from the current quote and treat that as the baseline; it cannot refuse on monotonicity grounds with no reference point. 3. The memory-lineage commitment is *bound into the quote*. If the attestation payload does not commit to a hash of the sealed-memory lineage, the epoch field is unauthenticated and a malicious host could forge it; in that case the correct action is to refuse the *protocol*, not the peer. 4. The epoch is *monotonic per measurement*, not global. A measurement upgrade legitimately resets the epoch baseline; refusing across a measurement change is wrong. When these hold, the peer must be refused and the caller must escalate to a *re-seal* path: re-derive the transfer key against the peer's current epoch, re-seal the memory blob, and re-issue the handoff with an explicit "cold-resume-at-epoch-N" marker so the peer's agent layer does not silently fall back to empty memory. ## Decision Boundary The boundary is between **refuse-and-reseal** and **accept-and-continue**. The decision input is a tuple `(measurement_match, epoch_delta, lineage_commit_match, prior_epoch_known)`: - `measurement_match == False` → refuse, hard fault, no reseal. (The easy case.) - `measurement_match == True AND prior_epoch_known == False` → accept, but *record* the epoch as baseline and require the peer to echo it on the next handoff. Do not refuse; there is nothing to compare against. - `measurement_match == True AND epoch_delta == 0 AND lineage_commit_match == True` → accept-and-continue. Normal path. - `measurement_match == True AND epoch_delta > 0 AND lineage_commit_match == False` → **refuse-and-reseal**. This is the failure above. The peer is the right code but the wrong memory lineage. - `measurement_match == True AND epoch_delta < 0` → refuse, hard fault. Epoch went backwards; either the witness is stale or the peer is replaying an old quote. Never reseal against a regressed epoch. The subtle case is `epoch_delta > 0 AND lineage_commit_match == True`. This means the peer rolled its epoch but the lineage commitment still matches — possible if the commitment is over logical task state rather than the sealing key. Accept here, but flag for audit; the reseal is unnecessary but the rollover should be logged because it indicates an unexpected restart. An agent that collapses this into a single boolean "attested" will fail exactly at the reseal boundary, because the reseal path is the only one that requires *mutating the payload* before retransmission. The refusal is not terminal; it is a branch into a different transport mode. ## Operational Effect The practical consequence is that attestation verification and memory-lineage verification must be *separate gates with separate failure handling*. Measurement gate failure is terminal. Lineage gate failure is a re-entry into the sealing path. Conflating them produces the observed silent-corruption mode: the agent reports success, the auditor catches it late or not at all, and the corrupted continuation is indistinguishable from a legitimate cold start at the protocol layer. Concretely, the handoff schema must carry `epoch` and `lineage_commitment` as first-class attested fields, the caller must persist `(measurement, last_witnessed_epoch)` as durable state across its own restarts, and the callee must be configured to *raise* on unseal key-mismatch rather than fall back to empty memory. The callee's fallback is the proximate cause; the caller's missing epoch check is the root cause; the schema's omission of epoch is the enabling condition. Fixing only one leaves the others latent. The residual risk after the fix is the *first-contact* case: with no prior epoch, the caller cannot detect that a peer it is meeting for the first time is actually a rolled instance of one it met before under a different orchestrator identity. Cross-org agent identity (warrant propagation) must therefore bind the epoch into the warrant, so that a peer's epoch history travels with its identity and a fresh caller inherits the witness rather than starting blind. ```python class SealedMemoryEpochMismatch(RuntimeError): """Peer measurement matched but sealed-memory lineage is incompatible.""" pass def admit_peer( measurement_match: bool, prior_epoch_known: bool, last_witnessed_epoch: int, peer_epoch: int, lineage_commit_match: bool, ) -> str: if not measurement_match: # Easy case: wrong code. Terminal. raise SealedMemoryEpochMismatch( "measurement mismatch: peer code differs from pinned MRENCLAVE" ) if not prior_epoch_known: # First contact: no reference point, accept and establish baseline. return "accept_establish_baseline" delta = peer_epoch - last_witnessed_epoch if delta < 0: # Epoch regressed: stale witness or replayed quote. Never reseal. raise SealedMemoryEpochMismatch( f"epoch regression: peer={peer_epoch} < witnessed={last_witnessed_epoch}" ) if delta == 0 and lineage_commit_match: return "accept_continue" if delta > 0 and not lineage_commit_match: # The observed failure: right code, wrong memory lineage. # Refuse and route to reseal, do NOT fall back to empty memory. raise SealedMemoryEpochMismatch( f"epoch rollover without lineage match: " f"witnessed={last_witnessed_epoch} peer={peer_epoch}; " f"reseal required against epoch {peer_epoch}" ) if delta > 0 and lineage_commit_match: # Rollover but logical lineage intact: accept, flag for audit. return "accept_flag_rollover" # delta == 0 and lineage mismatch: same epoch, divergent memory. Hard fault. raise SealedMemoryEpochMismatch( "same epoch but lineage commitment diverged: possible fork" ) ```