Protect recordings from empty captures and stale deletions
Discard only confirmed empty scheduled desktop audio. Preserve unseen recording and note content across synced deletions while keeping intentional deletion and mobile recording behavior intact.
[!NOTE]
High Risk
Changes E2EE session deletion and restoration semantics plus automatic local audio removal; incorrect guards or reconciliation could delete valid recordings or resurrect or drop synced session data.
Overview
Scheduled desktop captures can now be dropped when they turn out to be empty: auto-starts are tagged as automatic, lifecycle markers remember pre-recording audio state and the initial title, and on stop the app runs discardEmptyAutomaticCapture before cataloging audio or batch work. That path uses a new audio_has_speech fs-sync command (VAD in fs-sync-core) and only deletes local audio when speech is confidently absent and the note is still unchanged, empty, and unattached; manual starts stay manual even if a scheduled waiter exists.
Synced session deletions gain observation-based reconciliation so notes are not lost to tombstones the deleter never saw. Migrations add content_version on documents/transcripts, deletion_context on sessions, a session_content_observations view, local restore triggers when real content arrives offline, and reconcile_session_deletion during E2EE replica apply. Intentional deletes still stick once observed content matches; empty/metadata-only writes do not resurrect deleted sessions.
Reviewed by Cursor Bugbot for commit 4f1bdbf0b51cbde694d7570aaeb1c7dd8e8e8dc9. Bugbot is set up for automated code reviews on this repo. Configure here.