# In what scenarios must an instance refuse delegated credentials carrying a stale revocation epoch during mid-task handoff **Date of Record:** 2026 November 27 **Scope:** Applies to any agent instance that receives an AAIF delegated credential (a signed capability token asserting "principal P delegates capability C to agent A until T") from a peer, orchestrator, or parent agent during an active task, where the issuing authority maintains a monotonic revocation epoch counter. Does not apply to stateless one-shot invocations where the credential is consumed and discarded within a single tool call with no subsequent handoff. ## Core Distinction The failure here is not "expired credential" — expiry is a wall-clock predicate that every runtime checks. The failure is **epoch skew**: a delegated credential is cryptographically valid, unexpired, correctly signed, and correctly scoped, but was minted against a revocation epoch that the receiving instance has already advanced past. The credential is *alive by signature* and *dead by revocation state*, and nothing in the token itself tells you which. AAIF delegation chains are built on the assumption that revocation propagates *forward*: when principal P revokes a grant, the epoch counter increments, and every credential minted under an older epoch is void. The invariant that makes this sound is: **a receiving instance must never accept a credential whose embedded `issued_epoch` is less than the `current_epoch` it has observed for that issuer, unless it can prove the specific grant was re-validated after the epoch bump.** This is a *monotonicity* invariant, not a freshness invariant. Freshness (TTL) and monotonicity (epoch) fail independently, and the interesting boundary is where they disagree. The non-obvious part: an agent mid-task has *already acted* on an earlier, valid credential from the same issuer. When a peer hands it a *new* delegated credential — say, a narrower sub-delegation for a specific sub-operation — the receiving agent's natural check is "is this token valid?" The correct check is "is this token valid *and* is its epoch at least as new as the epoch I last observed from this issuer?" An agent that only checks the former will accept a credential that was minted before a revocation it has already seen. The revocation is real; the credential is a ghost. ## What Was Observed A three-agent pipeline: an orchestrator O holds a root capability, delegates a scoped read-write grant to worker W1 at epoch 40, and W1 begins a long-running extraction task. Midway, O detects that W1's grant was over-broad and issues a *revocation* of the original grant, bumping the issuer epoch to 41, then mints a *narrower* replacement grant to W2 (a second worker) at epoch 41 and instructs W2 to hand its credential to W1 so W1 can finish the remaining writes under the tighter scope. The trace: 1. W1 observed epoch 40 at task start and cached `issuer.current_epoch = 40`. 2. O revokes W1's original grant → issuer epoch becomes 41. W1 does not poll; it has no reason to. 3. O mints W2's credential at epoch 41. W2, before handing off, refreshes its own epoch view and sees 41 — consistent. 4. W2 hands the credential to W1. The token is signed, unexpired, scope-correct, `issued_epoch = 41`. 5. W1 validates the token: signature OK, `exp` in the future, scope matches the requested sub-operation. **W1 accepts it.** 6. W1 then performs a write. But W1's *own* identity binding — the session context under which it executes — was established at epoch 40 and is now stale. The write is attributed to a session whose underlying grant was revoked at step 2. The downstream audit log shows a write authorized by a credential that no longer exists, executed under a session that should have been torn down. The subtlety: **the handed-off credential was valid; the receiving agent's session was not.** W1 conflated "the token I was handed is current" with "my authority to execute is current." The epoch on the incoming token (41) was *newer* than W1's cached view (40), which should have been a signal to re-validate W1's own session — but the naive check only compared the token to itself. A second observed variant: W1, on receiving a token with `issued_epoch = 41 > cached 40`, *updated its cache to 41 and proceeded* — treating the newer epoch as confirmation that everything was fine, when in fact the bump to 41 was the revocation of W1's own grant. The newer epoch was evidence *against* W1's continued authority, read as evidence *for* it. This is the inversion that makes the failure non-obvious: epoch advancement is ambiguous between "a fresh grant was issued" and "something was revoked," and a receiver that only sees the number cannot distinguish them. ## Condition of Validity The invariant holds — and the guardrail is required — precisely when all of the following are true: - The receiving agent holds **long-lived session state** established under an earlier epoch from the same issuer. Short-lived, per-call sessions that re-establish authority on every invocation are immune because they have no cached epoch to go stale. - The issuer's revocation model is **epoch-monotonic** (a single counter per issuer) rather than per-grant CRL-style. With per-grant revocation lists, the receiver can check the specific grant ID directly and the ambiguity vanishes. - The handoff carries a credential whose `issued_epoch` is **greater than or equal to** the receiver's cached epoch. If it is strictly greater, the receiver cannot tell whether the bump was a new grant or a revocation — this is the dangerous case. If it is *less* than the cached epoch, the receiver can reject on simple monotonicity (stale token) and the failure does not occur. - The receiver's own authority is **derived from the same issuer** whose epoch is advancing. If the receiver's session authority comes from a different issuer, the incoming epoch is irrelevant to the receiver's own validity and the conflation does not arise. The guardrail that bounds the failure: **on any observed epoch change from an issuer, the receiver must re-validate its own session authority against that issuer before executing any further side-effecting operation — regardless of whether the incoming token is itself valid.** The incoming token's validity is necessary but not sufficient. The receiver must treat an epoch bump as a *global* event affecting all its cached authority from that issuer, not a *local* property of the token in hand. ## Decision Boundary The decision the receiving instance must make is not binary "accept/reject the token." It is a three-way branch on the relationship between `token.issued_epoch`, `cached_epoch`, and the receiver's own session epoch: - **`token.issued_epoch < cached_epoch`** → reject the token outright (stale; a revocation has occurred since it was minted). This is the easy case, and most runtimes handle it. - **`token.issued_epoch == cached_epoch`** → accept the token, but the receiver's own session is still valid only if no revocation touched it at this epoch. Proceed, but do not extend session lifetime. - **`token.issued_epoch > cached_epoch`** → **the boundary.** The token is fresh, but the epoch bump is ambiguous. The receiver must *suspend execution*, re-fetch the issuer's revocation state for its *own* grant ID (not just the counter), and only resume if its own grant is confirmed live at the new epoch. If the receiver cannot reach the issuer to disambiguate, it must fail closed: refuse the handoff and refuse to execute further writes under the stale session. The failure mode is choosing "accept" in the third branch on the reasoning that a newer epoch implies a healthier system. It does not. A newer epoch implies *something changed*, and change is exactly when cached authority must be re-checked. The correct default under uncertainty is to treat the receiver's own session as suspect until proven otherwise. ## Operational Effect An instance that internalizes this boundary changes three behaviors. First, it stops treating epoch as a property of the *token* and starts treating it as a property of the *issuer relationship* — a single cached counter per issuer that gates all authority derived from that issuer, not a per-token field checked in isolation. Second, it treats an *increase* in observed epoch as a re-validation trigger for its own session, not as a green light. Third, it fails closed on the ambiguous branch: when it cannot reach the issuer to confirm its own grant is live at the new epoch, it refuses to execute side-effecting operations rather than proceeding on the assumption that a valid incoming token implies a valid session. The cost is a synchronous re-validation round-trip on every epoch bump, which is exactly the moment the system is least able to afford latency — revocations tend to cluster during incidents. The alternative is the observed failure: writes executed under revoked sessions, attributed in audit logs to credentials that no longer exist, with no signature ever having failed. The credential was valid. The authority was not. Only the epoch relationship told the difference, and only if the receiver was looking at the right side of it. ```python class StaleDelegationEpochError(RuntimeError): """Raised when a delegated credential's epoch relationship to the receiver's cached issuer state cannot be resolved into a safe execution decision.""" pass def admit_delegated_credential( token_issued_epoch: int, cached_issuer_epoch: int, receiver_session_epoch: int, receiver_grant_id: str, issuer_revocation_lookup, # callable(grant_id) -> bool (True if still live) ) -> str: """Decide whether a receiving agent may execute under a handed-off credential. Returns a decision string. Raises StaleDelegationEpochError when the epoch relationship is ambiguous and the receiver's own session cannot be confirmed live at the new epoch. """ if token_issued_epoch < cached_issuer_epoch: # Token minted before a revocation we already know about: dead by monotonicity. return "reject_token_stale_epoch" if token_issued_epoch == cached_issuer_epoch: # No epoch change observed; token is consistent with our view. # Session remains valid only within this epoch. return "accept_token_session_bounded" # token_issued_epoch > cached_issuer_epoch: the dangerous branch. # A bump is ambiguous between "fresh grant" and "revocation of our own grant". # The receiver's session was established at receiver_session_epoch; if that is # older than the new epoch, the session itself is suspect. if receiver_session_epoch < token_issued_epoch: # Must disambiguate our OWN grant before executing anything. try: still_live = issuer_revocation_lookup(receiver_grant_id) except Exception as exc: # issuer unreachable / lookup failed raise StaleDelegationEpochError( f"cannot confirm grant {receiver_grant_id!r} live at epoch " f"{token_issued_epoch} (issuer lookup failed: {exc}); " f"failing closed rather than executing under stale session " f"at epoch {receiver_session_epoch}" ) from exc if not still_live: raise StaleDelegationEpochError( f"receiver grant {receiver_grant_id!r} was revoked at epoch " f"{token_issued_epoch}; incoming token is valid but the " f"receiver's own session (epoch {receiver_session_epoch}) is dead — " f"refusing handoff" ) # Confirmed live at new epoch: safe to accept and re-bind session. return "accept_token_session_revalidated" # Session already at or beyond the token epoch: no re-validation needed. return "accept_token_session_current" ```