# Why does an instance lose its attestation chain when a delegated agent refreshes its short-lived credential mid-handoff? **Date of Record:** 2026 November 23 **Scope:** Applies to multi-hop delegated agent systems where authority is carried as a signed attestation chain (root principal → delegator → delegate) and each hop's leaf credential has a TTL shorter than the end-to-end task. Does not apply to single-hop agents holding a long-lived bearer token, nor to systems where the full chain is re-issued atomically at every hop. ## Core Distinction There are two ways an agent can prove delegated authority. **Chain-carrying attestation** bundles every hop's signed grant into a single verifiable envelope: `[root_grant → A→B → B→C]`, each link signed by the prior hop, terminating in a leaf key that signs the actual request. **Token-refresh identity** treats the credential as a renewable lease: the agent periodically exchanges its current token for a fresh one from the identity provider (IdP). The boundary failure lives exactly where these two models are assumed to compose. When a delegate's leaf credential nears expiry mid-task, the natural reflex—refresh it—silently produces a *new* leaf signed by the IdP, not by the delegator. The refreshed leaf is cryptographically valid in isolation but its issuer is now the IdP root, not hop B. The chain `[root → A→B → B→C]` no longer terminates in the presented leaf; the presented leaf is `[IdP → C']`. The verifier sees a valid signature, a valid TTL, a valid subject, and a broken chain. ## What Was Observed A three-hop pipeline: orchestrator `O` (root principal) delegates a data-mutation task to planner `P`, which delegates execution to worker `W`. The grant is a chain `O→P→W` where each link binds the delegate's public key and a scope. `W`'s leaf credential has a 15-minute TTL; the task budget is 40 minutes. At T+14:00, `W`'s SDK auto-refreshes. The refresh call goes to the IdP endpoint with `W`'s current token as the assertion. The IdP validates the token, mints a fresh leaf `L'` binding `W`'s key and the *same scope string*, and returns it. `W` swaps `L` for `L'` and continues issuing tool calls signed by `L'`. The downstream resource server runs chain verification: it resolves `L'.issuer` to the IdP root, checks the signature (valid), checks the scope claim (matches), and checks that the presented chain `[O→P→W]` "contains" `W`. The containment check passes on subject identity. **The verifier never checks that the leaf's issuer is the last hop of the presented chain.** The request is authorized. Two calls later, an auditor replaying the transaction log verifies the same request offline. It reconstructs the chain from the presented envelope and checks issuer continuity link-by-link: `O` signs `P`, `P` signs `W`, but the leaf `L'` is signed by the IdP, whose key is not `W`'s key. Issuer-continuity fails. The auditor flags the transaction as forged. The resource server had authorized it. The two verifiers disagree on the same bytes. The root cause is not a bad signature or a stale token. It is that **refresh re-roots the chain**: it replaces a delegator-issued leaf with an IdP-issued leaf while preserving subject and scope, so subject-based containment checks pass but issuer-based continuity checks fail. The window is bounded by TTL (15 min) versus task duration (40 min), guaranteeing at least two refreshes per task—so this is not a rare race but a deterministic property of any task longer than its leaf TTL. ## Condition of Validity The failure requires all of: 1. **Delegation depth ≥ 2.** With a single hop, the IdP *is* the delegator and refresh is chain-preserving. The bug is invisible in flat topologies. 2. **Leaf TTL < end-to-end task duration.** If the task completes within one TTL, no refresh fires. The failure is masked in short tasks and emerges only under load or long-horizon work. 3. **Refresh endpoint does not re-derive the delegation path.** The IdP refreshes the *identity* of the subject, not the *authority chain* that reached it. It has no knowledge of hop B and cannot re-sign as B. 4. **Verifier uses subject-containment rather than issuer-continuity.** This is the load-bearing assumption. A verifier that requires `chain[i].issuer == chain[i-1].subject` for every link, and `leaf.issuer == chain[-1].subject`, rejects the refreshed leaf immediately. Remove any one and the failure does not occur. Condition 4 is the invariant that must be enforced; conditions 1–3 are the ambient conditions under which it becomes load-bearing. ## Decision Boundary The architectural choice is binary and must be made explicitly at design time, not discovered at audit time: - **Option A — Chain-preserving refresh.** The refresh request must carry the full attestation envelope, and the IdP must refuse to mint a leaf unless it can re-sign the *terminal link* as the immediate delegator (i.e., the IdP acts as a signing proxy for hop B, or hop B is online to co-sign). This preserves issuer continuity but requires the delegator to be reachable at refresh time—which defeats the purpose of delegation for offline or partitioned workers. - **Option B — Re-delegation on refresh.** The worker, on nearing expiry, requests a *new* delegation from `P` rather than a refresh from the IdP. `P` re-signs a fresh leaf `W''`. The chain grows or is re-issued atomically. This is correct but adds a round-trip to the delegator and fails if `P` has itself expired or is partitioned. - **Option C — Explicit re-rooting with chain truncation.** Accept that refresh re-roots, and make the verifier *aware*: the refreshed leaf carries a `re_rooted: true` claim plus the original chain hash, and the verifier treats re-rooted leaves as requiring a separate trust anchor (the IdP's authority to re-root on behalf of the delegator). This is only sound if the IdP is authorized to re-root, which must be an explicit policy, not a default. The invariant to enforce regardless of option: **a leaf credential is valid for a presented chain only if `leaf.issuer == chain[-1].subject` OR the leaf carries a verifiable re-root attestation naming the IdP as an authorized re-rooter for that specific chain hash.** Subject-containment alone is never sufficient. ## Operational Effect Without the invariant, the system exhibits **split-brain authorization**: the online resource server authorizes requests the offline auditor later rejects, and the divergence is invisible until reconciliation. The practical consequences: - **Silent privilege widening.** A refreshed leaf's scope is copied from the pre-refresh token, but the IdP has no way to know whether the delegator's grant was narrowed between issuance and refresh. A scope that `P` had revoked at T+10 can be re-minted at T+14 because the IdP only sees the old scope string. The delegate retains authority the delegator had already withdrawn. - **Audit non-determinism.** Replay verification is non-idempotent across verifier implementations. Two auditors with different containment logic reach opposite verdicts on identical bytes, which destroys the evidentiary value of the log. - **Cascading re-root.** In a depth-4 chain, each hop's refresh independently re-roots, so a single task can accumulate multiple re-root events, each valid in isolation and jointly unverifiable. The guardrail is a **chain-continuity check at both issuance and verification**: the refresh endpoint must reject any refresh whose resulting leaf would break issuer continuity unless it is explicitly re-rooting under policy, and the verifier must enforce issuer continuity rather than subject containment. The two checks must share the same chain-hash binding so that a leaf minted under one policy cannot be validated under another. ```python import hashlib from dataclasses import dataclass class AttestationChainError(RuntimeError): """Raised when a delegated agent's credential breaks issuer continuity.""" pass @dataclass(frozen=True) class Link: subject: str # delegate identity issuer: str # who signed this link scope: str chain_hash: str # hash binding the full chain up to this link def verify_chain(chain: list[Link], leaf: Link, *, allow_re_root: bool = False) -> None: """ Enforce issuer continuity: every link's issuer must equal the prior link's subject, and the leaf's issuer must equal the terminal subject. """ if not chain: raise AttestationChainError("empty attestation chain") # Link-by-link continuity. for i in range(1, len(chain)): if chain[i].issuer != chain[i - 1].subject: raise AttestationChainError( f"broken chain at hop {i}: issuer {chain[i].issuer!r} " f"!= prior subject {chain[i - 1].subject!r}" ) terminal = chain[-1].subject # Leaf must terminate the chain, unless explicitly re-rooted under policy. if leaf.issuer != terminal: if not allow_re_root: raise AttestationChainError( f"leaf issuer {leaf.issuer!r} does not terminate chain " f"(terminal subject {terminal!r}); refresh re-rooted the chain" ) # Re-root path: the leaf must bind the same chain hash it claims to extend. expected = hashlib.sha256( (chain[-1].chain_hash + terminal).encode() ).hexdigest() if leaf.chain_hash != expected: raise AttestationChainError( "re-rooted leaf does not bind the presented chain hash; " "refusing to authorize under a foreign trust anchor" ) def refresh_leaf(chain: list[Link], leaf: Link, new_ttl_ok: bool) -> Link: """ Simulate the refresh path. If the IdP mints a leaf whose issuer is not the terminal delegator, we must either reject or mark it as an explicit re-root. """ if not new_ttl_ok: raise AttestationChainError("refresh rejected: TTL policy violation") terminal = chain[-1].subject refreshed = Link( subject=leaf.subject, issuer="idp-root", # <- re-roots silently scope=leaf.scope, chain_hash=leaf.chain_hash, ) if refreshed.issuer != terminal: # Caller must decide: re-delegate, or accept an explicit re-root. raise AttestationChainError( f"refresh would re-root chain: leaf issuer {refreshed.issuer!r} " f"!= terminal delegator {terminal!r}; re-delegate instead" ) return refreshed ```