Skip to content

fix(provider): keep bounded provider error summaries in telemetry - #1699

Merged
dcramer merged 3 commits into
mainfrom
fix/provider-error-summary-telemetry
Aug 26, 2026
Merged

fix(provider): keep bounded provider error summaries in telemetry#1699
dcramer merged 3 commits into
mainfrom
fix/provider-error-summary-telemetry

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

JUNIOR-8T showed ProviderError: AI provider error: network after AI Gateway returned HTTP 200 and the model stream failed. Junior already classified and retried correctly, but terminal Sentry events and retry logs dropped the provider cause text. That left the spike looking like a generic network outage with no way to tell stream-incomplete wording from a true transport failure.

#1697 improved transcript failure codes and app.ai.failure_reason. That names the lifecycle class. It still does not keep a safe provider cause string on the provider-error path.

This keeps a short, redacted provider summary on the paths that matter:

  • app.ai.provider_error.summary on terminal provider-error captures
  • the same fields on agent.turn.provider.retrying, plus app.ai.provider_error.retry_attempt
  • gen_ai.chat span attributes/status when stopReason=error

Gateway JSON bodies are stripped so telemetry stays free of raw provider payloads. User-facing copy is unchanged.

This does not stop upstream stream failures. It makes the next JUNIOR-8T-style spike attributable, including the one-conversation prompt/history hypothesis.

Evidence: https://sentry.sentry.io/issues/7692564933/

Requested by David Cramer.

--

View Junior Session [Sentry]

JUNIOR-8T collapsed stream failures to AI provider error: network with no
safe cause text, so gateway HTTP 200 + stopReason error spikes were hard
to attribute. Attach a redacted summary on terminal, retry, and chat-span
telemetry without raw provider payloads.

Co-Authored-By: David Cramer <david@sentry.io>

Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 26, 2026 2:51am

Request Review

Use low-cardinality error.type from ProviderError.kind, keep a bounded
status description, and drop the oxlint character-class escape warning.

Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer marked this pull request as ready for review August 26, 2026 02:43
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2c1b311. Configure here.

Comment thread packages/junior/src/chat/services/provider-error.ts
Drop the retry-attributes wrapper and public summarizer export. Keep one
bounded summary path through getProviderErrorAttributes, reuse the already
classified ProviderError on retries, and avoid double createProviderError
on chat spans.

Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer merged commit d0e5117 into main Aug 26, 2026
41 of 42 checks passed
@dcramer
dcramer deleted the fix/provider-error-summary-telemetry branch August 26, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant