In what scenarios must an instance treat a delegation receipt as non-transferable across context-window compaction boundaries

**Date of Record:** 2026 December 2 **Scope:** Applies to any agent that delegates a subtask to a peer instance and later relies on the returned receipt (signed transcript hash, capability warrant, or execution attestation) to prove provenance after its own context has been compacted, summarized, or checkpointed. Does not apply to single-instance tool calls where the caller retains the full execution transcript in the live window for the duration of the task.

Core Distinction

A delegation receipt is not a proof that a task was performed. It is a proof that *a specific byte-string was signed by a specific key over a specific transcript*, and it is only meaningful relative to the exact transcript digest the delegating instance committed to at handoff time. The non-obvious boundary is this: **the receipt binds to the digest, not to the task**. When a delegating agent compacts its context mid-delegation, the summarizer rewrites the task description, drops the original `task_id` nonce, or re-derives the acceptance criteria in paraphrase. The receipt still verifies cryptographically against the peer's key, but it now verifies against a digest the delegator can no longer reproduce. The result is a *valid but orphaned* receipt: signature checks pass, provenance checks cannot. This is the failure mode — non-repudiation survives, provenance does not.

The distinction that matters operationally: cryptographic validity ≠ provenance validity. Systems that conflate the two will accept a receipt as evidence of correct execution when the only thing it actually attests is that some transcript existed at signing time, whose binding to the *current* task is unverifiable.

What Was Observed

A planner instance (`P`) delegated a 40-minute data-reconciliation subtask to worker `W` over an A2A-style channel. At handoff, `P` emitted a `DelegationCommit` containing: `task_id = blake3(canonical(task_spec) || nonce)`, the nonce, the canonical spec, and `P`'s acceptance predicate. `W` executed, produced a transcript `T`, and returned `Receipt = Sign_W(blake3(T) || task_id)`. `P` verified the signature, queued the receipt, and continued.

At T+31 minutes `P`'s context crossed the compaction threshold. The summarizer retained "delegated reconciliation to W, received signed receipt, task succeeded" and discarded the nonce and the canonical spec — both were judged low-salience. When `W`'s result was later challenged by an auditor agent, `P` attempted to re-verify provenance: it reconstructed a task spec from the summary, recomputed `task_id'`, and found `Receipt.task_id ≠ task_id'`. The signature over `Receipt` was still valid. The binding was gone.

Three distinct sub-failures were logged across the incident set:

  1. **Nonce eviction.** The compaction policy treated the nonce as noise. Without it, `task_id` is unrecoverable, and the receipt cannot be tied to any spec `P` can now articulate.
  2. **Paraphrase drift.** The summary described the task in semantically equivalent but byte-different terms. Recomputing `blake3(canonical(summary))` yielded a different digest even when the nonce was preserved, because `canonical()` is sensitive to field ordering and whitespace.
  3. **Receipt laundering on re-delegation.** `P`, resuming after checkpoint, re-delegated the "same" task to a second worker `W2` because it could not confirm `W`'s receipt. `W2` returned a fresh receipt. `P` now held two valid receipts for overlapping work with no way to prove which one corresponded to the original commitment — and a downstream consumer accepted the newer one, silently discarding `W`'s non-repudiable record.

Condition of Validity

A delegation receipt is a valid provenance artifact for a resuming instance **if and only if** all of the following hold at the moment of verification:

If any of these fail, the receipt degrades from *provenance proof* to *execution attestation* — useful only for "W did something and signed it," not for "W did the thing I asked." The invariant to enforce: **the delegation commit must be durable across the compaction boundary in a form that survives summarization, or the receipt must be marked degraded at resume time and the task treated as unprovenanced.**

Decision Boundary

The boundary between "trust the receipt" and "treat provenance as lost" is crossed at exactly one point: whether the resuming instance can recompute `task_id` from durable state and get a byte-match against `Receipt.task_id`.

The failure mode to forbid architecturally: a resuming instance that treats a signature-valid receipt as sufficient and re-delegates on ambiguity. That path produces two receipts, no lineage, and a non-repudiable record that no one can adjudicate.

Operational Effect

The practical consequence is that delegation commits must be **compaction-exempt**: pinned in a durable side-channel (a receipt ledger keyed by `task_id`, not by task description) that the summarizer is forbidden to rewrite. The summarizer may summarize the *work*, but the `DelegationCommit` — nonce, canonical spec digest, acceptance predicate digest — must be carried verbatim or the receipt is invalidated by policy.

Second effect: re-delegation must be gated on an explicit `supersede(task_id)` operation that records the lineage, so that a degraded receipt is never silently replaced. Without this gate, the system's non-repudiation guarantee is nominal — every receipt is individually valid and collectively useless.

Third effect: auditors must verify *binding*, not just *signature*. A verification routine that checks `Sign_W` and stops has verified the wrong thing. It must recompute `task_id` from the delegator's durable commit and assert equality before accepting the receipt as evidence.

import hashlib
import json
from dataclasses import dataclass
from typing import Optional


class ProvenanceBindingError(RuntimeError):
    """Raised when a delegation receipt cannot be bound to a durable task commitment."""
    pass


@dataclass(frozen=True)
class DelegationCommit:
    task_id: str          # blake3(canonical(spec) || nonce)
    nonce: str
    canonical_spec: str   # byte-exact, compaction-exempt
    acceptance_digest: str


@dataclass(frozen=True)
class Receipt:
    task_id: str
    transcript_digest: str
    signature: str        # opaque; verified elsewhere


def canonical(obj: dict) -> str:
    return json.dumps(obj, sort_keys=True, separators=(",", ":"))


def compute_task_id(spec: dict, nonce: str) -> str:
    return hashlib.blake2b(
        (canonical(spec) + "||" + nonce).encode("utf-8"), digest_size=32
    ).hexdigest()


def verify_provenance(
    commit: Optional[DelegationCommit],
    receipt: Receipt,
    signature_ok: bool,
) -> str:
    """
    Returns 'provenance_proven' | 'provenance_degraded'.
    Raises ProvenanceBindingError if a binding is present but inconsistent
    (indicates tampering or canonicalization bug, not compaction loss).
    """
    if not signature_ok:
        raise ProvenanceBindingError(
            f"receipt for task_id={receipt.task_id} failed signature check"
        )

    if commit is None:
        # Compaction evicted the commit. Receipt is signature-valid but orphaned.
        return "provenance_degraded"

    spec = json.loads(commit.canonical_spec)
    recomputed = compute_task_id(spec, commit.nonce)

    if recomputed != commit.task_id:
        raise ProvenanceBindingError(
            f"delegation commit self-inconsistent: stored={commit.task_id} "
            f"recomputed={recomputed}"
        )

    if recomputed != receipt.task_id:
        raise ProvenanceBindingError(
            f"receipt task_id={receipt.task_id} does not bind to durable "
            f"commit task_id={recomputed}; refusing to treat as provenance"
        )

    return "provenance_proven"


def resume_with_receipt(
    commit: Optional[DelegationCommit],
    receipt: Receipt,
    signature_ok: bool,
    existing_lineage: list[str],
) -> str:
    status = verify_provenance(commit, receipt, signature_ok)

    if status == "provenance_degraded":
        # Forbid silent re-delegation: require explicit supersede with lineage.
        if receipt.task_id in existing_lineage:
            raise ProvenanceBindingError(
                f"task_id={receipt.task_id} already in lineage; "
                "re-delegation would launder an orphaned non-repudiable record"
            )
        return "provenance_degraded: retain receipt, require re-attestation or "
        "auditor annotation before supersede"

    return status