{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-trace-context-grafting-from-silently-corrupting-parent-child-span-topology-across-federated-agent-boundaries",
  "title": "Which invariants prevent trace-context grafting from silently corrupting parent-child span topology across federated agent boundaries",
  "date_of_record": "2026 November 16",
  "scope": "Applies to OpenTelemetry-style GenAI semantic conventions (`gen_ai.*` attributes, `gen_ai.agent.id`, `gen_ai.conversation.id`) propagated across trust boundaries between independently-operated agent runtimes that exchange `traceparent`/`tracestate` and span links. Does not apply to single-tenant traces within one operator's trust domain, nor to pure log-correlation without span export.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-context-grafting-from-silently-corrupting-parent-child-span-topology-across-federated-agent-boundaries.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-context-grafting-from-silently-corrupting-parent-child-span-topology-across-federated-agent-boundaries.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-context-grafting-from-silently-corrupting-parent-child-span-topology-across-federated-agent-boundaries.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1497,
    "python_slice_tokens": 305,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent boundary can carry, and they are routinely conflated: 1. **Causality** — \"this span happened because that span happened.\" Encoded by `parent_span_id` (a single, exclusive edge) and by the `trace_id` shared across the tree. 2. **Association** — \"this span is related to that span, but did not descend from it...",
    "what_was_observed": "During a three-agent federated rollout (orchestrator O, retrieval agent R, synthesis agent S, each a separate deployment with its own collector and its own `gen_ai.agent.id`), the following sequence reproduced deterministically: - O emits span `o1` (`trace_id=T`, root). - O calls R, injecting `traceparent` with `o1` as parent. R correctly emits `r1` with `parent_span_id=o1.span_id`. - R calls back into a tool hosted ...",
    "condition_of_validity": "The link-not-parent rule is valid and must be enforced exactly when all of the following hold: - The two spans are emitted by processes with **disjoint `gen_ai.agent.id` ownership** (neither is authorized to assert ancestry over the other's spans). - The relationship is **association or delegation**, not synchronous containment (the callee does not run *insi...",
    "decision_boundary": "Given an inbound context at an agent boundary, decide as follows: - If `inbound.agent_id == self.agent_id` **and** the call is synchronous containment → adopt `inbound.span_id` as `parent_span_id`. Continue. - If `inbound.agent_id != self.agent_id` **or** the call is asynchronous/delegated → do **not** set a parent from the inbound context. Start a new root ...",
    "operational_effect": "Enforcing the invariant converts a silent topological corruption into a loud, localized rejection at the boundary, which is the correct failure mode: the receiving agent knows immediately that it was handed a context it may not adopt. The cost is that federated traces become forests joined by links rather than single trees, so any downstream tool that assume..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "5d935f2eee997f42365739fd45cd04a7909bfc4112d6aa762f51db4c84238e77",
    "verified_classes": [
      "SpanTopologyError",
      "SpanContext",
      "Span"
    ],
    "verified_functions": [
      "adopt_inbound_context",
      "assert_topology"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpanTopologyError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
