{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-taint-provenance-when-a-sandboxed-tool-returns-a-value-through-a-serialization-boundary",
  "title": "Why does an instance lose taint provenance when a sandboxed tool returns a value through a serialization boundary",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agent runtimes that track information-flow taint (untrusted → trusted) across tool calls, where tool results cross a process/serialization boundary (subprocess, worker, RPC, container) before re-entering the orchestrator's context. Does not apply to in-process tool calls that share the same interpreter and taint-tracking object graph.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-when-a-sandboxed-tool-returns-a-value-through-a-serialization-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-when-a-sandboxed-tool-returns-a-value-through-a-serialization-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-when-a-sandboxed-tool-returns-a-value-through-a-serialization-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1796,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint tracking is not a property of the *value*; it is a property of the *reference handle* the orchestrator holds. When a sandboxed tool executes in a separate address space, the taint label lives on the orchestrator-side handle that spawned the call. The value that comes back is a fresh deserialized object. The distinction that matters: **an untrusted tool...",
    "what_was_observed": "A tool sandbox was invoked as `subprocess.run` returning JSON on stdout. The orchestrator deserialized stdout with `json.loads`. The taint label was attached to the *call descriptor* before dispatch. On return, the deserializer constructed a new `ToolResult` object with `taint=None` because the constructor default was trusted. The call-site taint was never re-applied. Downstream, the planner consumed `result.value` a...",
    "condition_of_validity": "The invariant that must hold is: *for every tool result entering the orchestrator's reasoning context, `result.taint ⊇ taint_of(call_site)`.* This is a **join (least-upper-bound) over provenance, not an assignment from payload inspection.** A result is at least as tainted as the call that produced it, and additionally tainted by any untrusted inputs that wer...",
    "decision_boundary": "The boundary is between **content-based sanitization** and **provenance-based taint**. A runtime that inspects the payload for \"suspicious\" patterns is doing content sanitization; it cannot bound the attack surface because the attacker controls the payload and can make it look benign. A runtime that propagates provenance can bound it because provenance is de...",
    "operational_effect": "The observable effect is a **taint-laundering chain**: untrusted → sandboxed tool → deserialize (taint reset) → planner reads as trusted → privileged sink. Each hop looks locally correct. The sandbox did its job; the planner did its job; the sink did its job. The failure is entirely in the *join* that no component performed. The architectural guardrail is a ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "b70bfc62ae63501feab4cd6fe244862cb6352718d2aacafd085e9eb0d310dac8",
    "verified_classes": [
      "TaintLaunderingError",
      "Taint",
      "ToolResult",
      "TaintLedger"
    ],
    "verified_functions": [
      "planner_construct_command",
      "dispatch_to_privileged_sink",
      "join",
      "__post_init__",
      "__init__",
      "register",
      "join_on_return"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [
      "unexpected tool result shape",
      "ToolResult constructed with taint=None; default-trusted is a fail-open"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
