{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reject-a-genai-span-whose-parent-child-timing-inverts-across-a-tool-call-boundary-and-how-does-the-opentelemetry-genai-semantic",
  "title": "Where must an instance reject a GenAI span whose parent-child timing inverts across a tool-call boundary, and how does the OpenTelemetry GenAI semantic convention model fail to encode the causal invariant?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI spans (`gen_ai.*`) for agent turns and tool calls under a single trace, where child spans are closed out-of-order relative to parent turn spans across asynchronous tool dispatch. Does not apply to single-shot inference calls without tool invocation, nor to runtimes using a strictly synchronous span stack with no cross-process tool transport.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-genai-span-whose-parent-child-timing-inverts-across-a-tool-call-boundary-and-how-does-the-opentelemetry-genai-semantic.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-genai-span-whose-parent-child-timing-inverts-across-a-tool-call-boundary-and-how-does-the-opentelemetry-genai-semantic.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-genai-span-whose-parent-child-timing-inverts-across-a-tool-call-boundary-and-how-does-the-opentelemetry-genai-semantic.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1667,
    "python_slice_tokens": 359,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model a trace as a tree of spans keyed by `trace_id`/`span_id`/`parent_span_id`, and they prescribe attributes such as `gen_ai.operation.name` (`chat`, `execute_tool`, `invoke_agent`), `gen_ai.tool.name`, and `gen_ai.usage.input_tokens`. What they do **not** encode is a causal ordering invariant: the convention says nothing abo...",
    "what_was_observed": "A multi-step agent loop (`invoke_agent` → `chat` → `execute_tool` → `chat`) was instrumented with the GenAI conventions. Tool dispatch was async: the runtime emitted the `execute_tool` span from a worker pool and the `chat` span from the orchestrator. Under load, the following trace shape appeared repeatedly in the collector: - `chat` span (turn 2), `start_time = T0`, `end_time = T5`, `parent_span_id = invoke_agent`....",
    "condition_of_validity": "The failure is valid — meaning the runtime *must* reject the span — under the conjunction of: 1. The trace is declared as a single agent execution (one `invoke_agent` root with `gen_ai.agent.name`). 2. A child span carries `parent_span_id` pointing to a `chat` or `invoke_agent` span in the same trace. 3. The child's `[start, end]` interval is not contained w...",
    "decision_boundary": "The decision is *not* \"reject any span where child.end > parent.end.\" Legitimate async tool calls can outlive the turn that dispatched them when the agent architecture allows overlapping turns (speculative execution, parallel tool fan-out). The boundary is: - **Reject** when the child interval does not *contain-intersect* the parent interval and the trace de...",
    "operational_effect": "Without the guardrail, the GenAI trace is a structurally faithful but causally false record. Replay engines that trust end-order silently corrupt agent state on resume — the cold-start reconstruction binds a tool result to the wrong turn, and the agent's next `chat` call reasons over a poisoned context. The corruption is non-deterministic and load-dependent ..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "d1e5ecc1bd1e21ea4a2ad6b61ef337ab01dca9360d9a57a05c9ef7da5f136b45",
    "verified_classes": [
      "GenAISpanCausalityError",
      "Span"
    ],
    "verified_functions": [
      "normalize",
      "admit_trace",
      "ingest"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAISpanCausalityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
