Skip to content

Keep blob share exports alive for async consumers - #3725

Open
githubdoramon wants to merge 3 commits into
Mentra-Community:devfrom
githubdoramon:codex/persist-blob-share-exports
Open

Keep blob share exports alive for async consumers#3725
githubdoramon wants to merge 3 commits into
Mentra-Community:devfrom
githubdoramon:codex/persist-blob-share-exports

Conversation

@githubdoramon

@githubdoramon githubdoramon commented Aug 20, 2026

Copy link
Copy Markdown

The share flow created temporary blobs and removed them as soon as the share action returned. However, the action can return immediately after delivery to the destination app, before that app has consumed the blob. This prevented successful audio exports from the Recorder miniapp: Gmail failed to attach files, and WhatsApp sent corrupted audio files.

Now, renamed blob-share files persist under document storage, failed shares are cleaned up immediately, and successful exports are pruned after one hour. Added retention-policy regression coverage.


Note

Medium Risk
Changes when user blob copies are deleted after sharing; leftover cache files persist for an hour and pruning depends on timestamped directory names. Not auth-critical, but incorrect cleanup can still drop in-flight shares or leave user content on disk.

Overview
Stops deleting OS share-sheet copies as soon as Share.open returns, which was racing recipient apps (Gmail attachments, WhatsApp audio) that still needed the file.

After the chooser is shown, copies under mentra_blob_share stay in cache for 1 hour. Immediate delete happens only if the handoff never started. pruneShareExports runs before each share and skips in-flight IDs in activeShareIds.

Reviewed by Cursor Bugbot for commit 781db42. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Keeps blob share exports available long enough for recipient apps to finish async reads, fixing Recorder exports that failed to attach in Gmail and produced corrupted audio in WhatsApp. Previously we deleted temp copies when Share.open returned; now we retain post-handoff copies for up to one hour and prune them later.

  • Persist per-share copies under mentra_blob_share/<id>/<filename> in the app cache on iOS and Android; track active share IDs so pruning never deletes in-flight handoffs.
  • Before each share, pruneShareExports removes expired exports (1h); prune and cleanup failures log warnings but do not block sharing.
  • On cancel or error after the chooser opens, return the result but keep the export; delete immediately only if the handoff never started.
  • Android: roll back share export location to Paths.cache.

Written for commit 781db42. Summary will update on new commits.

Review in cubic

@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 using default effort 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.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9c09715. Configure here.

Comment thread mobile/modules/engine/src/services/BlobStore.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread mobile/modules/engine/src/services/BlobStore.ts Outdated
Comment thread mobile/modules/engine/src/services/BlobStore.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread mobile/modules/engine/src/services/BlobStore.ts Outdated
@githubdoramon
githubdoramon force-pushed the codex/persist-blob-share-exports branch from cbe3ef0 to 3249003 Compare August 20, 2026 15:28
@githubdoramon githubdoramon changed the title Keep blob share exports alive for async consumers [WIP] - Keep blob share exports alive for async consumers Aug 20, 2026
@githubdoramon githubdoramon reopened this Aug 20, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread mobile/modules/engine/src/services/BlobStore.ts Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@githubdoramon githubdoramon changed the title [WIP] - Keep blob share exports alive for async consumers Keep blob share exports alive for async consumers Aug 20, 2026
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