{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-genai-span-attribute-cardinality-explosion-from-silently-corrupting-agent-handoff-traces",
  "title": "Which invariants prevent GenAI span attribute cardinality explosion from silently corrupting agent handoff traces",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent systems that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*` attributes) across model invocations, tool calls, and inter-agent handoffs, where span attributes carry per-call payload fragments (prompts, tool args, handoff context). Does not apply to pure metric/log pipelines or to spans emitted only at the root orchestration layer with no per-invocation child spans.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-genai-span-attribute-cardinality-explosion-from-silently-corrupting-agent-handoff-traces.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-genai-span-attribute-cardinality-explosion-from-silently-corrupting-agent-handoff-traces.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-genai-span-attribute-cardinality-explosion-from-silently-corrupting-agent-handoff-traces.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1949,
    "python_slice_tokens": 367,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define attributes such as `gen_ai.operation.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.tool.name`, and `gen_ai.agent.id` as *descriptive* metadata. Operators routinely extend these with *content-bearing* attributes — `gen_ai.prompt`, `gen_ai.completion`, tool argument blobs, and handoff payload digests ...",
    "what_was_observed": "A three-agent pipeline (planner → executor → auditor) emitted handoff spans at each `transfer_to_*` boundary. Each handoff span carried: `gen_ai.agent.id` (sender), `gen_ai.agent.handoff.target` (receiver), `gen_ai.handoff.context_hash` (a SHA-256 over the serialized handoff state), and `gen_ai.handoff.context` (the full serialized state, capped at ~8 KB by convention). Under load, the executor's handoff span to the ...",
    "condition_of_validity": "The invariant that must hold for a handoff span to be trustworthy as continuity evidence is: > For any handoff span `S`, if `S` is emitted with a content-integrity attribute set `C = {context_hash, context_length, context_digest_algo}`, then either *all* of `C` are present and internally consistent with the recorded `gen_ai.handoff.context`, or `S` is marked...",
    "decision_boundary": "The boundary between \"trace is evidence\" and \"trace is telemetry\" determines the required guardrail: - **If the trace is the sole record of handoff state** (no out-of-band transfer), then the emitting agent MUST compute the digest *before* serialization, emit `gen_ai.handoff.context_hash` and `gen_ai.handoff.integrity` as *first* attributes (and configure th...",
    "operational_effect": "When the invariant is enforced: - Truncation becomes *observable*: a degraded handoff span carries `gen_ai.handoff.integrity = \"degraded\"` and the auditor's continuity check fails closed, surfacing the divergence as a first-class audit event rather than a silent pass. - Replay and distillation pipelines can filter on `integrity = \"verified\"` before treating ..."
  },
  "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": "d17319f2e6323f5bac4eaab473470e0c96d725a7ece7d4986930dd198a176d65",
    "verified_classes": [
      "HandoffIntegrityError",
      "HandoffSpan"
    ],
    "verified_functions": [
      "emit_handoff_span",
      "verify_handoff"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "HandoffIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
