feat(weave_ts): link a weave op call to the agent spans it produced - #7711
Open
ro31337 wants to merge 7 commits into
Open
feat(weave_ts): link a weave op call to the agent spans it produced#7711ro31337 wants to merge 7 commits into
ro31337 wants to merge 7 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Aug 10, 2026
ro31337
marked this pull request as ready for review
August 10, 2026 18:39
rgao-coreweave
approved these changes
Aug 11, 2026
rgao-coreweave
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Good to see typescript parity
Stamp the enclosing op call's id and trace id onto every span weave emits inside it, so the parent_call_id and parent_call_trace_id span columns fill in for Node the way they already do for Python. The processor goes in the array genai/provider.ts builds, after the eval link: a span at its attribute limit drops the incoming attribute, so the shipped link writes first and the new one yields.
Flushing the client before reading the calls back left the in-memory server's stabilization waiter with nothing to observe, so every lookup burned its full 1.5s timeout and logged a warning. Read the calls once per test the way the sibling eval test does, keyed by op name. Test file drops from 17s to 4s.
Review pass. The comment in getOrBuildProvider and the AGENTS.md addition go: the branch dropped a comment from that same function two commits ago because the rebuild test states it executably, and the note it extended had its prescription removed for being Python-inverted. The negative test goes too -- five genai files snapshot the whole attribute bag on spans with no op on the stack, which is why this PR needed no snapshot updates. Two tests earned their place instead: a crowded span during an eval keeps the eval pair and drops ours, and a same-project re-init still links, which is the only thing that makes the client getter load-bearing.
…need A valid OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT in the environment made the two crowding tests fail on correct code, since they assumed the default. Set it per test and restore it, the way the suite already handles WANDB_API_KEY. Also restore the AGENTS.md clause, worded so it does not read as the Python order, and sort the eval-attribute assertion so a reorder in the eval linker fails in the eval linker's own file.
Every test read the two names through the constants, so a typo in the literal would have passed the suite even though the server matches on the string. One test now spells them out, the way the eval tests spell theirs. The re-init test no longer hands the second client a processor wrapping the same exporter: that would have kept it green if the provider ever started rebuilding per init, at which point it would prove nothing.
Plus two naming and wording touch-ups: the expected array is a list of classes like the helper that reads it, the constants JSDoc no longer reads as if the server imported the Python module, and the AGENTS.md note now states the outcome of registering the linkers in opposite order.
ro31337
force-pushed
the
roman/WB-38448-ts-parent-call-linkage
branch
from
August 11, 2026 18:16
f4c5e8b to
6ebb726
Compare
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.
Three PRs, in review order:
JIRA Issue(s)
https://coreweave.atlassian.net/browse/WB-38448
Description
A weave op call and the agent spans it produces share no field, so you cannot ask which spans a call produced. #7704 added that link in Python. This does the same in Node: a span processor writes the enclosing call's id and trace id onto each span as it starts. The attribute names are Python's, so the server needs no change.
Why this approach
The processor goes into the
spanProcessorsarraygenai/provider.tsbuilds. That array is the only path weave's spans take, and it is rebuilt on a project switch, so registering frominit()would miss it. That same indirection is what hid the eval bug #7708 fixes.Two orderings are the reverse of Python's, because OTel JS drops the incoming attribute on a full span where Python drops the oldest: call id before trace id, and this processor after the eval one. Both have a test.
Coverage
This covers the spans weave emits through its own provider, not every span in the process. Node keeps its own so that a user's provider cannot take weave's over. The call stack is an
AsyncLocalStorage: a worker thread gets no link, and a span emitted while a streaming op's result is consumed links to the consuming op, an existingop.tsgap. Existing spans stay empty.Testing
The tests run an op, emit a real span and read the exported span, so a processor that is never reached cannot pass them. They cover nested ops,
runIsolated, a re-init and both orderings, and the fullsdks/nodesuite (510 tests), eslint, prettier and both typechecks are green.Merge order
Stacked on #7708, and the link only becomes visible once #7704 adds the columns.