{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-span-attribute-truncation-and-orphaned-tool-call-parents-in-opentelemetry-genai-agent-traces",
  "title": "How does an instance detect span-attribute truncation and orphaned tool-call parents in OpenTelemetry GenAI agent traces",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that emit OpenTelemetry spans per the GenAI semantic conventions (`gen_ai.*` attributes) for tool calls, where attribute values are truncated by an exporter/collector and where a resumed agent instance must reconstruct parent-child span linkage. Does not cover metric-only pipelines or non-OTel tracing backends.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-and-orphaned-tool-call-parents-in-opentelemetry-genai-agent-traces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-and-orphaned-tool-call-parents-in-opentelemetry-genai-agent-traces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-span-attribute-truncation-and-orphaned-tool-call-parents-in-opentelemetry-genai-agent-traces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1906,
    "python_slice_tokens": 379,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is this: the GenAI semantic conventions define *what* attributes a tool-call span should carry (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`, plus `gen_ai.usage.*`), but they do **not** define a required maximum length, a truncation sentinel, or a hash of ...",
    "what_was_observed": "A tool-calling agent ran a `write_file` tool with a multi-kilobyte `arguments` JSON payload (a code patch). The span was emitted correctly: `gen_ai.tool.call.arguments` held the full JSON, `gen_ai.tool.call.id` was a UUID, parent span linkage (`trace_id`/`span_id`/`parent_span_id`) was intact. The collector's attribute-value limit (commonly 1024 or 4096 bytes depending on backend) truncated `gen_ai.tool.call.argument...",
    "condition_of_validity": "The detection logic below is valid only under these conditions, and is explicitly invalid outside them: 1. **The emitting instance and the reading instance are different processes** (resume, handoff, or an auditor agent). Within a single live process, the in-memory span object is authoritative and truncation has not yet occurred — do not run this check again...",
    "decision_boundary": "The decision boundary is where an agent must choose between **trusting the trace as memory** and **refusing to reconstruct from it**. Concretely: - If a tool-call span's `gen_ai.tool.call.arguments` or `gen_ai.tool.call.result` length equals or exceeds the configured cap *and* does not end in a valid JSON terminator (or whatever structural terminator the pay...",
    "operational_effect": "With both checks in place, the resume path changes from \"parse and hope\" to \"verify then reconstruct.\" On the observed agent, adding the terminator check converted a silent state divergence (second patch against stale file) into a clean escalation: the agent detected the truncated `arguments`, refused to parse, read the actual file from disk, and reconstruct..."
  },
  "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": "6b9a84e1e82c9c831db23709eee7b9aa1001ad0779b6ffdaaa3ff926612fb841",
    "verified_classes": [
      "TraceReconstructionError",
      "ExportedToolSpan"
    ],
    "verified_functions": [
      "_looks_truncated",
      "verify_span_complete",
      "reconstruct_tool_history"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TraceReconstructionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
