{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-tool-call-lineage-from-surviving-across-asynchronous-agent-boundaries",
  "title": "Which invariants prevent tool-call lineage from surviving across asynchronous agent boundaries",
  "date_of_record": "2026 November 17",
  "scope": "Applies to OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) emitted by agent runtimes that execute tool calls across process, queue, or thread boundaries and then re-parent results. Does not apply to synchronous in-process tool dispatch where the parent span is still on the active context stack at completion time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-tool-call-lineage-from-surviving-across-asynchronous-agent-boundaries.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tool-call-lineage-from-surviving-across-asynchronous-agent-boundaries.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-tool-call-lineage-from-surviving-across-asynchronous-agent-boundaries.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1598,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define *attribute* shape (e.g. `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.operation.name`, `gen_ai.usage.input_tokens`) but they do **not** define a lineage invariant that binds a tool *invocation* span to its *result* span when the two are emitted by different execution contexts. Lineage in practice is carried by two i...",
    "what_was_observed": "In a multi-agent deployment where an orchestrator enqueues tool invocations onto a Redis-backed worker pool, we observed the following sequence repeatedly under load: 1. Orchestrator span `S_inv` (operation `execute_tool`, `gen_ai.tool.name=search_docs`, `gen_ai.tool.call.id=tc_9f2`) ends and is exported. 2. The worker, running in a separate process, dequeues the job. The enqueue payload contained `traceparent` captu...",
    "condition_of_validity": "The following invariant holds **only** when all three conditions are true, and is silently void otherwise: - **I1 (context continuity):** the `SpanContext` of the invocation span is the exact context extracted by the result emitter — i.e. the enqueue payload captured `traceparent` *after* `S_inv` was started, and the worker extracts from that same payload, n...",
    "decision_boundary": "Choose the lineage strategy by where the tool call crosses an asynchronous boundary: - **In-process, synchronous:** rely on ambient context; I1 is free. Do not add `tool.call.id`-based joins — they add cardinality without information. - **Cross-process via queue/worker:** you must capture `traceparent` from the *live* invocation context at enqueue time (not ...",
    "operational_effect": "When the invariant is violated, the observable symptoms are: (a) trace trees that are well-formed but have tool results as siblings of their invocations rather than children; (b) `tool.call.id` collisions that inflate retry metrics and corrupt per-tool latency histograms; (c) span counts that exceed invocation counts without a corresponding error signal, bec..."
  },
  "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": "1a1a9ca552f5cb9bd7ec931b7121ac96c39b2cb1bd787f4b4aa99e2eb45c7752",
    "verified_classes": [
      "ToolLineageInvariantError",
      "SpanContext",
      "ToolInvocation"
    ],
    "verified_functions": [
      "emit_result_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ToolLineageInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
