Skip to content

feat!: add support for crash-time attachments via hint - #2112

Draft
jpnurmi wants to merge 1 commit into
jpnurmi/feat/hintsfrom
jpnurmi/feat/crash-hints
Draft

jpnurmi wants to merge 1 commit into
jpnurmi/feat/hintsfrom
jpnurmi/feat/crash-hints

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Merge attachments and pass as hint to on_crash, then use the resulting hint attachments in the envelope.

Caution

BREAKING CHANGE: on_crash callbacks now have an additional sentry_hint_t *hint parameter.

Close: #2098

@jpnurmi
jpnurmi added this pull request to stack #2113 September 18, 2026 16:49
@jpnurmi
jpnurmi marked this pull request as draft September 18, 2026 16:49
@github-actions

Copy link
Copy Markdown
Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- add support for crash-time attachments via hint ([#2112](https://github.com/getsentry/sentry-native/pull/2112))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against d30860a

@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 3 potential issues.

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 d30860a. Configure here.

if (should_dump) {
if (!sentry_value_is_frozen(hint.attachments)) {
write_attachment_manifest(state, hint.attachments);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Crashpad ignores crash-time hint attachments

High Severity

Crashpad writes a __sentry-attachments manifest after on_crash/before_send but never registers or unregisters those files with the crashpad client. Crashpad only uploads attachments added via AddAttachment or the startup list, so hint changes never reach the minidump upload: new attachments are dropped and cleared ones still ship.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d30860a. Configure here.

// Manifest writes must continue post-crash so attachments registered
// from on_crash/before_send reach the daemon
native_backend_write_attachments(state->event_path);
native_backend_write_attachments(state->event_path, NULL);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Scope flush overwrites crash hint attachments

Medium Severity

native_backend_flush_scope still writes the scope attachment list after a crash, even though native_backend_except already wrote the hint list. A later flush replaces that crash-time manifest with scope attachments, dropping hint-only files and restoring ones the callback cleared.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d30860a. Configure here.

sentry__hint_set_attachments(
&hint, sentry__merge_attachments(hint.attachments, NULL));
event = sentry__before_send(options, event, &hint);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recursive crash invokes before_send again

Medium Severity

The inproc handler used to skip before_send when skip_hooks was set for a recursive crash. The split now calls sentry__before_send whenever on_crash is unset, so a crash inside before_send can re-enter that callback.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d30860a. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: hints

1 participant