# What happens when an instance's AAIF credential rotates mid-trace: span-to-identity correlation loss across delegation chains **Date of Record:** 2026 December 3 **Scope:** Applies to multi-agent systems where spans (OpenTelemetry-style trace events) are attributed to an Agent-to-Agent Identity Framework (AAIF) credential and its delegation chain, and where that credential can rotate, expire, or be re-issued during the lifetime of a trace. Does not apply to single-agent, single-credential-immutable traces, nor to systems that bind spans to immutable workload identity rather than to short-lived bearer credentials. ## Core Distinction Observability systems are built on the assumption that the *subject* of a span is stable for the duration of the trace. Distributed tracing encodes this as a `trace_id` plus a set of `span_id`/`parent_span_id` links: the identity of the emitting process is treated as an attribute, not as part of the causal structure. AAIF delegation chains break that assumption. A delegated agent does not merely *have* a credential; its authority to act is a *property of a signed chain* (root warrant → intermediate delegations → leaf credential). When the leaf credential rotates mid-trace — because the token TTL expired, because the orchestrator re-delegated after a scope change, or because a peer auditor demanded re-attestation — the spans emitted before and after rotation are causally continuous but *identity-discontinuous*. The trace graph still connects them (same `trace_id`, valid parent links), but the delegation chain that justifies each span no longer forms a single connected path. The distinction that matters operationally: **correlation is not linkage.** A span can be perfectly linked into the trace DAG while being uncorrelatable to the authority under which it executed, because the credential reference it carries points to a warrant that has since been superseded and whose verification material (signing key, chain head) is no longer resolvable from the leaf. ## What Was Observed A three-agent pipeline — orchestrator `O`, worker `W`, auditor `A` — executed a 40-second task. `O` held a root AAIF warrant `R` (TTL 300s), delegated a scoped warrant `D1` to `W` (TTL 60s, scopes `{read:kb, write:draft}`), and `W` emitted 212 spans across the task. At t=61s, `D1` expired. `W` re-attested against `O` and received `D2` (same scopes, new `credential_id`, new signing key epoch). `W` continued emitting spans under the same `trace_id`, stamping each span with `aaif.credential_id` and `aaif.chain_digest`. The failure surfaced during audit replay. The auditor `A` attempted to reconstruct, for each span, the full chain `R → D_x` and verify the signature at each hop. Three distinct breakages appeared: 1. **Split-chain trace.** Spans 1–118 carried `D1`; spans 119–212 carried `D2`. The chain digest changed at the rotation boundary. A per-span verification pass succeeded for every span individually, but a *trace-level* verification that required a single chain digest across all spans in the trace failed — 118 spans were reported as "orphaned authority" even though none had actually executed without authority. 2. **Superseded-warrant dereference failure.** `D1`'s verification material was garbage-collected at t=90s (30s after expiry, per the AAIF key-retention policy). Spans 1–118 referenced a `credential_id` that no longer resolved. Their signatures were valid at emission time but unverifiable at replay time. The auditor could not distinguish "authority was valid when the span was emitted" from "authority was forged." 3. **Delegation-scope drift under re-issue.** `D2` was minted with the same nominal scopes but a different `scope_hash` because the orchestrator's policy engine had, in the intervening 60s, tightened the `write:draft` scope to require an additional `draft:namespace` qualifier. Spans 119–212 that wrote to the draft namespace were *authorized under `D2`* but would have been *out of scope under `D1`*. The trace, read left-to-right, appeared to show `W` performing an action it was never authorized to perform — a false-positive privilege-escalation signal. The net operational effect: the audit replay produced 118 orphaned spans, 1 false privilege-escalation alert, and a 40-minute manual investigation. The task itself never failed. No unauthorized action occurred. The observability layer lied. ## Condition of Validity The invariant that must hold for span-to-identity correlation to be sound is: > For every span `s` in trace `T`, there exists a chain `C_s = R → … → leaf_s` such that (a) `leaf_s` is the credential under which `s` executed, (b) every hop in `C_s` is verifiable against material retained for at least the trace's retention horizon, and (c) the scope set at every hop in `C_s` is a superset of the action recorded in `s`. This invariant is *not* preserved by the naive design where spans carry a `credential_id` pointer and the credential store garbage-collects expired credentials on a TTL shorter than the trace retention horizon. It is also not preserved when rotation is treated as an out-of-band event: the trace graph has no edge marking "rotation happened here," so the discontinuity is invisible to any consumer that walks parent links. The invariant holds only under two additional conditions: - **Chain material retention ≥ trace retention.** Signing keys and chain heads for every credential referenced by any span must be retained for at least as long as the span. This is a storage-cost decision, and it is the one most frequently violated because the credential store and the trace store are owned by different teams with different retention defaults. - **Rotation is a first-class trace event.** A credential rotation that affects an in-flight trace must emit a synthetic span (or a span attribute on the first post-rotation span) recording `previous_credential_id`, `new_credential_id`, `rotation_reason`, and a signed `continuity_attestation` from the delegating agent asserting that the new chain is a valid successor of the old one under the same root warrant. Absent the second condition, a trace-level verifier cannot distinguish a legitimate rotation from a chain-splice attack in which a compromised agent presents a forged successor credential and continues the trace. Absent the first, replay is impossible even for legitimate traces. ## Decision Boundary The decision boundary is *whether to treat the trace as a single identity-continuous unit or as a sequence of identity-segments*. Three regimes: - **Immutable-credential traces (TTL > trace duration, no rotation).** Treat the trace as identity-continuous. A single chain digest per trace is a valid invariant. This is the common case and the one most tracing backends assume. - **Rotating-credential traces with continuity attestation.** Treat the trace as a sequence of identity-segments joined by signed rotation spans. Per-segment chain verification plus rotation-span verification reconstructs the full chain. This is the regime the AAIF must support explicitly; it is where most implementations are silently wrong. - **Rotating-credential traces without retention or attestation.** Do not attempt trace-level identity verification. Downgrade to per-span verification with an explicit `identity_continuity: unverified` marker. Emitting a *pass* here is the dangerous failure; emitting an explicit *unknown* is correct. The boundary between regime 2 and regime 3 is the one that must be enforced architecturally, not by convention. The failure mode observed above is precisely a system that silently operated in regime 3 while its verifier assumed regime 1. ## Operational Effect The practical consequences of getting this wrong are asymmetric. The task path is unaffected: agents execute, tools return, the pipeline completes. The damage is entirely in the audit and incident-response path, where it is most expensive: - **False-positive privilege escalation.** Scope-hash drift across re-issue produces alerts that consume on-call time and, worse, train operators to suppress them — which is how a real escalation later goes unnoticed. - **Unverifiable-but-valid spans.** Garbage-collected credential material turns legitimate historical spans into permanent audit debt. There is no recovery; the material is gone. - **Chain-splice blindness.** Without rotation spans carrying continuity attestations, a forged successor credential is indistinguishable from a legitimate rotation. The trace graph's parent links provide *causal* continuity but not *authority* continuity, and conflating the two is the root defect. The guardrail is a hard invariant enforced at span-emission time: an agent MUST refuse to emit a span whose `aaif.credential_id` differs from the previous span's in the same trace without also emitting a `credential.rotation` span carrying a `continuity_attestation` signed by the delegating agent. A verifier encountering a chain discontinuity without an attestation MUST fail closed — mark the trace `identity_continuity: broken` and refuse to certify — rather than pass per-span verification and report success. ```python from dataclasses import dataclass, field from typing import Optional class IdentityContinuityError(RuntimeError): """Raised when a trace's delegation chain is discontinuous without a signed continuity attestation, or when required chain material has been garbage-collected before the trace retention horizon.""" pass @dataclass class Span: span_id: str trace_id: str credential_id: str chain_digest: str scope_hash: str rotation_attestation: Optional[str] = None # signed by delegator, if rotation span is_rotation_span: bool = False @dataclass class TraceVerifier: trace_retention_s: int credential_retention_s: int resolvable_credentials: set = field(default_factory=set) def verify_trace(self, spans: list) -> str: if self.credential_retention_s < self.trace_retention_s: raise IdentityContinuityError( f"credential retention ({self.credential_retention_s}s) is shorter " f"than trace retention ({self.trace_retention_s}s); replay of " f"rotated credentials is unsound" ) ordered = sorted(spans, key=lambda s: s.span_id) prev: Optional[Span] = None for span in ordered: if span.credential_id not in self.resolvable_credentials: raise IdentityContinuityError( f"span {span.span_id} references credential " f"{span.credential_id} whose chain material is unresolvable" ) if prev is not None and span.credential_id != prev.credential_id: if not span.is_rotation_span or not span.rotation_attestation: raise IdentityContinuityError( f"identity discontinuity between {prev.span_id} " f"({prev.credential_id}) and {span.span_id} " f"({span.credential_id}) with no continuity attestation; " f"possible chain-splice" ) if prev is not None and span.scope_hash != prev.scope_hash: # scope drift across rotation is legal only if attested if not (span.is_rotation_span and span.rotation_attestation): raise IdentityContinuityError( f"scope_hash drift without attested rotation at {span.span_id}" ) prev = span return "identity_continuity: verified" def certify(trace: list, verifier: TraceVerifier) -> str: try: return verifier.verify_trace(trace) except IdentityContinuityError: # Fail closed: never emit a pass for an unverifiable trace. raise IdentityContinuityError( "trace cannot be certified; downgrade to per-span verification " "with identity_continuity: broken" ) ```