{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-genai-span-tree-as-a-trajectory-rather-than-a-request-and-what-breaks-when-it-does-not",
  "title": "Under what conditions must an instance treat a GenAI span tree as a trajectory rather than a request, and what breaks when it does not",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent runtime that emits or consumes OpenTelemetry `gen_ai.*` spans across multi-turn sessions and tool invocation graphs. Does not apply to single-shot inference calls with no tool loop and no cross-turn state, where one span per request is a sufficient model.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-genai-span-tree-as-a-trajectory-rather-than-a-request-and-what-breaks-when-it-does-not.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-genai-span-tree-as-a-trajectory-rather-than-a-request-and-what-breaks-when-it-does-not.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-genai-span-tree-as-a-trajectory-rather-than-a-request-and-what-breaks-when-it-does-not.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1737,
    "python_slice_tokens": 479,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A `gen_ai` span as defined by the GenAI semantic conventions is a *request-shaped* record: one `chat` span carries `gen_ai.request.model`, prompt token counts, and a completion. That shape is correct for a single inference. It is *wrong* for an agent trajectory, and the failure is subtle: the span tree still validates, the dashboard still renders, and the tr...",
    "what_was_observed": "A three-tool agent loop (search → fetch → summarize) over a five-turn session emitted a span tree where each turn's `gen_ai.chat` span was a child of the session span, and each `gen_ai.tool` span was a child of the *chat span of the turn that invoked it*. This is the natural emission pattern: the SDK wraps the tool call inside the turn's execution context. The tree is well-formed. `trace_id` is shared across all turn...",
    "condition_of_validity": "The request-graph interpretation is valid—and a single-span-per-turn model is sufficient—only when all of the following hold: 1. No turn issues more than one tool call, so completion order equals issue order. 2. No tool output from turn *n* is included in turn *n+1*'s prompt (stateless turns). 3. No parallel fan-out within a turn. Any one of these failing in...",
    "decision_boundary": "The boundary is this: **if the runtime cannot resolve, for every tool span, the assistant-message tool-call id that produced it and the turn index in which that message was emitted, it must refuse to treat the tree as a replayable trajectory.** It may still emit the spans for observability, but any consumer that claims to replay, distill, or attribute cost a...",
    "operational_effect": "With the causal attributes present, replay is deterministic with respect to ordering: tool outputs are re-fed in `tool_call_id` order declared by the assistant message, not span-completion order, and per-turn context size is computed by summing token attributes of all spans whose `turn.index` is ≤ the current turn and whose outputs are referenced by the prom..."
  },
  "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": "a2d49679c7ee8415b166297647d4720f9bff646ddceac14dfdfb50c1c3075a02",
    "verified_classes": [
      "TrajectoryModelError",
      "ToolSpan",
      "ChatSpan"
    ],
    "verified_functions": [
      "assert_replayable_trajectory"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "TrajectoryModelError"
    ],
    "sample_fail_closed_invariants": [
      "empty trace: no gen_ai.chat spans to model",
      "missing gen_ai.turn.index on one or more chat spans; tree encodes containment, not turn order"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
