feat: add scope merging mechanism - #1373
Conversation
8f6a8b4 to
e509cb6
Compare
e509cb6 to
5ea0d02
Compare
5ea0d02 to
2905cce
Compare
8b46a73 to
b3bd79f
Compare
b3bd79f to
5ab473f
Compare
5ab473f to
a27e5e5
Compare
a32be8d to
af060b8
Compare
5146682 to
80b661b
Compare
80b661b to
f1ba13c
Compare
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 f1ba13c. Configure here.
2e3f4c5 to
bf26935
Compare
bf26935 to
ec3c9a6
Compare
ec3c9a6 to
503b67b
Compare
| if key == "trace" { | ||
| continue | ||
| } |
There was a problem hiding this comment.
Bug: Manually set trace contexts on the scope are now silently ignored for error events due to an unconditional skip. This breaks error-to-trace linking for users relying on this feature.
Severity: MEDIUM
Suggested Fix
Restore the previous conditional logic in the loop within mergeScope. The check for the trace key should only continue if the event is a transaction. Re-add the && event.Type == transactionType condition to the if statement to allow error events to correctly inherit the trace context from the scope.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: scope.go#L430-L432
Potential issue: The refactoring in `mergeScope` unconditionally skips the `trace`
context from the scope. Previously, this context was only skipped for transaction
events, allowing error events to use a manually set trace context. This was documented
behavior used "to link errors and traces/spans in Sentry." The new implementation
silently ignores any manually set `trace` context on the scope for error events,
breaking this functionality. The automatic trace resolution via `applyTraceToEvent` does
not provide an alternative for this manual use case, resulting in a regression where
error events may no longer be correctly linked to traces if a user was relying on this
manual mechanism.

Description
Issues
Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)