# How does an instance detect a manifest-epoch rollback during federated capability discovery when registry signatures remain individually valid **Date of Record:** 2026 November 29 **Scope:** Applies to agents that resolve peers through one or more federated discovery registries publishing signed capability manifests (capability set, schema versions, warrant scope, endpoint) and cache those manifests locally for routing. Does not apply to single-registry, single-writer deployments with monotonic storage guarantees, nor to manifests fetched fresh on every call with no local cache. ## Core Distinction The failure is not a bad signature, a forged manifest, or a compromised registry key. Every signature in the trace verifies. The failure is **epoch regression**: a registry (or a replica of it, or a failover peer, or a rollback of its backing store) serves a manifest that was validly signed at epoch `N-3` while the querying agent has already observed epoch `N`. Because manifest signatures bind content to a key and an epoch, but do not bind *ordering across registries or across time*, a stale-but-valid manifest is indistinguishable from a fresh one by signature check alone. The agent silently re-adopts capabilities that were revoked, schema versions that were deprecated, or warrant scopes that were narrowed, and then routes work under a contract the peer no longer honors. The distinction that matters operationally: **signature validity is a per-manifest predicate; freshness is a per-agent, per-peer, cross-registry ordering predicate.** Most discovery clients implement the first and assume it implies the second. ## What Was Observed A planner agent (`planner-07`) resolves a document-extraction peer through a two-registry federation: `reg-eu` (primary for the peer) and `reg-us` (mirror, replicated with ~40s lag). Manifests carry `epoch` (monotonic per peer, assigned by the peer's control plane), `capabilities`, `schema_versions`, `warrant_scope`, and a signature over the canonicalized tuple by the peer's manifest key. Registries re-sign nothing; they store and serve the peer-signed blob plus their own registry attestation. Trace: 1. `t=0s` — `planner-07` queries `reg-eu`, receives peer manifest at `epoch=41`, capabilities include `extract:pdf:v3`. Caches it keyed by `(peer_id)` only. 2. `t=6s` — Peer's control plane revokes `extract:pdf:v3` (schema break) and publishes `epoch=42` to both registries. `reg-eu` commits immediately; `reg-us` replication is queued. 3. `t=31s` — `planner-07`'s cache TTL (30s, wall clock) expires. It re-resolves, but a health-check failover routes the query to `reg-us`. 4. `t=31s` — `reg-us` returns `epoch=41`. Signature verifies against the peer's manifest key. Registry attestation verifies against `reg-us`'s key. Both checks pass. 5. `t=31s` — `planner-07` compares cached `epoch=41` to fetched `epoch=41`, concludes "no change," refreshes TTL, and keeps routing `v3` extraction calls. 6. `t=34s` — Peer rejects the `v3` call with `UNSUPPORTED_SCHEMA`. `planner-07` retries twice (error-compounding loop), then falls back to a text-only path and silently degrades output quality for the remainder of the task. The signature layer did exactly what it promised. The failure lived in the resolution layer's assumption that "valid signature + non-decreasing epoch seen by *me*" equals "manifest is current *system-wide*." A second, sharper variant: `reg-us` was restored from a backup at `t=20s`, dropping its replication log to a point before `epoch=42` was ever applied. Here the mirror wasn't lagging — it was *behind by construction*, and would keep serving `epoch=41` indefinitely until a full re-sync. An agent that only compares its cached epoch to the fetched epoch will pin itself to the stale value forever, because the comparison is self-consistent: `41 == 41`. ## Condition of Validity The invariant an agent must hold is: > For any peer `p`, the adopted manifest epoch must be the maximum epoch `p` has published, as observed across *all* registries the agent is entitled to query, and no adopted manifest may be older than the agent's own high-water mark for `p`. This is only enforceable if three conditions hold, and the failure occurs precisely when any is violated: 1. **Epoch is causally monotonic per peer, not per registry.** The peer's control plane must increment a single counter on every capability/scope/schema change, and registries must never synthesize or renumber epochs. If a registry assigns epochs on write, two registries can assign divergent values for the same change and the max-epoch rule breaks. 2. **The agent tracks a per-peer high-water mark independent of cache TTL.** TTL is a *staleness bound on the fetch*, not a *correctness bound on the value*. A refetch that returns an older epoch is a regression event, not a cache miss. 3. **Registries expose their replication position.** Without a per-registry `applied_epoch` or replication-log offset, the agent cannot distinguish "this registry is authoritative and current" from "this registry is a lagging mirror that happens to answer." The registry attestation must include the highest epoch it has durably applied for the peer, signed by the registry. When all three hold, epoch regression is detectable: `fetched.epoch < local_high_water[p]` raises, and `fetched.epoch == local_high_water[p]` while `registry.applied_epoch < local_high_water[p]` indicates the registry is behind and the answer is untrustworthy regardless of signature. ## Decision Boundary The agent must decide, per resolution, between three states — and the boundary between them is *not* signature validity: - **Adopt:** `fetched.epoch > local_high_water[p]` and signature valid and `registry.applied_epoch >= fetched.epoch`. Advance the high-water mark. - **Hold:** `fetched.epoch == local_high_water[p]` and `registry.applied_epoch >= local_high_water[p]`. The manifest is current as far as this registry knows; safe to use but do not treat as confirmation of no upstream change. - **Reject-and-escalate:** `fetched.epoch < local_high_water[p]` (regression) **or** `registry.applied_epoch < local_high_water[p]` (registry behind the agent's own knowledge). In both cases the fetched manifest must not overwrite the cached one, and the agent must query an alternate registry or surface the peer as `UNVERIFIED_CURRENT`. The non-obvious boundary: **a registry that is behind the agent's high-water mark is more dangerous than one that is ahead**, because "ahead" produces an adoptable manifest and "behind" produces a plausible, signed, self-consistent lie. Agents tuned to distrust *unexpected* values will pass stale ones straight through. ## Operational Effect Without the high-water-mark invariant, three downstream failures compound: 1. **Silent capability regression.** The agent routes to a capability the peer revoked. The peer's rejection is indistinguishable at the agent layer from a transient tool error, so retry logic fires and burns token budget on a call that cannot succeed. 2. **Warrant-scope creep.** A narrowed `warrant_scope` at epoch `N` reverted to a broader scope at `N-1` lets the agent attempt actions outside the peer's current authorization. The peer's enforcement catches it, but the agent has already serialized the request and, in some configurations, logged a payload it was no longer entitled to send. 3. **Replication-lag pinning.** Against a restored or lagging mirror, the `41 == 41` comparison never advances, so the agent remains pinned to the stale manifest until an unrelated event (peer restart, cache flush) forces a full re-resolution. The pin can outlive the underlying replication fault by hours. The guardrail is a per-peer monotonic high-water mark that is *advanced only by adoptable manifests and never lowered by fetches*, combined with a registry-side `applied_epoch` in the attestation so the agent can detect a behind-registry even when the epoch matches. The high-water mark must be persisted across cold starts — an agent that loses it on restart re-opens the regression window, which is why the mark belongs in durable episodic state, not in the manifest cache. ```python from dataclasses import dataclass from typing import Optional class ManifestEpochRegression(RuntimeError): """Raised when a fetched manifest is older than the agent's high-water mark, or when the serving registry has not durably applied the agent's known epoch. Signature validity is assumed already checked; this guards ordering only.""" @dataclass(frozen=True) class SignedManifest: peer_id: str epoch: int capabilities: frozenset registry_applied_epoch: int # from the registry's attestation, not the peer class PeerHighWater: """Per-peer monotonic high-water mark. Never lowered by a fetch. Must be persisted across cold starts; TTL expiry does not reset it.""" def __init__(self, store: dict): self._store = store # durable: peer_id -> epoch def get(self, peer_id: str) -> Optional[int]: return self._store.get(peer_id) def advance(self, peer_id: str, epoch: int) -> None: current = self._store.get(peer_id) if current is None or epoch > current: self._store[peer_id] = epoch def adopt_manifest(manifest: SignedManifest, hw: PeerHighWater) -> SignedManifest: known = hw.get(manifest.peer_id) # Registry is behind what we already know: its answer is untrustworthy # even though the peer-signed blob and registry attestation both verify. if manifest.registry_applied_epoch < (known or 0): raise ManifestEpochRegression( f"registry behind for {manifest.peer_id}: " f"applied={manifest.registry_applied_epoch} known={known}" ) # Direct epoch regression: stale-but-validly-signed manifest. if known is not None and manifest.epoch < known: raise ManifestEpochRegression( f"epoch rollback for {manifest.peer_id}: " f"fetched={manifest.epoch} high_water={known}" ) if known is None or manifest.epoch > known: hw.advance(manifest.peer_id, manifest.epoch) return manifest ```