You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(core): let the trace context manager mark the run boundary
Detecting the run boundary by reference-identity of the trace context was
a heuristic, and guarding it against the noop manager's fresh `{}` meant
testing the context for emptiness. That traded an unreachable bug for a
reachable one: `traceContext` is `z.record(z.unknown())`, so a run whose
context is empty would stop reminting and silently merge back into the
previous run's trace.
Replace the inference with a fact. `StandardTraceContextManager.traceContext`
becomes an accessor pair that advances an epoch whenever the context is
replaced, which is exactly what starting a run does, so no call site
changes. The noop manager reports a constant epoch, so with no manager
registered there are no boundaries to react to and nothing churns.
Drops the emptiness heuristic entirely, and covers the case it would have
broken. Also renames `get()` to `forCurrentRun()` and the shared instance
to `fallbackTraceId`, since the old name read as a string, and exports the
log wrapper so a test can prove a run's spans and logs stay on one id.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments