feat(weave): send client-capability header on ingest (Python + Node)#7342
Closed
ro31337 wants to merge 1 commit into
Closed
feat(weave): send client-capability header on ingest (Python + Node)#7342ro31337 wants to merge 1 commit into
ro31337 wants to merge 1 commit into
Conversation
Both SDKs now send an X-Weave-Client-Capabilities header on every trace-ingest request, declaring the sampling-relevant capabilities this build guarantees (trace_id on call-end, eval metadata on eval child calls). A future server-side ingest sampler reads it to tell a sampling-safe client from an older one and leave unsupported traffic unsampled. WB-35951
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ro31337
commented
Jun 22, 2026
| # sampling-safe client even on the batch path, which cannot carry a per-trace | ||
| # trace_id header. | ||
| # ============================================================================= | ||
|
|
Contributor
Author
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
JIRA Issue(s)
https://coreweave.atlassian.net/browse/WB-35951
Description
Both the Python and Node SDKs now send an
X-Weave-Client-Capabilitiesheader on every request they make to the Weave trace server. The value is a small comma-separated list of the sampling-relevant capabilities this SDK build guarantees — todaytrace_id_on_end,eval_child_meta, matching the two recent changes that puttrace_idon every call message and tag evaluation child calls with eval metadata.The header is groundwork for a future server-side ingest sampler. To sample the calls model safely the server has to drop whole traces consistently and never shred evaluations, which is only true once a client sends
trace_ideverywhere and marks its eval calls. The server cannot infer that from the data alone — an unmarked call is ambiguous (a normal call, or an eval child from an older client) — so the client states it directly, and the sampler leaves traffic without the header unsampled. Nothing reads the header yet; this mirrors theX-Weave-Trace-Idheader added recently for the same future sampler.Why this approach
A capability list rather than an SDK version keeps the server out of mapping versions to behavior: the Python and Node SDKs version independently, and the relevant behavior landed across several releases. It is advisory, not a gate — a missing or unknown capability just means "don't sample," never a rejected request. It is set once in the shared request-header builder, so it rides every request (it describes the client, not one trace); a future sampler simply reads it on the ingest paths.
Testing
Python: new tests assert the header is present on single-call and on batch upsert requests; the full
trace_server_bindingssuite passes (64). Node: a newclientApitest assertsinit()wires the header onto the trace-server client; the full suite passes (313). The VCR cassette matcher now ignores this header the same way it already ignores the volatileclient_versionbody field, so the recordedlive/cassettes still match. Lint, format and typecheck (cjs + esm) are clean.Backward compatibility
Additive and safe both ways: an older server ignores the unknown header, and an older client simply doesn't send it. The Stainless transport and the one-shot login health check are out of scope, matching the
X-Weave-Trace-Idchange. One follow-up to track: if the Stainless transport later becomes the default, this header andX-Weave-Trace-Idmust be ported to it together, otherwise the sampler would see header-less traffic from the new default client.