Skip to content

feat: add cache keep modes#1707

Open
jpnurmi wants to merge 6 commits intomasterfrom
jpnurmi/feat/cache-keep
Open

feat: add cache keep modes#1707
jpnurmi wants to merge 6 commits intomasterfrom
jpnurmi/feat/cache-keep

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented May 7, 2026

Turn cache_keep into an enum (with backwards compatible values; false=0, true=1):

  1. SENTRY_CACHE_KEEP_NONE (false): Do not keep envelopes in the persistent cache.
  2. SENTRY_CACHE_KEEP_OFFLINE (true): The classic Offline Caching mode. Envelopes that cannot be uploaded immediately are cached. Includes send failures and revoked envelopes.
  3. SENTRY_CACHE_KEEP_ALWAYS: Envelopes are cached regardless of the upload result.

Relates to #1688 but does not fully solve it, as it needs changes in sentry-desktop-crash-reporter, too.

Add enum values for offline and always-on cache modes while keeping the
existing cache_keep setter as the public entry point.

Ensure envelopes kept with SENTRY_CACHE_KEEP_ALWAYS use non-retry cache
filenames so they are not picked up by retry processing.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Comment thread src/sentry_retry.c
jpnurmi and others added 2 commits May 7, 2026 17:42
When HTTP retry re-sends an envelope with attachment refs, the callback pruned
sibling cache files before the retry layer archived keep-always envelopes.
Keep referenced siblings so the cached envelope does not point at missing files.

Co-Authored-By: Codex <noreply@openai.com>
Pass the app http_retry setting to the crash daemon so consent-revoked crash
envelopes are cached in retry format. Keep daemon retry polling disabled and
leave restart-time retries to the app process.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread src/backends/native/sentry_crash_context.h Outdated
Store cache_keep as an int in the crash IPC context like other enum-backed
fields. Cast at the app and daemon boundaries so enum size flags cannot change
the shared-memory layout.

Co-Authored-By: Codex <noreply@openai.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 1 potential issue.

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

Comment thread src/sentry_options.c
Comment thread src/sentry_core.c
@jpnurmi jpnurmi changed the title WIP: feat: add cache keep modes feat: add cache keep modes May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d9d9e51

@jpnurmi jpnurmi requested review from JoshuaMoelans and mujacica May 7, 2026 17:36
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.

1 participant