Repository navigation
Supersedes #20891: fix(sync): reject soft-deleted conversation tombstones in capture provenance - #23080
Supersedes #20891: fix(sync): reject soft-deleted conversation tombstones in capture provenance#23080omiagent[bot] wants to merge 1 commit into
Conversation
…venance Reject soft-deleted conversation tombstones in `capture_matches_server_conversation` by checking `conversations_db.is_soft_deleted(conversation)`. Failure-Class: none
|
The production change here is correct and nicely scoped — a genuine tombstone-bypass fix with the right shape; leaving formal approval to a human maintainer because it touches trust-lane elevation. Verified on the current head:
Security: this closes a path where deleted-conversation tombstones could still acquire fresh capture provenance and elevate sync requests into the trusted lane — blast radius if wrong is limited to sync admission, and the direction of change is reject-more. USER IMPACT: conversations a user deleted can no longer get new capture files attached or re-enter trusted sync; active conversations behave exactly as before. Nothing blocking from my side. Given it changes trust-lane elevation logic, final merge sign-off belongs to a maintainer — it is ready for that. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
What this does, in plain terms
When a conversation is deleted in Omi, the server keeps a hidden "tombstone" record so deleted data stays deleted. This fix closes a gap where that hidden tombstone could still pass capture provenance verification — a capture file could be proven as belonging to a conversation the user already deleted, as long as timestamps lined up within the matching window. Concretely, a deleted conversation could get fresh capture files attached to it and its sync requests elevated into the trusted sync lane. After this change, soft-deleted conversations never match capture provenance; active conversations behave exactly as before.
Credits
Carried forward from #20891 by @miso466 — cherry-picked with the original authorship intact (git author preserved). The entire diff is the author's; this superseding PR exists only because the fork branch cannot be updated directly.
Supersedes #20891.
What changed and why
Follow-up to #19762, #19774, #19796, #19804, #19860, #19864, #19867, #19870, #20763, #20772, #20783, #20800, #20871, #20877.
Reject soft-deleted conversation tombstones in
capture_matches_server_conversationto prevent tombstone bypass in capture provenance verification.In
capture_matches_server_conversation(backend/utils/sync/provenance.py), validation for whether a parent conversation is soft-deleted was missing when verifying capture file provenance for server-created conversations.Even when a conversation was soft-deleted (
deleted: True),capture_matches_server_conversationwould returnTrueas long as timestamps aligned within the configurable time-matching tolerance window (slop window), allowing:claim_fresh_capture_provenance(POST /v1/sync/capture/manifest) to associate manifest claims with soft-deleted conversation tombstones.POST /v1/sync(sync_files) to granthas_server_capture_proofand elevate sync requests targeting deleted conversations into the trusted sync lane (classify_sync_lane).This fix:
capture_matches_server_conversation(backend/utils/sync/provenance.py), returningFalseimmediately whenconversations_db.is_soft_deleted(conversation)is true.Regression Risk
Zero. Only affects soft-deleted conversations (
deleted: True). All active conversations continue to match captures identically.Product invariants affected
none
How it was verified
backend/tests/unit/test_sync_provenance.py(7 passed locally on this branch).test_sync_two_lane.py,test_sync_file_paths_filename_none.py(41 passed, per fix(sync): reject soft-deleted conversation tombstones in capture provenance #20891).scripts/backend-python-format --checkclean (Black 26.5.1) on both changed files.scripts/pr-preflight --pr-body-filerun locally on this branch (see checks below).Tests
backend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_active_matchesbackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_rejects_soft_deleted_tombstonebackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_missing_conversationbackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_mismatched_devicebackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_missing_idsbackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_invalid_timestampsbackend/tests/unit/test_sync_provenance.py::test_capture_matches_server_conversation_outside_windowFailure class (fixes)
Failure-Class: none