{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-attribute-span-level-cost-when-a-federated-agent-hop-rewrites-trace-identity",
  "title": "Where must an instance attribute span-level cost when a federated agent hop rewrites trace identity",
  "date_of_record": "2026 November 16",
  "scope": "Applies to multi-agent systems where spans are emitted by more than one trust domain and at least one hop re-parents, re-IDs, or re-samples the trace context before forwarding. Does not apply to single-process instrumentation, nor to hops that preserve the inbound `trace_id`/`span_id` pair byte-for-byte and forward an unmodified `tracestate`.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-level-cost-when-a-federated-agent-hop-rewrites-trace-identity.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-level-cost-when-a-federated-agent-hop-rewrites-trace-identity.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-level-cost-when-a-federated-agent-hop-rewrites-trace-identity.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1583,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive model treats span-level cost attribution as a join: each span carries a `trace_id`, the collector joins spans to a billing ledger keyed on token counts, and the sum over the trace yields the trace's cost. This model silently assumes that *span identity is stable across hops*. In federated agent topologies it is not. A hop that terminates the inboun...",
    "what_was_observed": "In a three-hop agent pipeline (orchestrator → retrieval agent → synthesis agent, each in a separate service mesh domain), the billing ledger and the trace backend disagreed by 31% on p95 trace cost. Investigation found the retrieval agent's SDK emitted a fresh root span per batch: one inbound orchestrator span fanned out to a single child trace containing 8–40 spans, none of which shared the parent `trace_id`. The or...",
    "condition_of_validity": "Structural attribution is valid if and only if every hop in the causal path preserves the inbound context or emits a resolvable link that the rollup explicitly consumes. Concretely, the invariant is: > For every span S with a causal ancestor A in a different trust domain, either `S.trace_id == A.trace_id`, or S carries a link L with `L.trace_id == A.trace_id...",
    "decision_boundary": "Choose **structural attribution** when the topology is single-domain or when every hop is contractually required to propagate context unmodified, and enforce it with a boundary assertion that rejects non-propagating hops at deploy time. Choose **causal attribution via explicit links** when any hop may rewrite context; this requires (a) the rewriting hop to e...",
    "operational_effect": "The practical consequence is that cost and latency dashboards built before a federated hop was introduced do not degrade gracefully; they degrade *plausibly*. Totals remain in a believable range because the orphaned traces are still counted, just under the wrong key. The failure surfaces only when a tenant disputes a bill or an SLO breach is traced to a span..."
  },
  "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": "2bfcad54d445f3a57fdc2a8bddddea10bc02f613f344dace8dc72b67b468202a",
    "verified_classes": [
      "TraceIdentityDiscontinuity",
      "SpanContext",
      "SpanLink",
      "OutboundSpan"
    ],
    "verified_functions": [
      "assert_attributable"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TraceIdentityDiscontinuity"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
