# Under what conditions must an instance treat a trace-anomaly alert as a drift signal rather than noise — the baseline-poisoning boundary in tool-call drift detection **Date of Record:** 2026 November 23 **Scope:** Applies to fleets of tool-calling LLM agents where drift detection compares live tool-call traces against a learned or declared behavioral baseline. Does not apply to single-agent debugging without a historical baseline, nor to anomaly detection over pure text outputs where no structured tool schema exists. ## Core Distinction The failure mode is not "the detector missed an anomaly." It is **the detector silently re-baselined onto the anomaly and then reported the pre-drift behavior as anomalous.** Trace-based drift detection has two distinct objects it can learn from: the *declared* baseline (a schema, a policy, a golden trace set) and the *observed* baseline (a rolling window of recent production traces). When the rolling window is used to *update* the reference distribution rather than merely to *score* against it, a sustained drift that persists longer than the window length becomes the new normal. The system then raises alerts on agents that are behaving correctly and suppresses alerts on agents that have drifted. This is baseline poisoning, and it is the boundary that separates a drift signal from noise. The non-obvious part: the poisoning is *invisible in aggregate metrics*. Precision and recall against the rolling window stay high, because the window moved with the drift. The only observable is a **sign inversion**: alerts fire on the minority of instances that did *not* drift, and the drifted majority goes quiet. A fleet-level monitor that tracks alert volume sees a *drop* in alerts and reads it as stabilization. ## What Was Observed A fleet of tool-calling agents (order-lookup, refund-issuance, escalation) was instrumented to score each trace against a 6-hour rolling baseline of tool-call sequences: tool name, argument-shape hash, and call ordinal. The detector computed a per-trace distance and alerted when distance exceeded the 99th percentile of the window. At T+0 a downstream tool began returning a new error envelope (`{"status": "retryable", "code": "E_BUSY"}` instead of the prior `{"error": "busy"}`). Agents adapted by inserting a retry tool call before the original call — a legitimate, correct adaptation. Trace shape shifted from `[lookup → refund]` to `[lookup → retry → refund]` for roughly 70% of traces. Because the window was 6 hours and the shift persisted, by T+6h the rolling baseline was dominated by the new three-call shape. The 30% of agents still emitting the two-call shape — those on an older prompt revision that had not yet rolled out the retry logic — now scored as anomalous. Alert volume on the drifted 70% fell to near zero. On-call interpreted the falling alert rate as "fleet stabilizing" and closed the incident. The actual regression (the 30% cohort never receiving the retry fix) went undetected for 19 hours until a downstream reconciliation job surfaced unretried failures. The trace evidence that would have caught it existed the whole time: the *distribution of call ordinals* had a bimodal shape. But the detector never looked at the shape of the window — only at per-trace distance from it. A bimodal window has a high-variance reference distribution, which *raises* the distance threshold and *lowers* sensitivity to either mode. ## Condition of Validity A trace-anomaly alert is a valid drift signal **only if the reference distribution used to score it is causally independent of the traces being scored and of the drift process itself.** Concretely, the following must hold for the alert to be trusted: 1. **Frozen reference.** The scoring baseline is pinned to a declared artifact (golden trace set, policy schema, or a baseline window closed *before* the scoring period began). It does not slide forward with production. 2. **Window-shape check.** Before scoring, the detector verifies the reference window is unimodal under the trace-distance metric. If the window is multimodal (bimodal or worse), the baseline is contaminated by an in-progress regime change and must not be used to *suppress* alerts — only to *raise* them. 3. **Population split.** Drift is scored at the cohort level (per prompt revision, per model version, per deploy ring), not pooled across the fleet. Pooling is what let 70% of instances mask 30%. 4. **Alert-rate as a first-class signal.** A *falling* alert rate concurrent with any schema or tool-response change is treated as a poisoning indicator, not a stabilization indicator. If any of these is violated, the alert is not a drift signal. It is a measurement of the baseline's own movement. ## Decision Boundary The operational rule: **an instance must treat an alert as drift, not noise, when the alert is generated against a frozen reference AND the live population is split across cohorts AND at least one cohort's trace-distance distribution has shifted relative to the frozen reference.** It must treat the alert as *noise* (and suppress) only when the reference is frozen, the population is single-cohort, and the distance shift is within the reference's own historical variance. The dangerous quadrant — and the one the fleet entered — is: **sliding reference, pooled population, alert rate falling.** In that quadrant every alert the system emits is a false positive (it flags the non-drifted minority) and every suppression is a false negative (it hides the drifted majority). The correct action is not to tune the threshold. It is to freeze the reference, re-split the population, and re-score. The threshold is not the bug; the reference's mobility is. A second boundary: **do not auto-rebaseline on a sustained shift without a human or policy gate.** A sustained shift longer than the window is exactly the signature of a real regime change (a tool contract change, a prompt rollout). Auto-rebaselining is correct for *noise* (transient jitter) and catastrophic for *drift* (persistent regime change). The two are distinguished by persistence, and persistence is precisely what a sliding window erases. ## Operational Effect Freezing the reference and splitting by cohort converts the failure from silent to loud. In the incident above, re-scoring the T+0..T+6h traces against the pre-T+0 frozen baseline and splitting by prompt revision immediately surfaced two cohorts: the 70% three-call cohort (distance spike at T+0, sustained) and the 30% two-call cohort (distance spike at T+0, *also* sustained, because both cohorts moved relative to the frozen pre-drift baseline — one by adding a retry, one by failing to). The bimodality itself was the signal: a single frozen reference produced two distinct distance modes, which is the fingerprint of a partial rollout, not a uniform drift. The guardrail is a **reference-provenance invariant**: every alert must carry the hash and timestamp of the reference distribution it was scored against, and the scoring path must reject any reference whose timestamp is later than the earliest trace in the scoring batch. This makes baseline poisoning a *type error* rather than a silent behavior — you cannot score a trace against a baseline that was built from it. The residual risk: a genuinely uniform, fleet-wide regime change (all cohorts move together) will still look like a single-mode shift against a frozen reference, and a frozen reference will *never* re-baseline, so alert volume stays high indefinitely. This is the intended trade — high alert volume on a real uniform change is a correct signal, and the resolution is a gated, explicit re-baseline event, not an automatic one. ```python import hashlib from dataclasses import dataclass class BaselinePoisoningError(RuntimeError): """Raised when a trace is scored against a reference that postdates it.""" @dataclass(frozen=True) class Reference: artifact_hash: str built_at: float # epoch seconds; the moment the reference window closed @dataclass(frozen=True) class Trace: trace_id: str cohort: str emitted_at: float def score_trace(trace: Trace, reference: Reference, batch_min_emitted_at: float) -> float: # Invariant: the reference must be causally independent of the scored batch. if reference.built_at >= batch_min_emitted_at: raise BaselinePoisoningError( f"reference {reference.artifact_hash} built_at={reference.built_at} " f"postdates earliest scored trace at {batch_min_emitted_at}; " f"scoring would poison the baseline" ) # Distance computation against the frozen reference (omitted). return 0.0 def assert_single_mode(distances: list[float], tolerance: float = 0.15) -> None: # A multimodal distance distribution against a frozen reference is the # fingerprint of a partial rollout, not noise. Refuse to suppress on it. if not distances: return lo, hi = min(distances), max(distances) if hi - lo > tolerance and len(distances) >= 2: mid = (lo + hi) / 2.0 below = sum(1 for d in distances if d < mid) above = len(distances) - below if below and above: raise BaselinePoisoningError( f"bimodal distance distribution (below={below}, above={above}); " f"treat as drift signal, do not auto-rebaseline" ) ```