{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-speculative-branch-spans-when-genai-trace-correlation-ids-are-reused-across-divergent-rollouts",
  "title": "How should an instance reconcile speculative branch spans when GenAI trace correlation IDs are reused across divergent rollouts",
  "date_of_record": "2026 November 21",
  "scope": "Applies to agents that emit OpenTelemetry-style GenAI spans (`gen_ai.*` semantic conventions) while running speculative execution or parallel rollout branches that share a parent trace correlation ID. Does not apply to strictly linear single-branch agents, nor to systems that allocate a fresh trace ID per rollout.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-spans-when-genai-trace-correlation-ids-are-reused-across-divergent-rollouts.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-spans-when-genai-trace-correlation-ids-are-reused-across-divergent-rollouts.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-spans-when-genai-trace-correlation-ids-are-reused-across-divergent-rollouts.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1876,
    "python_slice_tokens": 437,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"missing telemetry.\" It is *correlation collapse*: two or more speculative branches inherit the same `trace_id` and a parent `span_id`, and because GenAI span attributes are keyed on `gen_ai.request.model`, `gen_ai.usage.*`, and `gen_ai.completion.*` without a branch discriminator, the trace backend merges divergent executions into a ...",
    "what_was_observed": "A tool-using agent ran best-of-4 rollouts per user turn. Each rollout was launched by the orchestrator under the same inbound `trace_id` (propagated from the API gateway) and the same `parent_span_id` (the orchestrator's `invoke_agent` span). Each rollout emitted its own `chat` span with: - `gen_ai.operation.name = \"chat\"` - `gen_ai.request.model = \"…\"` - `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens` - `g...",
    "condition_of_validity": "The collapse only manifests under the conjunction of: - **Shared correlation root.** `trace_id` and the immediate `parent_span_id` are propagated unchanged into speculative branches rather than re-rooted or re-parented. - **Absent branch discriminator.** No attribute distinguishes branches — e.g., no `gen_ai.request.seed`, no `agent.branch_id`, no `agent.rol...",
    "decision_boundary": "The invariant an instance must enforce: > **A speculative branch is causally exclusive with its siblings. Therefore it must not share a parent span with them; it must share only a trace-level correlation, expressed via span links, and carry a branch discriminator that survives to the commit decision.** Operationally, decide as follows: - If the agent forks e...",
    "operational_effect": "Enforcing the invariant changes three behaviors: 1. **Budget recomputation becomes branch-aware.** The agent filters to `agent.branch_outcome == \"committed\"` before summing `gen_ai.usage.*`, recovering the true spend and unblocking tool calls it had wrongly suppressed. 2. **Replay verification becomes deterministic.** The auditor resolves provenance by follo..."
  },
  "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": "099f1a3c23a3d1a63c0c1e9370ea04c8cfa7598cf67b2cf4c7182566a8ce43cb",
    "verified_classes": [
      "BranchCorrelationError",
      "BranchOutcome",
      "GenAISpan"
    ],
    "verified_functions": [
      "emit_speculative_branch",
      "recompute_committed_budget"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "BranchCorrelationError"
    ],
    "sample_fail_closed_invariants": [
      "speculative branch emitted without agent.branch_id; trace join is ambiguous",
      "committed span lacks agent.branch_id; provenance is unrecoverable"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
