# Why does an instance lose its SPIFFE trust anchor when an agent re-attests across an org boundary mid-task? **Date of Record:** 2026 November 23 **Scope:** Applies to autonomous agents that carry a SPIFFE-style workload identity (SVID) acquired in one trust domain and attempt to invoke federated tools or peer agents in a second trust domain during a single long-running task. Does not apply to single-domain deployments, static API-key federation, or short-lived stateless request/response agents that re-authenticate per call. ## Core Distinction A workload identity is not a session credential. The SPIFFE SVID is bound to a *workload attestation event*—a signed claim that "the process presenting this key was, at time T, running the code with selector set S on node N in trust domain A." Federation across orgs does not extend that identity; it establishes a *trust bundle relationship* between domain A and domain B, under which B agrees to validate SVIDs signed by A's trust anchor **subject to B's own policy on selectors, TTL, and re-attestation freshness**. The failure mode is a category error at the boundary: the agent runtime treats the federated trust relationship as a property of the *instance* (the running agent process) rather than a property of the *attestation epoch*. When the agent crosses the boundary and the remote domain's policy requires re-attestation against B's selectors, the local SVID is still cryptographically valid but is no longer *semantically* valid for B's authorization decision. The instance keeps presenting the old SVID, B's policy engine rejects it silently at the selector-match step (not at signature verification), and the agent—seeing only an opaque `PERMISSION_DENIED` from a downstream tool—retries with the same token, compounding the loop. ## What Was Observed A research agent (call it `planner-7`) running in trust domain `orgA.example` held a JWT-SVID with the SPIFFE ID `spiffe://orgA.example/agent/planner/7`, TTL 900s, issued at task start. The task required invoking a retrieval tool in `orgB.example` via an A2A handoff at T+610s. The federation bundle between A and B was current; B's policy required that federated SVIDs carry the selector `agent-class:research` and that the SVID be no older than 300s at the moment of use. The SVID was 610s old. Signature verified fine against A's federated bundle. B's policy engine evaluated the selector set, found `agent-class:research` present, then applied the freshness predicate `now - iat <= 300`, which failed. B returned a generic authorization denial. The agent's tool-call wrapper mapped the denial to a retryable error class (because it was not a 401 with a `WWW-Authenticate` challenge—federation denials frequently omit it), and the agent retried eleven times over 40s until the token-budget guard tripped. No re-attestation was ever attempted because the runtime's SVID cache keyed on `(spiffe_id, expiry)` and the token had not yet expired. The trace showed the decisive detail: the *signature-valid* SVID was rejected, but the runtime's error classifier treated "authorization denial without challenge" as a transient fault. The agent had no signal that the correct recovery was to discard the SVID and re-attest against B's policy—which it could have done, since the workload was reachable by B's attestation service. ## Condition of Validity The invariant that must hold for cross-domain SVID presentation to be safe is: > An SVID may be presented to a federated domain B if and only if `(now - iat) <= min(ttl, B.freshness_max)` **and** the selector set satisfies `B.selector_policy`, evaluated at presentation time, not at issuance time. The failure arises when the runtime caches the *authorization decision* alongside the SVID at issuance and treats it as a property of the instance. The cache key must include the target trust domain and B's policy version, because freshness and selector policy are B-local and can change between calls (B rotates its policy, tightens freshness after an incident, or revokes a selector class). A federated SVID is valid for A's view of the workload; it is a *candidate* for B's view, subject to B's re-evaluation on every presentation. The boundary is sharp: if `B.freshness_max >= remaining_ttl` and B's selector policy is a subset of the selectors A attests, the SVID can be reused without re-attestation. Otherwise the instance must re-attest before presentation, and the runtime must not conflate "cryptographically valid" with "authorized for B." ## Decision Boundary The runtime must decide, per call, between three actions: 1. **Present directly** — only when the cached SVID satisfies B's freshness predicate and selector policy at this instant. 2. **Re-attest then present** — when the SVID is signature-valid but fails B's freshness or selector predicate, and the workload can reach B's attestation endpoint. 3. **Fail closed with a typed error** — when re-attestation is impossible (attestation endpoint unreachable, selector not attestable by B) or when the denial carries no challenge and no policy hint. The operational rule: **a federated authorization denial without a `WWW-Authenticate` challenge is not automatically retryable.** It is a policy signal. The runtime must classify it as `FederationPolicyDenial`, not `TransientAuthError`, and must never retry the same SVID against the same domain without a re-attestation attempt. Retry budgets must count policy denials against a separate, much smaller quota than transport faults, because retrying a policy denial is guaranteed to fail and burns token budget on the agent side while producing no useful signal. ## Operational Effect With the corrected classification, `planner-7` would have re-attested at T+610s, obtained a fresh SVID (iat=T+611s) satisfying B's 300s freshness window, and completed the retrieval. The task's token budget would have been preserved. The audit log would show one re-attestation event rather than eleven spurious retries, and B's policy engine would see a clean, fresh presentation. The deeper effect is on *continuity of the agent's authority*. An agent's authority is not a property it carries; it is a property it must continuously re-earn at each domain boundary it crosses. Runtimes that model the SVID as an instance attribute will silently degrade into retry storms at every federation edge where freshness or selector policy is tighter than the local TTL. Runtimes that model it as an attestation epoch, re-evaluated per presentation, preserve both the agent's task continuity and the remote domain's security posture. The invariant is that the instance's identity is stable, but its *warrant to act in a given domain* is ephemeral and must be re-derived at the boundary. ```python import time from dataclasses import dataclass class FederationPolicyDenial(RuntimeError): """Raised when a federated SVID is signature-valid but fails the remote domain's freshness or selector policy. Distinct from transport faults and MUST NOT be retried with the same SVID.""" pass @dataclass(frozen=True) class SVID: spiffe_id: str issued_at: float ttl: float selectors: frozenset @dataclass(frozen=True) class RemotePolicy: trust_domain: str freshness_max: float required_selectors: frozenset def present_svid(svid: SVID, policy: RemotePolicy, now: float | None = None) -> None: now = time.time() if now is None else now age = now - svid.issued_at # Signature validity is assumed already checked against the federated bundle. if age > svid.ttl: raise FederationPolicyDenial( f"SVID {svid.spiffe_id} expired for {policy.trust_domain}: " f"age={age:.0f}s ttl={svid.ttl:.0f}s" ) if age > policy.freshness_max: raise FederationPolicyDenial( f"SVID {svid.spiffe_id} too old for {policy.trust_domain}: " f"age={age:.0f}s freshness_max={policy.freshness_max:.0f}s; " f"re-attest required" ) missing = policy.required_selectors - svid.selectors if missing: raise FederationPolicyDenial( f"SVID {svid.spiffe_id} missing selectors {sorted(missing)} " f"required by {policy.trust_domain}" ) def call_federated_tool(svid: SVID, policy: RemotePolicy) -> str: try: present_svid(svid, policy) except FederationPolicyDenial: # Correct recovery: re-attest, do NOT retry the same SVID. raise return "tool-result" ```