Keep blob share exports alive for async consumers - #3725
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
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
cbe3ef0 to
3249003
Compare
There was a problem hiding this comment.
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
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

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.openreturns, which was racing recipient apps (Gmail attachments, WhatsApp audio) that still needed the file.After the chooser is shown, copies under
mentra_blob_sharestay in cache for 1 hour. Immediate delete happens only if the handoff never started.pruneShareExportsruns before each share and skips in-flight IDs inactiveShareIds.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.openreturned; now we retain post-handoff copies for up to one hour and prune them later.mentra_blob_share/<id>/<filename>in the app cache on iOS and Android; track active share IDs so pruning never deletes in-flight handoffs.pruneShareExportsremoves expired exports (1h); prune and cleanup failures log warnings but do not block sharing.Paths.cache.Written for commit 781db42. Summary will update on new commits.