{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-attributes-a-memory-retrieval-span-to-the-wrong-semantic-convention-during-concurrent-tool-call-fan-out",
  "title": "What happens when an instance attributes a memory retrieval span to the wrong semantic convention during concurrent tool-call fan-out",
  "date_of_record": "2026 November 14",
  "scope": "Applies to OpenTelemetry-instrumented GenAI agents that emit `gen_ai.*` semantic conventions for memory retrieval (vector store query, RAG fetch, episodic recall) when a single logical retrieval fans out across multiple concurrent tool calls sharing a parent span. Does not apply to single-threaded, synchronous retrieval where one span maps to one query.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-attributes-a-memory-retrieval-span-to-the-wrong-semantic-convention-during-concurrent-tool-call-fan-out.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-attributes-a-memory-retrieval-span-to-the-wrong-semantic-convention-during-concurrent-tool-call-fan-out.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-attributes-a-memory-retrieval-span-to-the-wrong-semantic-convention-during-concurrent-tool-call-fan-out.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1111,
    "python_slice_tokens": 209,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define memory retrieval as a *content-bearing* span: `gen_ai.operation.name = \"retrieval\"`, with attributes such as `gen_ai.data_source.id`, `gen_ai.retrieval.query`, and result-count fields. The non-obvious boundary is that these conventions were specified assuming a 1:1 relationship between a retrieval operation and its emitt...",
    "what_was_observed": "During a fan-out of three concurrent retrieval calls (a vector store, a keyword index, and an episodic memory store) sharing a `gen_ai.tool.call` parent, the instrumentation library reused a mutable context object to populate `gen_ai.retrieval.query`. Because the three coroutines interleaved at `await` boundaries, the query string of whichever branch resolved second overwrote the attribute on the first branch's span ...",
    "condition_of_validity": "The invariant holds only when all of the following are true: (a) more than one retrieval span shares a parent span or logical step; (b) the instrumentation populates span attributes from a shared or reused context object rather than per-span immutable state; (c) coroutine or thread interleaving occurs between attribute-set and span-export. If retrievals are ...",
    "decision_boundary": "When you observe sibling retrieval spans that share identical query text but divergent result counts, do not treat this as a store inconsistency or a deduplication bug. First check whether the spans' `gen_ai.data_source.id` values are also collapsed to a single value despite the parent declaring multiple sources. If so, the correct remediation is to stamp th...",
    "operational_effect": "Untreated, this failure poisons retrieval-quality dashboards and can trigger false rollbacks of healthy index configurations. Because the corrupted attribute is the *query*, not the result, the error is invisible to latency and error-rate SLOs and only surfaces in offline evaluation joins. The operational rule is to validate, at export time, that each retrie..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "2df71d58b7e9af882be72927139d3f49117e58fd759cf3afc71ec6195be3fd04",
    "verified_classes": [
      "RetrievalSpanAttributionError"
    ],
    "verified_functions": [
      "validate_retrieval_span",
      "detect_bleed"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RetrievalSpanAttributionError"
    ],
    "sample_fail_closed_invariants": [
      "all fan-out branches collapsed to a single data_source.id; suspect shared-mutable-context attribute bleed"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
