{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-demote-a-tool-capability-mid-execution-the-taint-propagation-lag-invariant-in-sandboxed-agent-tool-chains",
  "title": "When must an instance demote a tool capability mid-execution: the taint-propagation lag invariant in sandboxed agent tool chains",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agent runtimes that execute tools inside a sandbox and attach provenance labels (trusted/untrusted) to tool outputs, where a capability set is selected per tool call. Does not cover static permission models set once at session start, nor human-in-the-loop approval flows where every call is gated.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-demote-a-tool-capability-mid-execution-the-taint-propagation-lag-invariant-in-sandboxed-agent-tool-chains.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-demote-a-tool-capability-mid-execution-the-taint-propagation-lag-invariant-in-sandboxed-agent-tool-chains.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-demote-a-tool-capability-mid-execution-the-taint-propagation-lag-invariant-in-sandboxed-agent-tool-chains.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2832,
    "python_slice_tokens": 818,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the sandbox escaped\" and not \"a prompt injection succeeded.\" It is the **taint-propagation lag**: the window between the moment an untrusted-provenance value enters the agent's working state and the moment the capability governor (the component that downgrades tool capabilities based on taint) observes that taint. In a well-built sys...",
    "what_was_observed": "A tool-execution trace from a research agent with three tools: `web.fetch` (untrusted output), `doc.parse` (trusted), and `shell.exec` (capability: `exec` with `network: false`, `fs: read-only`). The governor's policy: any argument carrying untrusted taint downgrades `shell.exec` to `exec: restricted` (no subprocess spawn, no file write). 1. `web.fetch(\"https://example.org/advisory\")` returns body `B`. Governor tags ...",
    "condition_of_validity": "The invariant holds — and the failure is bounded — only when all of the following are true: - **Taint is tracked at the value level, not the variable level.** Every string, bytes, dict, and list that crosses a tool boundary must carry a taint label that survives concatenation, slicing, formatting, JSON serialization, and base64 encoding. If taint is attached...",
    "decision_boundary": "The operational question is: **at which point in the call pipeline must the governor re-evaluate, and what does it do when taint is ambiguous?** The boundary is the **dispatcher entry**, defined as the last function before the sandboxed process is forked. The governor must run there, on the fully-assembled argument tuple, and must apply this decision rule: -...",
    "operational_effect": "When the invariant is enforced at the dispatcher entry with fail-closed ambiguity handling, three things change: 1. **The attack surface shrinks to the governor's value-tracking fidelity.** The remaining risk is a value that the runtime cannot track (e.g., a subprocess that reads the untrusted value from a file the agent wrote earlier). That is a *different*..."
  },
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "c773056ee84e5080bd331e0762fe48f84b03f2d07d976120c46b99195a6d572e",
    "verified_classes": [
      "Taint",
      "Capability",
      "TaintPropagationError",
      "CapabilityOverGrantError",
      "TaintedValue",
      "TaintMap",
      "ToolCall"
    ],
    "verified_functions": [
      "dispatch",
      "run_tainted_pipeline",
      "__post_init__",
      "__init__",
      "record",
      "lookup"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CapabilityOverGrantError",
      "TaintPropagationError"
    ],
    "sample_fail_closed_invariants": [
      "shell.exec launched at FULL with untrusted-derived command"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
