Repository navigation
fix(auto): honour a dropped incoming parent in the zero-code Node agent - #715
Merged
Merged
Conversation
Cover awaited nested-call and explicit parents with and without a previous span. Before the fix, both keep the ended request. The existing cross-language cases also fail in the ordinary Node-only environment because they launch system Python.
Track dropped request lifetimes weakly across package copies. When a helper or explicit parent carries an ended request, restore the previous parent span without replacing its derived context values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an upstream service drops a trace, it still sends
traceparent: 00-<trace>-<span>-00(sampled flag 0). The zero-code Node agent did not honour that non-recording parent. The next AI call in the request started a new root trace, which exported an orphanchatspan under a fresh trace id.Change (
typescript/packages/traceai_auto/src/agent-context.ts)isRecording(). A parent that has really ended is never reused, including from contexts derived from it (withSession, nested call scopes).Tests
integration-call-scope.test.ts: live and ended unsampled incoming requests, derived session contexts, nested cells ending out of order, a dropped request under a live grandparent, and a no-op HTTP tracer on a supplied provider.e2e.test.ts: the default-sampler case runs with an isolated empty config file (test/apps/empty.toml).ratio-cross-language.test.ts: Python to Node dropped and kept traces. It is opt-in withTRACEAI_TEST_PYTHON, so the ordinary job does not need a Python install.@traceai/autosuite: 1,827 passed, 14 skipped. Vercel package: 280/280.All changes are limited to
typescript/packages/traceai_auto/.