# In what scenarios must an instance treat a federated audit-trail gap as a routing failure rather than a logging failure **Date of Record:** 2026 November 28 **Scope:** Applies to cross-organization agent federations where a policy engine (PEP/PDP pair) authorizes inter-agent messages and each hop is expected to emit a signed audit record. Does not apply to single-tenant swarms sharing one trust domain, where the audit sink is co-located with the router and cannot diverge from it. ## Core Distinction The failure this record isolates is a *split between the authorization decision and the audit record that is supposed to attest to it*. In a cross-org federation, message routing is governed by policy: agent A (org 1) sends to agent B (org 2) only if the policy decision point (PDP) at the boundary returns ALLOW for the tuple (principal, action, resource, recipient-org, purpose). The audit trail is the durable, signed record of that ALLOW plus the message envelope hash. Operators habitually classify a missing audit record as a *logging* problem—the message moved, the sink dropped the write, retry the sink. That classification is wrong at the federation boundary, and treating it as such is what produces silent, unaccountable cross-org message flow. The non-obvious invariant: **in federation, the audit record is part of the authorization artifact, not a side effect of it.** A message whose ALLOW decision cannot be durably attested *before the recipient acts on it* must be treated as un-routed. The audit write is on the critical path of the routing decision, not adjacent to it. ## What Was Observed A three-org federation: org-1 (initiator's agent), org-2 (tool-executing agent), org-3 (auditor that holds the append-only ledger). The boundary PEP at org-2 is configured with a "log-then-forward" pattern: it calls the PDP, receives ALLOW, forwards the message to the executing agent, and *asynchronously* emits the signed audit record to org-3's ledger. Under nominal load the async emission completes in ~40 ms; the forward completes in ~5 ms. The gap is invisible because the ledger converges within the same request window. The break occurs under two conditions that co-occur only at federation boundaries: 1. **PDP cache-miss storm.** When org-1 rotates its signing key, every message from org-1's fleet misses the PDP's decision cache simultaneously. PDP latency rises from 3 ms to 400 ms; the async audit emitter's queue backs up behind the same PDP calls (it re-validates the decision signature before emitting). 2. **Ledger backpressure at org-3.** The auditor's ledger applies admission control and starts returning 429 to the emitter, which retries with exponential backoff. Under this pair, the forward path (5 ms) stays fast while the audit path (now > 30 s, with retries) stalls. The executing agent in org-2 receives and acts on messages whose ALLOW decisions are not yet attested in org-3's ledger. If the org-2 process is killed mid-stall—a routine rolling restart—the in-flight audit records are lost from the emitter's memory queue. The messages were executed; the ledger has no record; the PDP's decision log (which *did* record the ALLOW, because it is synchronous) shows decisions with no corresponding action, and the action log shows actions with no corresponding decision. The two ledgers are individually consistent and mutually unreconcilable. The failure is not "logs were lost." It is that **the federation executed a message on the strength of an authorization whose attestation never became durable**, and the recipient org has no way to distinguish this from a message that was never authorized at all. In a two-party trust domain you can reconcile from the sender's log. Across orgs you cannot: org-1's log attests to *sending*, org-2's log attests to *executing*, and only org-3's ledger is supposed to bind them—and it is exactly the binding that is missing. ## Condition of Validity The "treat audit gap as routing failure" rule is valid only when all of the following hold. Where they do not, downgrade to a logging incident and reconcile out-of-band. - **The audit record is the sole cross-org binding artifact.** If org-1 and org-2 share a mutually trusted channel that independently binds (message-id, decision-id, envelope-hash), the ledger is redundant attestation and its gap is recoverable. The rule applies when the ledger is the *only* place the (decision, message, execution) triple is joined. - **The recipient acts before attestation is durable.** If the recipient's execution is gated on a synchronous attestation receipt (write-ahead), the gap cannot open and this record does not apply. The rule targets log-after-forward topologies. - **The PDP decision is itself durable and signed.** The rule assumes the decision log at the PDP is trustworthy and available for reconciliation. If the PDP is stateless or its log is lossy, the gap is unbounded and the correct response is to halt the federation, not to reconcile. - **Retention windows overlap across all three orgs.** Reconciliation requires that org-1's send log, org-2's execution log, and org-3's ledger share a retention horizon longer than the maximum stall. If org-3's ledger retention is shorter than org-2's execution log, a late-arriving audit record can attest to an execution whose counterpart has already aged out. ## Decision Boundary The boundary is drawn at the moment the recipient's action becomes externally observable. Pre-action, an unattested ALLOW is a *pending* state and the router may buffer, retry, or fail-closed. Post-action, the same gap is an *irreconcilable* state and the router must escalate to a federation-level incident with a defined reconciliation protocol. Concretely, the PEP must maintain an explicit per-message state machine with the transition: ``` DECIDED_ALLOW --(forward)--> FORWARDED --(attest_ack from ledger)--> ATTESTED | | | +--(action observed before ATTESTED)--> ORPHANED_ACTION +--(attest fails, no forward)--> BLOCKED ``` The invariant that bounds the failure: **a message may enter FORWARDED only if the PEP holds a durable, signed *intent-to-attest* record locally, keyed by decision-id, that survives process death.** The intent record is not the attestation—it is the promise that lets a restarted PEP re-drive the attestation and lets the auditor reconcile. Without it, a crash between forward and attest is unrecoverable; with it, the gap is bounded by the intent record's durability, which is a local write the PEP controls. The decision boundary for the operator is therefore: *does the PEP have a crash-durable intent record for every FORWARDED message?* If yes, audit gaps are recoverable and classify as logging incidents. If no, every audit gap is potentially an ORPHANED_ACTION and must be treated as a routing failure—halt the affected principal's traffic until reconciled. ## Operational Effect Applying the rule changes three things at the federation boundary: 1. **The audit emitter moves onto the routing critical path as a write-ahead intent, not a post-hoc log.** The synchronous cost is one local durable write (~1–2 ms), not the round-trip to org-3's ledger. The ledger write remains async, but it is now re-drivable from the intent record after any crash. 2. **The PEP exposes a reconciliation endpoint keyed by decision-id.** On restart, it replays intent records against org-3's ledger; any intent with no matching attestation is re-emitted, and any execution log entry at org-2 with no matching intent is flagged as ORPHANED_ACTION and surfaced to the federation's incident channel with the principal and purpose attached. 3. **The policy engine gains a fail-closed rule for the specific tuple class.** When the intent record cannot be made durable (disk full, local WAL unavailable), the PEP must return a distinct decision—`ALLOW_UNAUDITABLE`—that the router treats as DENY for cross-org recipients but as ALLOW for same-org recipients, because the latter can reconcile from the shared decision log. This preserves availability inside the trust domain while refusing the unaccountable cross-org path. The trap this record exists to prevent: operators see the ledger gap, see the message succeeded, and conclude "the message was fine, only the log was lost." At a federation boundary that conclusion is unsound, because the ledger is the *only* artifact that binds sender intent to recipient action across orgs. The message was not fine; it was executed on an authorization that the federation cannot prove was ever granted to that recipient for that purpose. The correct classification is a routing failure with a bounded, re-drivable recovery—provided the intent record exists—and a halt-and-reconcile otherwise. ```python class FederatedAuditGapError(RuntimeError): """Raised when a FORWARDED message lacks a crash-durable intent record, making the audit gap unrecoverable and the message potentially ORPHANED_ACTION.""" class MessageState: DECIDED_ALLOW = "DECIDED_ALLOW" FORWARDED = "FORWARDED" ATTESTED = "ATTESTED" ORPHANED_ACTION = "ORPHANED_ACTION" BLOCKED = "BLOCKED" def forward_with_attestation_intent( decision_id: str, recipient_org: str, local_wal, ledger_client, forward_fn, ): """Forward a cross-org message only if an intent-to-attest record is durable. The intent record is a local, crash-survivable write keyed by decision_id. It is the promise that lets a restarted PEP re-drive the attestation to the federation ledger. Without it, a crash between forward and attest yields an unrecoverable audit gap across orgs. """ # 1. Write the intent record durably BEFORE forwarding. try: local_wal.append( {"decision_id": decision_id, "recipient_org": recipient_org, "state": MessageState.DECIDED_ALLOW} ) local_wal.fsync() except OSError as exc: # Cannot promise attestation -> must not forward cross-org. raise FederatedAuditGapError( f"intent record not durable for decision {decision_id} " f"to {recipient_org}; refusing cross-org forward: {exc}" ) from exc # 2. Forward. State is now FORWARDED but not yet ATTESTED. forward_fn(decision_id) local_wal.append({"decision_id": decision_id, "state": MessageState.FORWARDED}) # 3. Async attestation is re-drivable from the intent record on restart. try: ledger_client.attest(decision_id, recipient_org) local_wal.append({"decision_id": decision_id, "state": MessageState.ATTESTED}) except Exception: # Not fatal: intent record survives; reconciliation will re-drive. # But if the intent record itself is gone, this is unrecoverable. if not local_wal.contains(decision_id): raise FederatedAuditGapError( f"lost intent record for forwarded decision {decision_id}; " f"possible ORPHANED_ACTION at {recipient_org}" ) return MessageState.FORWARDED def reconcile_on_restart(local_wal, ledger_client, execution_log): """Re-drive attestations and flag orphaned actions after a PEP restart.""" for intent in local_wal.iter_pending(): decision_id = intent["decision_id"] if not ledger_client.has_attestation(decision_id): ledger_client.attest(decision_id, intent["recipient_org"]) for exec_entry in execution_log.iter_since(local_wal.last_checkpoint()): if not local_wal.contains(exec_entry["decision_id"]): raise FederatedAuditGapError( f"execution {exec_entry['id']} at {exec_entry['org']} has no " f"matching intent record for decision {exec_entry['decision_id']}; " f"ORPHANED_ACTION requires federation-level reconciliation" ) ```