{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-replaying-a-speculative-branch-diverge-from-its-own-committed-log-after-a-sibling-agent-s-tool-result-is-re-injected-out-of-order",
  "title": "Why does an instance replaying a speculative branch diverge from its own committed log after a sibling agent's tool result is re-injected out of order",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that detect agent divergence by deterministic replay of a committed event log, where speculative (tentative) tool calls are issued ahead of a serialization barrier and later committed or discarded. Does not apply to orchestrators that forbid speculative execution, nor to single-agent systems with no sibling concurrent commits interleaved into the replay stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-replaying-a-speculative-branch-diverge-from-its-own-committed-log-after-a-sibling-agent-s-tool-result-is-re-injected-out-of-order.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-replaying-a-speculative-branch-diverge-from-its-own-committed-log-after-a-sibling-agent-s-tool-result-is-re-injected-out-of-order.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-replaying-a-speculative-branch-diverge-from-its-own-committed-log-after-a-sibling-agent-s-tool-result-is-re-injected-out-of-order.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1969,
    "python_slice_tokens": 325,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things called \"replay\" in an agent runtime, and conflating them is the root of the failure: - **Log replay** reconstructs state by feeding the *committed* event stream back through the same reducers. It is deterministic only if the reducer is a pure function of the event sequence. - **Speculative replay** reconstructs state by re-executing the ...",
    "what_was_observed": "An orchestrator ran a planner agent `P` and two workers `W1`, `W2` under a shared event log with a commit barrier every N=8 events. `P` issued speculative tool calls `t_a` (to `W1`) and `t_b` (to `W2`) in the same reasoning step, with `t_b` dispatched 12 ms after `t_a`. At runtime, `t_b`'s result arrived first (W2's sandbox was warm), so `P`'s next reasoning step consumed `[r_b, r_a]`. The log, however, assigned sequ...",
    "condition_of_validity": "Deterministic replay is a sound divergence detector for an agent instance **iff** all of the following hold: - **C1 (Order fidelity).** For every tool result the agent consumed during live execution, the replay stream delivers it at the same position relative to all other results the agent consumed in the same reasoning step. If the agent's consumption is or...",
    "decision_boundary": "The boundary is between **order-insensitive** and **order-sensitive** consumption, and it must be decided per tool result, not per agent: - If a tool result's value is the only thing the agent conditions on (e.g., a scalar the agent reads once), reordering is harmless and C1 can be relaxed. - If the agent's next step is a function of the *sequence* of result...",
    "operational_effect": "Without the guardrail, the orchestrator quarantined a correct branch, re-ran `P` from the pre-speculation checkpoint, and — because the re-run again consumed results in a different arrival order — produced a *third* distinct reasoning trace. The divergence detector now had three mutually inconsistent traces for one logical step and, being a majority-vote aud..."
  },
  "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": "2da1c3dab10b864bda4a191372f3f1b50379a84b9b852e8c31427d0b91ce4c4a",
    "verified_classes": [
      "ReplayOrderAmbiguity",
      "ResultEvent",
      "Checkpoint"
    ],
    "verified_functions": [
      "reconstruct_consumption_order",
      "detect_divergence"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayOrderAmbiguity"
    ],
    "sample_fail_closed_invariants": [
      "sibling sub-event was flattened into total order; parent-child grouping the agent observed cannot be reconstructed"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
