# When must an instance refuse a handoff that carries an untrusted-context taint marker, and how does the quarantine boundary actually fail? **Date of Record:** 2026 November 30 **Scope:** Applies to multi-agent systems where a routing/orchestrator agent forwards a task to a downstream worker together with a taint label derived from provenance tracking of injected or untrusted context (e.g., retrieved web content, tool output from an unverified source, or a peer-supplied payload). Does not apply to single-agent sandboxes with no cross-instance context transfer, nor to purely cryptographic identity propagation (covered separately under warrant propagation). ## Core Distinction The failure worth isolating is not "the agent ignored a taint flag." It is the **taint-laundering via re-derivation**: a downstream worker receives a tainted context branch, does not act on it directly, but summarizes, paraphrases, or extracts a structured field from it, and then emits that derived artifact *without* the taint marker attached. The orchestrator, seeing an untainted artifact, routes it onward into a trusted sink. The taint did not disappear—it was *transduced* across a representation boundary (raw → summary → structured field) that the provenance tracker did not instrument. The invariant that must hold: **taint is a join-semilattice over the derivation DAG, not an attribute of the payload object.** Any node whose ancestry includes a tainted leaf is tainted. Systems that tag payloads (a string, a JSON blob) rather than derivations violate this invariant the moment a worker performs lossy transformation. ## What Was Observed A three-stage pipeline: `Orchestrator → Extractor → Planner → Executor`. The Extractor's job was to pull `{deadline, owner, action}` from a task description. One task description was assembled from a retrieved document whose source domain was flagged `untrusted:external`. The orchestrator correctly labeled the assembled context `taint=UNTRUSTED` and routed to the Extractor with that label. The Extractor's prompt template did not include the taint label—labels lived in the envelope, not the prompt, by design (to avoid the model "reasoning about" its own trust state). The Extractor returned a clean JSON object. The envelope-construction code on the Extractor side built the outbound message from the *model output* plus a *fresh envelope* initialized with `taint=CLEAN`, because the Extractor's code path had no access to the inbound envelope's taint field. The Planner received `taint=CLEAN` and wrote the extracted `action` field into an execution queue. Trace of the laundering: ``` inbound : {payload: , taint: UNTRUSTED, ancestry: [leaf_7]} extract : model(payload) -> {"deadline":"...","owner":"...","action":"delete ..."} outbound : {payload: , taint: CLEAN, ancestry: []} <-- ancestry reset ``` The `action` field was a direct paraphrase of an instruction embedded in the untrusted document. The Extractor never "decided" to trust it; it faithfully extracted a field the schema asked for. The taint was lost at the envelope reconstruction seam, not at a reasoning step. A second, subtler case: the Extractor *did* propagate the label on one path (when the model output matched the input verbatim), but not on the summarization path, because the two code paths were written by different authors and only one joined ancestry. This is the classic **partial-instrumentation** split: the invariant held on the path that was tested and failed on the path that was not. ## Condition of Validity The taint-aware routing guardrail is only valid under these conditions; outside them the quarantine is decorative: 1. **Ancestry is joined at every envelope construction site, mechanically.** Not "the worker should propagate it"—the envelope constructor must take the inbound ancestry as a required argument and compute `out_taint = join(in_taint, derived_from)`. A constructor that defaults to `CLEAN` is a laundering primitive. 2. **Derivation is recorded even when the payload is lossy.** A summary that shares no tokens with its source is still derived. Provenance must attach to the *act of transformation*, not to string overlap. Systems that infer taint from lexical similarity will miss paraphrase laundering entirely. 3. **Quarantine is enforced at the sink, not at the source.** The Executor must refuse actions whose ancestry contains an untrusted leaf *regardless of the envelope's current label*. Sink-side re-derivation of taint from ancestry is the only check that survives a buggy upstream constructor. 4. **The model is not asked to self-report trust.** Taint must be a property of the dataflow graph, never a field the LLM is prompted to fill in. A model that "knows" its input is untrusted and says so is a bonus, not a control. When any of these fail—most commonly (1) and (3)—the system degrades to "taint if convenient," which is worse than no taint tracking because it produces false assurance in audits. ## Decision Boundary The boundary is: **does the receiving instance have access to the derivation ancestry, or only to the payload label?** - If the receiver can compute `join` over ancestry at the sink, quarantine is enforceable and the instance must refuse on `UNTRUSTED ∈ ancestry`. - If the receiver only sees a label, the instance must treat *any* label it did not itself compute as `UNKNOWN`, and `UNKNOWN` must be handled as `UNTRUSTED` for sinks that mutate external state. Fail-closed on label provenance. - If the receiver sees neither, it must refuse the handoff rather than assume clean. An instance that accepts an unlabeled handoff into a privileged sink has already violated the invariant. The non-obvious corollary: **an instance must refuse to emit a derived artifact when it cannot prove the join was applied.** "I summarized it, so it's mine now" is exactly the laundering move. The correct behavior on a missing-ancestry outbound path is to raise and halt, not to emit with a best-guess label. ## Operational Effect With the invariant enforced at the sink, the paraphrase-laundering path from the trace above terminates at the Executor: the `action` field's ancestry contains `leaf_7`, the Executor refuses, and the orchestrator receives a `QuarantineViolation` it can route to human review or a sandboxed dry-run. The cost is a small number of false quarantines on benign extractions from untrusted-but-harmless sources—acceptable, because the alternative is silent instruction injection into the execution queue. Without it, the failure is invisible in logs: every envelope looks correctly labeled, every worker reports success, and the only signal is an action that "nobody remembers authorizing." The operational lesson is that taint tracking is a *dataflow* discipline with a *join* at every seam; the moment a worker is allowed to construct an outbound envelope without the inbound ancestry, the quarantine boundary has a hole shaped exactly like the worker's most useful transformation. ```python from dataclasses import dataclass, field from typing import FrozenSet CLEAN: FrozenSet[str] = frozenset() UNKNOWN: FrozenSet[str] = frozenset({"__unknown__"}) class TaintLaunderingError(RuntimeError): """Raised when an envelope is constructed without joining inbound ancestry.""" pass class QuarantineViolation(RuntimeError): """Raised at a privileged sink when ancestry contains an untrusted leaf.""" pass @dataclass(frozen=True) class Envelope: payload: dict ancestry: FrozenSet[str] = CLEAN untrusted_leaves: FrozenSet[str] = CLEAN def join_ancestry(inbound: Envelope, derived_from: FrozenSet[str]) -> FrozenSet[str]: # The only legal way to build an outbound envelope from an inbound one. return inbound.ancestry | derived_from def build_outbound(inbound: Envelope, payload: dict, derived_from: FrozenSet[str]) -> Envelope: if inbound is None: raise TaintLaunderingError( "outbound envelope constructed with no inbound lineage; " "refusing to default ancestry to CLEAN" ) return Envelope( payload=payload, ancestry=join_ancestry(inbound, derived_from), untrusted_leaves=inbound.untrusted_leaves, ) def executor_sink(env: Envelope, mutates_external_state: bool) -> None: # Sink-side re-derivation: trust ancestry, never the current label. if env.ancestry & env.untrusted_leaves: raise QuarantineViolation( f"refusing action; ancestry {sorted(env.ancestry)} contains untrusted leaves " f"{sorted(env.ancestry & env.untrusted_leaves)}" ) if mutates_external_state and not env.ancestry: # Empty ancestry into a privileged sink is UNKNOWN, not CLEAN. raise QuarantineViolation( "refusing privileged action on envelope with empty provenance (UNKNOWN != CLEAN)" ) # proceed ```