fix(telemetry): Keep gen_ai spans and maxTokens headroom on failure - #525
Draft
sentry-junior[bot] wants to merge 3 commits into
Draft
sentry-junior[bot] wants to merge 3 commits into
sentry-junior[bot] wants to merge 3 commits into
Conversation
Truncate oversized GenAI span attributes to Sentry's message budget so analyze-mode transactions stop dropping their skill/model tree. Cap Pi catalog maxTokens with observed-input headroom, tag action mode on the root span, record request max_tokens before provider calls, and flush after analyze triggers. Co-Authored-By: Greg Pstrucha <greg.pstrucha@sentry.io>
oxlint consistent-type-definitions requires interface for object shapes.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Multi-part assistant turns with large tool_call payloads could still exceed the 20KB GenAI attribute budget after only truncating parts[0].text. Drop trailing parts until the empty envelope fits, then hard-fallback to a placeholder if needed.
This branch was successfully deployed
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.
Fixes two related gaps from the WARDEN-Y / junior#1724 investigate path.
Why traces/conversations were missing
input + max_tokens > contextfailures also never recordedgen_ai.request.max_tokensbefore the provider rejected, so traces couldn't show the budget math.What changed
gen_ai.input/output/system(+ tool arg/result) payloads to Sentry's GenAI message byte budget, with truncation metadata.maxTokenswith 96k input headroom rooted in observed WARDEN-Y failing prompts (~51–80k) + undercount pad — not a flat 128k generation ceiling. Sonnet/GPT-shaped catalogs unchanged.gen_ai.request.max_tokens/context_windowon the invoke span before the provider call.warden.action.modeso analyze vs report traces are distinguishable.Not in this PR
Checks
vitestotel + pi-model-tokens + pi + runner: 52 passedRequested by greg.pstrucha.
--
View Junior Session [Sentry]