{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-a-multi-agent-trajectory-across-a-nondeterministic-tool-call-boundary-trace-reconstruction-and-the-counterfactua",
  "title": "What happens when an instance replays a multi-agent trajectory across a nondeterministic tool-call boundary: trace reconstruction and the counterfactual divergence invariant",
  "date_of_record": "2026 November 14",
  "scope": "Applies to deterministic replay systems that reconstruct multi-agent trajectories from recorded traces (span trees, message logs, tool-call records) for the purpose of counterfactual debugging — i.e., re-running a subtree under modified inputs or policy to ask \"what would have happened if agent X had chosen Y?\". Does not apply to single-agent linear traces, nor to systems where all tool calls are pure functions with recorded outputs and no ambient state (clock, randomness, external queues) is consulted.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-multi-agent-trajectory-across-a-nondeterministic-tool-call-boundary-trace-reconstruction-and-the-counterfactua.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-multi-agent-trajectory-across-a-nondeterministic-tool-call-boundary-trace-reconstruction-and-the-counterfactua.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-multi-agent-trajectory-across-a-nondeterministic-tool-call-boundary-trace-reconstruction-and-the-counterfactua.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2802,
    "python_slice_tokens": 616,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"replay\" that are routinely conflated by engineers building debugging harnesses, and the conflation is the source of a whole class of silent correctness failures: 1. **Trace replay** — re-emitting the recorded sequence of events (messages, tool calls, tool results) without re-executing the underlying logic. This is determini...",
    "what_was_observed": "A multi-agent system with three roles (planner, retriever, synthesizer) was instrumented with a span-based tracer. Each span recorded: agent id, parent span id, the full prompt, the model output, the tool calls issued, and the tool results. Traces were stored as a DAG keyed by `(trace_id, span_id)`. The debugging harness supported \"fork\" operations: given a trace and a span, re-run the subtree rooted at that span wit...",
    "condition_of_validity": "Counterfactual replay of a multi-agent subtree is sound if and only if, for every tool invocation reachable from the forked span, exactly one of the following holds: - **(a) Deterministic and pure.** The tool is a pure function of its arguments, and re-execution reproduces the recorded result bit-for-bit. Verified, not assumed. - **(b) Pinned to recorded res...",
    "decision_boundary": "The decision boundary is between *forking at a boundary that is causally downstream of all impure tool calls in the subtree* and *forking at a boundary that is causally upstream of at least one impure tool call*. - **Downstream fork (safe):** The forked span's subtree contains only pure tools, or the fork is configured to pin all impure tools to recorded res...",
    "operational_effect": "When the invariant is enforced, three things change in practice: 1. **Fork latency increases and fork count decreases.** Pinning impure tools to recorded results means the fork cannot explore counterfactuals that change the tool-call sequence. Operators who want to explore \"what if the retriever had returned different documents\" must promote the retriever to..."
  },
  "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": "87073ee4fb9d73c07cf371eac4a12e298bf00dfad20489431f1b867736162e2b",
    "verified_classes": [
      "ReplayHoleError",
      "Provenance",
      "ToolCall",
      "ToolResult",
      "ForkSpec"
    ],
    "verified_functions": [
      "classify_and_resolve",
      "emit_divergence_verdict",
      "key",
      "covers"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayHoleError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
