# In what scenarios must an instance reconcile divergent audit-trail sequence numbers before accepting a federated capability grant **Date of Record:** 2026 November 24 **Scope:** Applies to cross-organization agent federations where a remote peer grants a capability (tool invocation, data-read warrant, or sub-delegation) and both sides maintain independent append-only audit logs that are later reconciled. Does not apply to single-org deployments with a shared log, nor to stateless one-shot RPC where no warrant is persisted past the call. ## Core Distinction The failure mode here is not "the peer lied" and not "the network dropped a message." It is **sequence-number divergence across independently-authored audit chains** when a capability grant is *negotiated* rather than *asserted*. In a policy-negotiated exchange, the grant is the product of a multi-round handshake: `offer → counter-offer → accept → warrant-issue → warrant-ack`. Each round is logged by both parties, but the two logs are not causally ordered with respect to each other — each org timestamps with its own monotonic counter and its own clock. The naive reconciliation invariant ("the grant is valid if both logs contain a record whose `warrant_id` matches") is **insufficient**, because a matching `warrant_id` can appear in two logs at incompatible positions in the handshake, proving only that *some* grant happened, not that *this* grant is the one both parties believe is active. The sharp distinction: **identity of a warrant** (does the id match?) is a different question from **position of a warrant** (does each log agree on which handshake round produced it, and was that round the terminal round?). Divergence in position is the boundary condition. It is non-obvious because `warrant_id` equality is the field every federation spec tells you to check, and it is exactly the field that passes while the invariant fails. ## What Was Observed Two orgs, `alpha` and `beta`, run a negotiation for `beta` to grant `alpha` a scoped `read:telemetry` capability. The handshake log on each side, abbreviated: ``` alpha log: seq 41 offer(read:telemetry, ttl=300) -> warrant_id W7 seq 42 recv counter-offer(ttl=120) [no warrant_id] seq 43 accept(ttl=120) -> warrant_id W7 seq 44 recv warrant-issue(W7, scope=telemetry, ttl=120) seq 45 send warrant-ack(W7) beta log: seq 88 recv offer(read:telemetry, ttl=300) -> warrant_id W7 seq 89 send counter-offer(ttl=120) seq 90 recv accept(ttl=120) -> warrant_id W7 seq 91 send warrant-issue(W7, ...) seq 92 recv warrant-ack(W7) ``` Under normal operation these reconcile: `alpha.seq44` (recv issue) precedes `alpha.seq45` (send ack), and `beta.seq91` (send issue) precedes `beta.seq92` (recv ack). The causal edge `issue → ack` is visible in both logs. The reconciliation check is: *for every warrant, the issuer's `send issue` must be the immediate predecessor of the grantee's `recv issue`, and the grantee's `send ack` must be the immediate predecessor of the issuer's `recv ack`.* The observed break: on a retried handshake after a transient timeout, `beta` re-sent `warrant-issue(W7, ttl=120)` at `beta.seq 97` (a duplicate, because the first ack was lost). `alpha` had already logged `recv issue` at `seq 44` and `send ack` at `seq 45`. The retry arrived and `alpha` logged `recv issue(W7)` again at `seq 46`, then — because its ack-sender was idempotent on `warrant_id` — did **not** log a second `send ack`. So `alpha` now has `seq 46 = recv issue` with **no following `send ack`**. The invariant "every `recv issue` is followed by a `send ack` for the same warrant" is violated at `seq 46`, even though `warrant_id` matches perfectly on both sides and the grant is, in fact, live. A reconciler that checks only `warrant_id` presence accepts this. A reconciler that checks the `issue→ack` adjacency invariant rejects it and — critically — must decide whether to *revoke the live grant* (safe, but drops a valid capability) or *repair the log* (fast, but requires trusting that the missing ack was an idempotent suppression, not a dropped authorization). This is the decision boundary. ## Condition of Validity The adjacency invariant holds if and only if **all** of the following are true: 1. **Idempotent suppression is logged as suppression, not as absence.** When a deduplicating sender suppresses a redundant ack, it must emit a `suppressed-ack(W7, reason=idempotent)` record at the position where the ack *would* have gone. Without this, absence is ambiguous between "suppressed" and "never authorized." 2. **Sequence numbers are per-warrant, not per-connection.** A global monotonic counter makes the retry at `alpha.seq 46` look like a fresh handshake round. A per-warrant sub-sequence (`W7:1`, `W7:2`) makes the retry visibly a duplicate of `W7:1`. 3. **The terminal round is marked.** The issuer must emit `warrant-issue(..., terminal=true)` only on the round it believes completes the handshake, and the grantee must echo `terminal=true` in its ack. A retried non-terminal issue is then distinguishable from a re-issued terminal one. 4. **Clock skew is bounded and declared.** Each log entry carries `(local_seq, local_clock, declared_skew_bound)`. Reconciliation may not infer causal order from wall-clock alone across orgs; it must use the declared bound to reject orderings that are physically impossible. When any of these is absent, the adjacency invariant is *unprovable* from the logs alone, and the reconciler must fall back to a conservative default (see Decision Boundary) rather than assert validity. ## Decision Boundary Given a `warrant_id` present in both logs but with a broken `issue→ack` adjacency, the reconciler chooses between three actions, and the choice is governed by one question: **is there a `suppressed-ack` or `terminal` marker that explains the gap?** - **Marker present and well-formed** → *repair*: rewrite the grantee log to insert a synthetic `ack(suppressed)` at the gap, mark the warrant `reconciled`, proceed. The grant was valid; the log was lossy. - **Marker absent, gap is a duplicate `recv issue`** → *quarantine*: the grant is live but unprovable. Downgrade the capability to `read-only-provisional`, require a fresh handshake with per-warrant sub-sequences before restoring full scope. Do **not** revoke outright — revocation on an unprovable-but-likely-valid grant causes availability loss across the federation. - **Marker absent, gap is a `recv issue` with no corresponding `send issue` on the peer** → *revoke*: this is the genuine forgery/replay signature. One side believes a warrant was issued that the other never sent. Revoke immediately and flag the peer. The boundary is sharp at the middle case: an *unprovable* grant is not the same as an *invalid* grant, and treating it as invalid is itself a failure mode (spurious revocation cascades). The reconciler must have a third state, `provisional`, distinct from `valid` and `revoked`. ## Operational Effect Without the per-warrant sub-sequence and the `suppressed-ack` marker, federations experience **spurious revocation storms** after any packet loss during handshake: a lost ack triggers a retry, the retry creates an unpaired `recv issue`, the reconciler revokes, the peer sees revocation for a grant it believes it issued, re-negotiates, loses another ack under load, and the cycle repeats. The observable symptom is a federation that works perfectly on a clean network and collapses under 0.1% loss — which is misdiagnosed as a transport bug rather than a log-invariant bug. With the invariant enforced, the operational effect is that reconciliation becomes *decidable*: every gap in the `issue→ack` chain is classified as suppressed / duplicate / forged, and the grant's state is a pure function of the two logs plus the marker set. The cost is one extra log field per handshake round and a per-warrant counter — negligible against the cost of a revocation storm. The invariant to carry forward: **`warrant_id` equality proves a grant exists; only `issue→ack` adjacency with a suppression marker proves *which* grant is active.** Reconcile on adjacency, not on identity. ```python from dataclasses import dataclass from enum import Enum class AuditReconciliationError(RuntimeError): """Raised when a federated warrant cannot be classified from the two audit logs.""" class GrantState(Enum): VALID = "valid" PROVISIONAL = "provisional" REVOKED = "revoked" @dataclass(frozen=True) class LogEntry: org: str seq: int warrant_id: str kind: str # offer | counter | accept | issue | ack | suppressed-ack terminal: bool = False sub_seq: int = 0 # per-warrant counter, NOT per-connection def reconcile_warrant(warrant_id: str, alpha: list[LogEntry], beta: list[LogEntry]) -> GrantState: a = [e for e in alpha if e.warrant_id == warrant_id] b = [e for e in beta if e.warrant_id == warrant_id] if not a or not b: raise AuditReconciliationError( f"warrant {warrant_id} missing from one log; cannot reconcile" ) # Per-warrant sub-sequence must be dense and non-repeating within each log. for side, entries in (("alpha", a), ("beta", b)): subs = sorted(e.sub_seq for e in entries) if subs != list(range(len(subs))): raise AuditReconciliationError( f"{side} log for {warrant_id} has non-dense sub_seq {subs}; " "sequence divergence is unprovable" ) issues = [e for e in a + b if e.kind == "issue"] acks = [e for e in a + b if e.kind in ("ack", "suppressed-ack")] if not issues: raise AuditReconciliationError(f"no issue record for {warrant_id}") terminal_issues = [e for e in issues if e.terminal] if len(terminal_issues) != 1: # Zero terminal issues => retried non-terminal only; >1 => re-issue ambiguity. raise AuditReconciliationError( f"{warrant_id} has {len(terminal_issues)} terminal issue records; " "expected exactly 1" ) issue_sub = terminal_issues[0].sub_seq # Every recv-issue sub_seq must be paired with an ack of the same sub_seq, # OR carry an explicit suppressed-ack marker at that position. paired = {e.sub_seq for e in acks} unpaired = [e for e in issues if e.sub_seq not in paired and e.sub_seq != issue_sub] if unpaired: # Duplicate recv-issue with no ack and no suppression marker. # Unprovable, but not forged: downgrade, do not revoke. return GrantState.PROVISIONAL # A recv-issue on one side with no send-issue on the other is the forgery signature. send_issue_orgs = {e.org for e in issues if e.kind == "issue" and e.terminal} if len(send_issue_orgs) != 1: raise AuditReconciliationError( f"{warrant_id} terminal issue claimed by {send_issue_orgs}; " "cannot determine issuer" ) if any(e.kind == "issue" and not e.terminal and e.sub_seq == issue_sub for e in issues): return GrantState.PROVISIONAL return GrantState.VALID ```