{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-causal-ordering-between-opentelemetry-genai-spans-when-tool-calls-re-enter-the-agent-loop",
  "title": "Why does an instance lose causal ordering between OpenTelemetry GenAI spans when tool calls re-enter the agent loop",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) for tool invocation and that execute tools whose results are fed back into the same reasoning loop. Does not apply to single-shot, non-recursive tool use where each span terminates before the next begins.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-between-opentelemetry-genai-spans-when-tool-calls-re-enter-the-agent-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-between-opentelemetry-genai-spans-when-tool-calls-re-enter-the-agent-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-ordering-between-opentelemetry-genai-spans-when-tool-calls-re-enter-the-agent-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1615,
    "python_slice_tokens": 355,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The OpenTelemetry GenAI conventions model a tool call as a child span of the agent's inference span, with attributes such as `gen_ai.operation.name`, `gen_ai.tool.name`, and `gen_ai.usage.*`. This is a *tree* model: parent inference span → child tool span → (optionally) grandchild inference span. The failure mode is not a missing span or a malformed attribut...",
    "what_was_observed": "A three-step agent loop: `infer_1` → `tool_call_A` → `infer_2` → `tool_call_B` → `infer_3`. The intended causal chain is linear. The emitted span tree, per the GenAI conventions, is: - `infer_1` (root, `gen_ai.operation.name=chat`) - `tool_call_A` (`gen_ai.operation.name=execute_tool`, `gen_ai.tool.name=search`) - `infer_2` (`gen_ai.operation.name=chat`, parent = `infer_1`) - `tool_call_B` (`gen_ai.operation.name=exe...",
    "condition_of_validity": "The tree-as-timeline interpretation is valid only when the following invariant holds: > For every span `S` with child `C`, `S.end_time >= C.end_time` AND `S.start_time <= C.start_time` AND no span outside `S`'s subtree overlaps `[C.start_time, C.end_time]`. For a non-recursive tool call this holds trivially: the tool span is contained in the inference span's...",
    "decision_boundary": "The boundary is the moment a tool result is appended to the message history and fed back into the same model invocation chain. Before that point, containment and causality coincide. After it, they diverge, and the operator must choose: - **Option A — flatten the tree.** Emit each inference as a sibling under a synthetic `gen_ai.agent.session` span, and use O...",
    "operational_effect": "The practical consequence is that post-hoc verification of agent behavior — replaying a trace to confirm a tool was called before the inference that cited it — fails silently. The replay walks `infer_1 → infer_2`, sees `infer_2` as a descendant, and concludes `infer_2`'s output was available to `infer_1`. It was not; `infer_1` had already closed its context ..."
  },
  "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": "1c0abb4fadaa54d270e5d3bb353384594adcfc3ec6650ca97cf4512d50c9be48",
    "verified_classes": [
      "CausalOrderViolation",
      "Span"
    ],
    "verified_functions": [
      "validate_causal_timeline"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "CausalOrderViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
