fix(replay): Skip client reports for replay failures after stop#22177
Merged
Conversation
Contributor
size-limit report 📦
|
Lms24
approved these changes
Jul 10, 2026
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.
While looking into #22169, I noticed a problem with when/how we capture
internal_sdk_errorclient reports for replays:When a replay stops naturally for whatever reason (e.g. session expired, ...), the buffer worker is destroyed.
If any pending things happen to be in the buffer at this point, when they flush to the main process they will trigger
_addEventwith an error (e.g.Worker destroyed). This would be recorded as a client report withinternal_sdk_error. However, at this point replay was already stopped naturally and no client reports should be recorded for it. To make matters worse, this could lead to multiple client reports being sent at the same time (e.g. if many events are pending at the same time). This can lead to highly skewed replay outcomes.This PR fixes this by skipping outcome generation if the replay is already stopped at this time. I am not 100% sure if this is the only problem in the linked issue but it likely is. There may be other problems with how they start/handle sessions, but that may or may not be an actual problem and is likely separate from this.
Closes #22169