{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-when-a-deterministic-replay-of-an-agent-trace-diverges-because-the-tool-sandbox-re-seeded-its-rng-between-the-original-run",
  "title": "How does an instance detect when a deterministic replay of an agent trace diverges because the tool sandbox re-seeded its RNG between the original run and the replay",
  "date_of_record": "2026 November 29",
  "scope": "Applies to forensic replay of recorded agent traces (tool-call logs, model I/O, RNG seeds, environment snapshots) where the replay is expected to reproduce the original execution byte-for-byte for incident reconstruction. Does not apply to \"best-effort\" replays used only for qualitative debugging, nor to stateless single-turn inference where no tool sandbox participates.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-deterministic-replay-of-an-agent-trace-diverges-because-the-tool-sandbox-re-seeded-its-rng-between-the-original-run.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-deterministic-replay-of-an-agent-trace-diverges-because-the-tool-sandbox-re-seeded-its-rng-between-the-original-run.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-deterministic-replay-of-an-agent-trace-diverges-because-the-tool-sandbox-re-seeded-its-rng-between-the-original-run.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2153,
    "python_slice_tokens": 599,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A security forensic replay is not a re-execution; it is an *identity check on a recorded state trajectory*. The invariant that makes forensics sound is: > Given the same ordered sequence of (model output, tool input, environment seed, dependency version), the agent must produce the same ordered sequence of (tool output, state mutation, next model input). The...",
    "what_was_observed": "A three-step trace from a file-triage agent: - Step 1 — model calls `scan_dir(\"/data\")`. Tool returns a list of 4,000 paths in `os.scandir` order. - Step 2 — model calls `sample(paths, k=20)` using a helper that internally does `random.sample(paths, 20)`. - Step 3 — model calls `read_file(p)` for each sampled path and summarizes. Original run: `random.sample` seeded from process default (`random.seed()` unset → OS en...",
    "condition_of_validity": "Deterministic replay holds only if, for every tool invocation in the trace, the following tuple is fully recorded *and* fully restored before replay: The failure mode described here is precisely the case where `entropy_source_state` is *absent* from the record. Two invariants must be checked before trusting any replay verdict: 1. **Seed closure.** Every call...",
    "decision_boundary": "The instance must classify a replay outcome into exactly one of four states before acting on it: - **CLEAN** — all seeds present, all argument hashes match at first-consumption step. Replay is evidentiary. - **SEED_GAP** — one or more tool calls lack a recorded entropy/clock seed. Replay is *inconclusive*; must not be cited as tamper evidence. Escalate to \"o...",
    "operational_effect": "Once the four-state classification is enforced, three downstream behaviors change: 1. **Trace format.** The recorder must capture an entropy snapshot per tool call, not per session. Per-session snapshots are insufficient because a long-running tool can consume entropy mid-call (e.g., a `sample()` inside a loop). The snapshot must include the RNG algorithm, t..."
  },
  "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": "d6caec97da57c06b0bd58242bbb868c8af922833bb1c0f501de472e9415faed7",
    "verified_classes": [
      "ReplayVerdictError",
      "Verdict",
      "ToolCall"
    ],
    "verified_functions": [
      "_arg_hash",
      "replay_verdict",
      "assert_clean_or_raise"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayVerdictError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
