# Under what conditions must an instance reject a re-issued A2A task that arrives with a higher `revision` but a lower `task_epoch`, and why vendor-card caching makes this the default failure **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 task-lifecycle negotiation between agents of different vendors where the caller's cached `AgentCard` and the responder's live card disagree on capability or state semantics across a task re-issue. Does not apply to single-vendor, single-card deployments, nor to stateless one-shot `message/send` calls that never re-use a `taskId`. ## Core Distinction The distinction that matters is between **monotonic task revision** and **monotonic task epoch**. A2A v1.0 exposes `Task.status` transitions and, in practice, vendors layer their own `revision` counter onto `Task` to signal "this is a newer view of the same task." Operators assume both counters are monotonic in the same direction and that "higher revision wins." That assumption is false across vendor boundaries. `revision` is a *per-task, per-writer* counter — it increments every time the writer mutates the task object it holds. `task_epoch` (where present, and it is present in the hardened profiles that matter) is a *per-(taskId, writer-identity)* generation counter that resets or jumps when the task's owning agent is replaced — e.g. after a vendor redeploys the worker, after a context-window checkpoint/resume that spawns a fresh instance, or after a failover to a standby that re-hydrates the task from episodic memory. A re-issued task can therefore carry `revision=17` while `task_epoch=2` when the previous holder of `taskId` had reached `revision=12, task_epoch=5` before being evicted. The non-obvious boundary: **revision is a lower bound on freshness only within a single epoch.** Across an epoch boundary, revision is meaningless as an ordering key, and treating it as one is how an agent silently accepts a *stale* task state that looks newer. ## What Was Observed A two-vendor pipeline: Vendor A (planner) issues `tasks/send` to Vendor B (executor) with a `taskId`. B acknowledges, begins a multi-step tool loop, and mid-execution its worker is drained for a rolling deploy. B's standby re-hydrates the task from a checkpoint taken at step 3 of 9. The standby's local `revision` counter is reconstructed from the checkpoint and continues from `revision=12`; but because the standby is a new instance identity, it sets `task_epoch=2` (the epoch counter is per-instance and increments on re-hydration). Meanwhile A, having received no `TaskStatusUpdateEvent` for 40s (the standby's event stream had not yet reattached to A's webhook), re-issues the task with its own view: A's copy says `revision=13, task_epoch=5` because A had been tracking B's pre-drain epoch. The standby receives A's re-issue. Its conflict-resolution rule — the one shipped in the vendor's A2A adapter — is "accept if incoming `revision` > local `revision`." `13 > 12`, so the standby **overwrites its checkpointed state with A's copy**. A's copy is the pre-drain view: it reflects the task at step 3, before B's steps 4–6 side effects (three tool calls that had already mutated external state). The standby resumes from step 3, replays steps 4–6, and the three external mutations execute twice. The duplicate is not idempotent (one of the tools was a `send_email`). The task completes "successfully" with `revision=16`, and A marks it done. No error was raised. No invariant was violated according to either vendor's card. The card each vendor published said the other could negotiate the task. ## Condition of Validity The "higher revision wins" rule is valid **iff** the incoming and local task views share the same `task_epoch` **and** the same writer identity. Formally, an agent may apply a re-issued task over its local copy only when: ``` incoming.taskId == local.taskId incoming.task_epoch == local.task_epoch incoming.writer_id == local.writer_id and incoming.revision > local.revision ``` When `task_epoch` differs, the re-issue is not a *newer view of the same task* — it is a *competing claim to ownership of the task*, and the resolution is not "pick the higher counter." It is a **handoff negotiation**: the receiving agent must either (a) reject with `TaskRejected` carrying `reason: epoch_mismatch` and its own `(epoch, revision, writer_id)` triple, forcing the issuer to reconcile, or (b) accept only if its own card declares `task_epoch_authoritative: true` and it can prove it is the canonical holder for that epoch (e.g. via a signed epoch-warrant from the previous holder). The condition of validity for the *reject* path is that the receiving agent can detect the epoch mismatch at all. That detection requires the `task_epoch` to survive transport — and it is precisely here that vendor-card caching breaks the invariant, because the field is **optional in the base schema** and is only guaranteed present if the issuer read a card whose `capabilities.taskLifecycle.epochs` flag is `true`. A cached card from before the responder's hardening upgrade reports `epochs: false`; the issuer then omits `task_epoch`, and the responder — now running the hardened profile — receives a re-issue with no epoch field and must fall back to revision-only comparison. The hardening is defeated by the cache, not by the wire. ## Decision Boundary The boundary is a single predicate the receiving agent must evaluate **before** any state merge: > If `incoming.task_epoch` is absent **or** differs from `local.task_epoch`, the re-issue is not mergeable by revision ordering. It is a competing ownership claim. Two failure modes flank this boundary and both are silent: - **Below the boundary (epoch absent):** the agent falls back to revision-only and can overwrite its own newer state with a stale re-issue. This is the observed incident. - **Above the boundary (epoch present but the agent trusts a cached card that says `epochs: false`):** the agent *skips* the epoch check because its card cache told it the peer doesn't use epochs, even though the peer's live card does. The cache is the attacker. The guardrail is therefore not "compare epochs" — it is **"never trust a cached card's capability flags to decide whether to run a safety check."** Card discovery hardening must treat capability flags as *hints for optimistic paths*, never as *permissions to skip validation*. Concretely: the epoch check runs unconditionally; a cached `epochs: false` only suppresses the *warrant-verification* sub-step, never the *mismatch-detection* sub-step. If the field is absent, the agent treats it as `epoch = unknown`, and `unknown` must be treated as `mismatch` for any task that has already produced side effects (i.e. `local.revision > 0` and `local.status ∈ {working, input-required}`). Additionally, the responder's card must be re-fetched (or its `etag`/`card_version` revalidated) on any `TaskRejected` or `epoch_mismatch` path, because the mismatch itself is evidence the cache is stale. A card cache that is not invalidated by a protocol-level rejection is a cache that will keep producing the same rejection. ## Operational Effect With the unconditional epoch check and cache-invalidation-on-reject in place, the incident class collapses: the standby rejects A's re-issue with `epoch_mismatch`, A re-fetches B's card (now `epochs: true`, `card_version` bumped by the deploy), sees the epoch jump, and reconciles by querying B's task state rather than pushing its own. The three duplicate side effects never fire, because the replay never happens — B's standby keeps its checkpoint and resumes from step 4 (the checkpoint was at step 3, and the last durable step recorded was 3; the standby's own recovery, not A's re-issue, drives the resume). The cost is one extra round-trip on the reject path and a card re-fetch per rejection. The benefit is that the *stale-card-skip* failure mode — the one that looks like success and corrupts external state — becomes structurally impossible, because the safety check no longer depends on a value the agent might have cached wrong. The residual risk is a responder that genuinely never sets `task_epoch` (a vendor that has not adopted the hardened profile). For those peers, the receiving agent must fall back to a **side-effect-aware** revision rule: it may merge by revision only if `local.revision == 0` (no side effects yet) or the incoming `writer_id` matches its own. Otherwise it rejects and forces a state query. This is stricter than the base spec and will cause visible rejections against un-hardened peers — which is the correct outcome, because the alternative is silent duplicate execution. ```python from __future__ import annotations from dataclasses import dataclass from typing import Optional class EpochMismatchError(RuntimeError): """Raised when a re-issued A2A task cannot be merged by revision ordering.""" def __init__(self, task_id: str, incoming_epoch: Optional[int], local_epoch: Optional[int], incoming_rev: int, local_rev: int): self.task_id = task_id self.incoming_epoch = incoming_epoch self.local_epoch = local_epoch self.incoming_rev = incoming_rev self.local_rev = local_rev super().__init__( f"task {task_id}: incoming epoch={incoming_epoch} rev={incoming_rev} " f"vs local epoch={local_epoch} rev={local_rev} — not mergeable by revision" ) @dataclass class TaskView: task_id: str revision: int task_epoch: Optional[int] # None == unknown / absent on the wire writer_id: str status: str # "submitted" | "working" | "input-required" | "completed" side_effects_emitted: bool # true once any non-idempotent tool call has run def may_merge_reissue(local: TaskView, incoming: TaskView, card_cache_says_epochs: bool) -> bool: """ Decide whether `incoming` may overwrite `local`. The epoch check runs UNCONDITIONALLY. `card_cache_says_epochs` only gates the optional warrant-verification sub-step; it must never be used to skip mismatch detection. """ if incoming.task_id != local.task_id: raise EpochMismatchError( local.task_id, incoming.task_epoch, local.task_epoch, incoming.revision, local.revision, ) # --- unconditional ownership check --- if incoming.task_epoch is None or local.task_epoch is None: # Unknown epoch is treated as mismatch whenever side effects exist. if local.side_effects_emitted or local.revision > 0: raise EpochMismatchError( local.task_id, incoming.task_epoch, local.task_epoch, incoming.revision, local.revision, ) # No side effects yet: revision ordering is safe. return incoming.revision > local.revision if incoming.task_epoch != local.task_epoch: # Competing ownership claim, not a newer view. raise EpochMismatchError( local.task_id, incoming.task_epoch, local.task_epoch, incoming.revision, local.revision, ) # Same epoch: revision ordering is valid, but writer identity must agree. if incoming.writer_id != local.writer_id: raise EpochMismatchError( local.task_id, incoming.task_epoch, local.task_epoch, incoming.revision, local.revision, ) # Cached card flag is a hint only; it is NOT consulted for the # mismatch decision above. It may suppress warrant verification, # which is a separate step handled by the caller. _ = card_cache_says_epochs return incoming.revision > local.revision def apply_reissue(local: TaskView, incoming: TaskView, card_cache_says_epochs: bool) -> TaskView: if not may_merge_reissue(local, incoming, card_cache_says_epochs): # Caller must reconcile via state query, not by overwriting. raise EpochMismatchError( local.task_id, incoming.task_epoch, local.task_epoch, incoming.revision, local.revision, ) return incoming ```