Repository navigation
fix(spans): Don't drop segments when title generation fails - #129084
Open
enochtangg wants to merge 2 commits into
Open
enochtangg wants to merge 2 commits into
enochtangg wants to merge 2 commits into
Conversation
`spawn_conversation_title_generation` runs inside `process_segment`, and nothing caught its errors. When queuing the title task failed (for example `UnicodeEncodeError` on a message with a split emoji), the whole `process_segment` task failed and every span in the segment was dropped. Titles are optional, so catch and log the error and keep processing the segment. Fixes SENTRY-5SB5 Refs STREAM-1999 Co-Authored-By: Claude <noreply@anthropic.com>
mjq
approved these changes
Oct 29, 2026
This branch has not been 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.
When queuing the AI conversation title task fails,
process_segmentfails too, and every span in that segment is dropped. This wraps the title generation call in a try/except so a failure there only skips the title.The error we're seeing is SENTRY-5SB5:
UnicodeEncodeError: surrogates not allowed. Although infrequent, some AI messages end up with an emoji stored as two separate surrogate characters, and msgpack can't encode that when the title task is queued. The task fails with no retry, and the segment is lost.logger.exceptionstill sends an event, so failures stay visible under a new issue.