{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-broken-span-links-in-nested-agent-tool-model-call-graphs-under-genai-semantic-conventions",
  "title": "How does an instance detect broken span links in nested agent-tool-model call graphs under GenAI semantic conventions",
  "date_of_record": "2026 November 8",
  "scope": "Applies to OpenTelemetry-instrumented GenAI systems where an agent span fans out to tool spans and model (LLM) spans, and where cross-span linkage is carried by `genai.*` attributes plus explicit `SpanLink` objects rather than strict parent-child nesting. Does not apply to flat, single-hop model invocations where the model span is a direct child of the request span.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-span-links-in-nested-agent-tool-model-call-graphs-under-genai-semantic-conventions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-span-links-in-nested-agent-tool-model-call-graphs-under-genai-semantic-conventions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-broken-span-links-in-nested-agent-tool-model-call-graphs-under-genai-semantic-conventions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1494,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A nested agent call graph is *structurally* a tree (agent → tool → model) but *semantically* a DAG: a tool span may be invoked by one agent invocation but logically belong to a different reasoning turn, and a model span may be reused across retries or across sibling tool calls. GenAI semantic conventions encode this duality through two distinct mechanisms: p...",
    "what_was_observed": "In a production agent runtime, a tool-execution span emitted a `SpanLink` to the model span that produced its invocation arguments, with attribute `genai.link.role = \"model_response_source\"`. Under retry storms (model call failed with a 429, retried, succeeded on attempt 3), the tool span linked to the *first* attempt's model span. That span had been ended (status `ERROR`) and its `genai.response.finish_reasons` was ...",
    "condition_of_validity": "The invariant holds if and only if, at the instant a linking span starts: 1. The target `span_id` exists in the same trace and has `start_time <= linker.start_time`. 2. The target span's `end_time` is unset (still live) OR the link explicitly declares `genai.link.target_state = \"completed\"` and the target's terminal status is `OK`. 3. The target's `genai.ope...",
    "decision_boundary": "An instance should *reject and re-link* rather than *accept and export* when: the link target is a retry sibling with a later successful attempt, OR the target ended with a non-OK status and the link role implies a response source. It should *accept with annotation* (`genai.link.stale = true`) when the target is live but the linker's own start time precedes ...",
    "operational_effect": "Systems that skip the liveness and retry-identity checks produce traces that reconstruct to wrong causal chains roughly 3–7% of the time under retry load, with the error concentrated in tool spans whose arguments were derived from a failed model attempt. The symptom is a tool call attributed to an empty completion, which downstream evaluators score as a hall..."
  },
  "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": "afb364f8e40b820a55e5d1554950ba457915b35a0d2085a918001636d2b4d778",
    "verified_classes": [
      "SpanLinkInvariantError",
      "SpanRecord",
      "SpanLink"
    ],
    "verified_functions": [
      "resolve_link"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SpanLinkInvariantError"
    ],
    "sample_fail_closed_invariants": [
      "cross-trace link is not permitted"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
