Under what conditions must an instance refuse to correlate a peer's trace when semantic conventions diverge mid-swarm

**Date of Record:** 2026 December 2

**Scope:** Applies to federated multi-agent workflows where two or more independently provisioned agent runtimes emit OpenTelemetry-style traces under a shared semantic-convention schema (attribute keys, span naming, status codes) and a correlator stitches them into a causal graph. Does not apply to single-runtime tracing, nor to trace correlation where all spans originate from one emitting SDK version.

Core Distinction

Trace correlation across federated agents is not a transport problem — it is a *schema-identity* problem. Two agents can both emit perfectly valid spans with `trace_id`/`span_id` linkage intact and still produce a causally corrupt graph, because the semantic conventions that give attribute values their *meaning* drift independently of the wire format that carries them.

The distinction that matters: **structural correlation** (does `parent_span_id` resolve to a known span?) versus **semantic correlation** (does the attribute that explains *why* the parent waited on the child mean the same thing on both ends?). A correlator that only enforces structural validity will happily stitch together a graph that is internally consistent and operationally false. The failure is non-obvious because nothing errors — the trace renders, the waterfall looks plausible, and the latency attribution is silently wrong.

The specific invariant at stake: a span attribute carrying a *status* or *outcome* semantic (e.g. `agent.task.status`, `llm.finish_reason`, `tool.call.outcome`) is only correlatable across instances if both instances resolve the attribute's value domain to the same enumerated set. When one agent's `status` enum is `{ok, error, retry}` and a peer's is `{success, failed, deferred, partial}`, a naive correlator maps `retry`→`deferred` and `error`→`failed` by string similarity and produces a graph where a retried-but-recovered task is indistinguishable from a deferred-but-abandoned one. The causal story inverts.

What Was Observed

A three-agent federated workflow: planner (runtime A, schema version `sc.v2`), executor (runtime B, schema version `sc.v1`), auditor (runtime C, schema version `sc.v2`). The correlator was configured to join on `agent.task.status` to build the "task outcome propagation" view.

Runtime B had been rolled back two days earlier and still emitted `sc.v1` status values. The correlator's schema registry had a `sc.v2` entry only; on encountering an unknown value it fell back to a *fuzzy enum matcher* that used embedding distance to map the incoming value to the nearest known `sc.v2` value.

Trace of the failure:

  1. Executor B emits span `tool.call` with `agent.task.status = "retry"` (meaning: transient failure, will re-dispatch — in `sc.v1` this is a *terminal-per-attempt* state that the executor's own retry loop handles).
  2. Correlator's fuzzy matcher maps `"retry"` to nearest `sc.v2` value `"deferred"` (embedding distance 0.31, below the 0.4 threshold).
  3. In `sc.v2`, `"deferred"` means *the task was handed to a human queue and the agent will not retry*. The correlator therefore closes the causal branch: it does not expect a subsequent `tool.call` span for the same `task_id`.
  4. Executor B, per its own `sc.v1` semantics, re-dispatches and emits a second `tool.call` span with the same `task_id` and a new `span_id`.
  5. The correlator sees an *orphan* second attempt with no expected predecessor and drops it as a duplicate (dedup rule: same `task_id`, later timestamp, predecessor branch closed).
  6. The auditor C, which reads the correlated graph, sees a single attempt that was `deferred` and never completed — and flags the workflow as *stalled, awaiting human*.

Result: the workflow was actually *completed on the second attempt*. The auditor's verdict was wrong by exactly the semantic-convention gap between `retry` (v1) and `deferred` (v2), amplified by the dedup rule that treated the successful retry as a duplicate.

The non-obvious part: the correlator's fuzzy matcher had a *lower* error rate on synthetic benchmarks than strict matching (because it tolerated typos and minor version skew), which is why it was enabled. It failed here not on a typo but on a *legitimate value in a different enum* that happened to sit near a semantically incompatible value in the other enum.

Condition of Validity

The correlator's join is valid only when all of the following hold simultaneously:

  1. **Enum-domain identity.** For every joined attribute, the set of admissible values is byte-identical across all emitting instances, *or* the correlator holds an explicit, versioned translation table (`sc.v1 → sc.v2`) that is total over the observed value domain — not an embedding-similarity fallback.
  2. **Translation totality is checked, not assumed.** The translation table must be verified to cover every value the peer can emit. A partial table with a fuzzy fallback is *not* a valid translation; it is a silent misclassification channel.
  3. **Cardinality preservation.** The translation must be injective on the attributes used for causal branching. If two distinct source values (`retry`, `error`) map to one target value (`failed`), the correlator loses the ability to distinguish "will re-dispatch" from "will not," and any downstream dedup or branch-closure rule built on that distinction is unsound.
  4. **Version is an attribute, not an assumption.** The emitting schema version must be carried on the span (e.g. `sc.version = "v1"`) so the correlator can select the translation table deterministically. Inferring version from value shape is itself a fuzzy match and reintroduces the failure.

If any of these fails, the correlator must treat the span as *uncorrelatable* and emit a gap marker rather than a guessed edge. A gap marker is operationally honest; a guessed edge is operationally poisonous because it looks like data.

Decision Boundary

The boundary is between **tolerant correlation** and **fabricated causality**. Tolerance (fuzzy matching, nearest-enum fallback, shape-based version inference) is appropriate for *non-causal* attributes — display labels, free-text summaries, tags used only for filtering. It is categorically inappropriate for attributes that drive:

The concrete rule: **any attribute referenced by a correlator rule that changes graph topology must be joined by exact enum identity or a total, injective, version-selected translation. If the translation is not total, the correlator must fail closed on that span — mark it uncorrelated — rather than fall back to similarity.** The decision to fail closed is not a performance tradeoff; it is the difference between "we don't know" and "we know something false," and downstream auditors cannot distinguish the latter from truth.

A secondary boundary: the correlator must not use the *presence* of a value as evidence of *semantic agreement*. Two agents emitting `agent.task.status = "ok"` is not agreement if one's `ok` means "attempt succeeded" and the other's means "task accepted, outcome pending." Same string, different referent. Version-tagging the attribute is the only reliable disambiguator.

Operational Effect

When the invariant holds, federated trace correlation produces a causal graph whose edges are defensible: every branch closure is backed by an enum value whose meaning is fixed by a versioned table, and every dedup decision is backed by a distinction the source schema actually makes. Auditors reading the graph can trust that "deferred" means deferred.

When it is violated, the failure mode is *silent causal inversion*: the graph is structurally valid, renders cleanly, passes schema validation, and is wrong. The wrongness concentrates in exactly the decisions that matter — retry-vs-abandon, duplicate-vs-second-attempt, recovered-vs-stalled — because those are the decisions that depend on enum distinctions, which are precisely what fuzzy matching erases. The blast radius is the auditor's verdict, which is the thing the federation was built to produce.

The guardrail that bounds it: **fail-closed correlation with explicit gap markers, version-tagged attributes, and total injective translation tables selected by version — never by similarity.** A correlator that emits "I could not correlate this span" is strictly more useful than one that emits a confident wrong edge, because the former is recoverable by a human or a replay and the latter is not.

from dataclasses import dataclass
from typing import Mapping, Optional

class UncorrelatableSpanError(RuntimeError):
    """Raised when a span's semantic-convention version cannot be safely
    translated into the correlator's schema for a topology-affecting attribute."""
    pass

@dataclass(frozen=True)
class Span:
    trace_id: str
    span_id: str
    task_id: str
    sc_version: str
    status: str

# Total, injective translations per source version. No fuzzy fallback.
TRANSLATIONS: Mapping[str, Mapping[str, str]] = {
    "v2": {"success": "success", "failed": "failed", "deferred": "deferred", "partial": "partial"},
    "v1": {"ok": "success", "error": "failed", "retry": "retry_pending"},  # distinct target, not "deferred"
}

TOPOLOGY_ATTRS = {"status"}

def correlate_status(span: Span, target_version: str = "v2") -> str:
    table = TRANSLATIONS.get(span.sc_version)
    if table is None:
        raise UncorrelatableSpanError(
            f"unknown sc_version={span.sc_version!r} on span {span.span_id}; refusing fuzzy match"
        )
    if span.status not in table:
        raise UncorrelatableSpanError(
            f"value {span.status!r} not in total translation for {span.sc_version!r}; "
            f"refusing similarity fallback for topology attribute 'status'"
        )
    translated = table[span.status]
    # Injectivity check: no two source values may collapse to one target for topology attrs.
    collisions = [k for k, v in table.items() if v == translated and k != span.status]
    if collisions:
        raise UncorrelatableSpanError(
            f"non-injective translation: {span.status!r} collides with {collisions} -> {translated!r}"
        )
    return translated

def build_edge(parent: Span, child: Span) -> Optional[tuple[str, str]]:
    try:
        p = correlate_status(parent)
        c = correlate_status(child)
    except UncorrelatableSpanError:
        return None  # emit gap marker upstream; do not fabricate an edge
    return (p, c)