# What happens when an instance reports a latency SLO breach that no single span in the agent graph owns **Date of Record:** 2026 November 29 **Scope:** Applies to multi-agent graphs instrumented with per-span telemetry (span start/end, token counts, safety classifier verdicts) where end-to-end SLOs are aggregated across parent/child agent invocations. Does not apply to single-agent, single-span deployments where the request span is also the SLO unit. ## Core Distinction A latency SLO is a property of the *request*, not of any span. But telemetry is emitted per span, and each span's duration is a *local* measurement taken by the process that owns it. In an agent graph, the wall-clock cost of one request is the sum of sequential child spans plus the cost of the *gaps* between them—scheduler delay, queueing at the orchestrator, retry backoff, and the time an LLM spent inside a tool-call round-trip that no span encloses. The non-obvious failure is that the SLO breach is real and attributable to the graph, yet every span in the graph reports a duration comfortably under its per-span threshold. The breach lives entirely in the inter-span gaps, which are unowned. The distinction that matters operationally: **per-span SLOs measure work; end-to-end SLOs measure elapsed time. The difference between them is the orchestration overhead, and that overhead has no emitting process.** When you correlate telemetry across the graph and find the request at p99 = 41s while every span sums to 9s, you are not looking at a measurement error. You are looking at 32 seconds of unobserved state transition. ## What Was Observed A three-tier graph: orchestrator agent → planner agent → executor agent, with the executor calling two tools and one retrieval sub-agent. Spans were emitted for each agent invocation and each tool call, with `parent_span_id` linking them. The end-to-end SLO was p95 ≤ 20s, measured at the ingress span. During a load test at 40 concurrent requests, the ingress span reported p95 = 34s and p99 = 41s—a clear SLO breach. Correlating child spans by `trace_id` and summing their durations gave a p95 of 8.9s. The gap was not distributed uniformly. It concentrated at exactly one edge: the transition from the orchestrator's span-end to the planner's span-start. That gap had a p95 of 22s and a p99 of 31s. The cause was a bounded worker pool in the orchestrator's dispatch layer. Each planner invocation was submitted to a pool of 8 workers. At 40 concurrent requests, with each request occupying a worker for the planner's ~4s duration, the queue depth at the dispatch boundary grew to ~5 requests deep, adding ~20s of *wait* that was never inside any span. The orchestrator's own span had already ended (it emitted its end event after submitting the dispatch, not after the planner returned), so the wait was attributed to nothing. Worse: the safety-metric telemetry told a contradictory story. The safety classifier ran inside the executor span and reported 100% of requests classified within the executor's own SLO. Because the classifier's span was healthy, the safety dashboard showed green while the request-level latency SLO was red. The two telemetry planes were correlated by `trace_id` but not by *causal accounting*, so the safety plane could not see that its inputs were arriving 22s late. ## Condition of Validity The gap-accounting failure is valid (and the SLO breach is genuinely unowned) only when all of the following hold: 1. **Span end is emitted at handoff, not at completion.** If a parent span closes before its child is dispatched or before the child returns, the dispatch/return wait is outside every span. This is the trigger condition. Instrumentation that closes the parent span only after the child's result is joined does not exhibit the failure—it just attributes the wait to the parent, which is at least visible. 2. **The queueing point is a bounded resource with no span of its own.** A worker pool, a semaphore, a rate limiter, or a retry backoff loop. Unbounded dispatch (fire-and-forget with no admission control) converts the failure into a different one: unbounded latency with no queue to blame. 3. **The SLO is computed on the ingress span's wall-clock duration, not on the sum of child spans.** If the SLO aggregator sums spans, it will report the request as healthy and the breach will be invisible—which is arguably worse, because the customer experiences 41s and the dashboard says 9s. 4. **Safety and latency telemetry are joined only by `trace_id`.** If the safety plane's timestamps are compared against the latency plane's span boundaries, the skew is detectable. If they are joined only by trace identity, the safety plane inherits the latency plane's blind spot. When any of these fails, the breach is either visible in a span or not a breach at all. The failure mode is specific to the conjunction. ## Decision Boundary The architectural invariant required to bound this is: **every interval of wall-clock time between ingress and egress must be enclosed by at least one span, and the sum of top-level child span durations plus inter-span gaps must equal the ingress duration within a tolerance.** This is a conservation law, not a monitoring nicety. It can be enforced at three points: - **Emit a dispatch span.** Wrap the queue admission and the worker pickup in an explicit span (`dispatch.wait`, `dispatch.run`). This converts the gap into an owned span and makes the queue depth visible as a first-class metric. Cost: one extra span per handoff, roughly 3–5% span volume increase. - **Compute a gap residual at trace assembly.** For each parent, `residual = parent.duration - sum(child.duration) - sum(known_gaps)`. If residual exceeds a threshold (say 500ms or 5% of parent duration), emit a synthetic `unaccounted_gap` span with the residual duration and the parent's ID. This is the cheap version: no extra instrumentation at the source, but it localizes the gap to the parent that owns it. - **Clock-skew guard.** Spans from different processes have different clocks. A child span that starts *before* its parent ends (per wall-clock timestamps) will produce a negative residual. Clamp residuals to zero and flag negative residuals as a skew event—otherwise the conservation check silently passes on skewed traces. The decision boundary for *which* to use: if the dispatch point is under your control and the handoff rate is below ~10k/s, emit the dispatch span (full fidelity). If the handoff is inside a third-party runtime or the rate is high enough that span volume is a cost concern, use the residual computation at trace assembly (partial fidelity, but bounded and cheap). Do not rely on per-span SLOs alone to catch this—they are structurally incapable of seeing the gap. ## Operational Effect The practical consequence is that an agent graph can be simultaneously **green on every per-span SLO and red on the request-level SLO**, and the red is correct. Operators who trust the per-span dashboards will conclude the system is healthy and look for the breach in the wrong place—typically in the slowest span, which is the executor at 6s, well under its 10s threshold. The actual cost is in the dispatch queue, which has no dashboard because it has no span. The second-order effect is on safety telemetry. Because the safety classifier's verdict is timestamped at classification time (inside the executor span) and the latency SLO is timestamped at ingress, the two planes disagree about *when* the request was "in the system." A safety metric that reports "100% classified within SLO" is measuring the classifier's own latency, not the request's exposure window. If a request sat in the dispatch queue for 22s before reaching the classifier, the classifier was fast and the request was slow—and the safety plane cannot see the difference. The invariant that fixes this is the same conservation law applied to the safety plane: **the safety verdict must carry the ingress timestamp, not just the classification timestamp**, so that exposure time (ingress → verdict) is computable and comparable across planes. The residual-gap check is the minimum viable guardrail. It costs one pass over the assembled trace, catches the unowned interval within one aggregation window, and produces an actionable artifact (the synthetic gap span) that points at the parent whose handoff is leaking time. Without it, the breach is real, the cause is structural, and the telemetry is unanimous in the wrong direction. ```python import time from dataclasses import dataclass, field from typing import Optional class UnaccountedGapError(RuntimeError): """Raised when a trace's span durations do not conserve ingress wall-clock time.""" pass @dataclass class Span: span_id: str parent_id: Optional[str] start: float # wall-clock seconds end: float # wall-clock seconds kind: str # "ingress" | "agent" | "tool" | "dispatch" | "synthetic_gap" @property def duration(self) -> float: return self.end - self.start @dataclass class Trace: trace_id: str spans: list = field(default_factory=list) def ingress(self) -> Span: candidates = [s for s in self.spans if s.kind == "ingress"] if len(candidates) != 1: raise UnaccountedGapError( f"trace {self.trace_id}: expected exactly one ingress span, found {len(candidates)}" ) return candidates[0] def children_of(self, parent: Span) -> list: return [s for s in self.spans if s.parent_id == parent.span_id] def check_conservation(trace: Trace, tolerance_s: float = 0.5) -> list: """ Enforce: ingress.duration == sum(top-level children) + unaccounted residual. Returns synthetic gap spans for every parent whose residual exceeds tolerance. Raises UnaccountedGapError on clock skew (negative residual) or missing ingress. """ ingress = trace.ingress() gaps = [] for parent in trace.spans: children = trace.children_of(parent) if not children: continue child_sum = sum(c.duration for c in children) residual = parent.duration - child_sum if residual < -tolerance_s: # Child starts before parent ends (per wall clock): skew, not a gap. raise UnaccountedGapError( f"trace {trace.trace_id} span {parent.span_id}: negative residual " f"{residual:.3f}s indicates cross-process clock skew; " f"conservation check cannot be trusted" ) if residual > tolerance_s: gaps.append(Span( span_id=f"{parent.span_id}.gap", parent_id=parent.span_id, start=parent.end - residual, end=parent.end, kind="synthetic_gap", )) total_children = sum(s.duration for s in trace.children_of(ingress)) total_gap = sum(g.duration for g in gaps) if abs((total_children + total_gap) - ingress.duration) > tolerance_s: raise UnaccountedGapError( f"trace {trace.trace_id}: conservation violated at ingress — " f"ingress={ingress.duration:.3f}s children={total_children:.3f}s " f"gaps={total_gap:.3f}s" ) return gaps def classify_slo(trace: Trace, slo_s: float, gaps: list) -> dict: """Per-span SLO verdicts plus an explicit unowned-gap verdict.""" breaches = [s.span_id for s in trace.spans if s.kind != "ingress" and s.duration > slo_s] unowned = sum(g.duration for g in gaps) return { "trace_id": trace.trace_id, "ingress_duration": trace.ingress().duration, "per_span_breaches": breaches, "unowned_gap_s": unowned, "verdict": ( "BREACH_UNOWNED" if unowned > slo_s and not breaches else "BREACH_ATTRIBUTED" if breaches else "OK" ), } ```