Repository navigation
fix(replay): Backfill release, environment and SDK for replays from the previous run - #6253
Merged
Merged
Conversation
…he previous run Co-Authored-By: Roman Zavarnitsyn <roman.zavarnitsyn@sentry.io> Co-Authored-By: George Gritsouk <george.gritsouk@sentry.io>
📲 Install BuildsAndroid
|
romtsn
marked this pull request as ready for review
October 14, 2026 10:50
romtsn
requested review from
0xadam-brown,
adinauer,
markushi,
romtsn and
runningcode
as code owners
October 14, 2026 10:50
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f53c2e0. Configure here.
… backfill Co-Authored-By: roman <roman.zavarnitsyn@sentry.io> Co-Authored-By: George Gritsouk <george.gritsouk@sentry.io>
…previous-run backfill Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
0xadam-brown
approved these changes
Oct 14, 2026
0xadam-brown
left a comment
Member
There was a problem hiding this comment.
A few quick comments for your consideration, but no blockers 👍
3 tasks done
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.

📜 Description
When the SDK starts,
ReplayIntegration.finalizePreviousReplay()sends the last cached segment of the previous run's replay usingPreviousReplayHint, which isBackfillable. Because of that hint,MainEventProcessorintentionally skips release, environment, dist and SDK, since the current run's values may not describe the earlier one. Nothing filled them in afterwards (there was a TODO for this), so these segments went out with nosdk,releaseorenvironment.This change reads those values from the options persisted by
PersistingOptionsObserverand sets them on the replay event before it is captured. The integration registers beforeSentry.initrunsnotifyOptionsObservers, and both use the single-threaded SDK executor, so the persisted values still belong to the run that recorded the replay. If no SDK version was persisted, it falls back to the currentoptions.sdkVersion, because the SDK name stays the same between runs and a replay with no SDK info is worse than one with a slightly newer version.Persisted scope values (user, tags, contexts) are still not backfilled; I left a TODO for that.
💡 Motivation and Context
On the Sentry side, a replay gets its SDK name from any of its segments. A replay whose only segment came through this path (e.g. buffer mode, app killed or crashed, replay flushed on next launch) has no
sdk.name,releaseorenvironmentat all. The replay details page then can't tell which mobile platform's docs to link to and reportsUnknown mobile platform in configure card: null. We could reproduce this with single-segment buffer replays from an internal Android project.💚 How did you test it?
Added unit tests in
ReplayIntegrationTestcovering both the persisted-options backfill and the SDK version fallback. Both tests fail without the fix.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Backfill persisted scope values (user, tags, contexts) for previous-run replays.
via roman.
--
View Junior Session [Sentry]