fix(inbox): prevent incorrect Slack message auto-archive - #55
Merged
Conversation
Guard bulk_archive_before with synced_at so backfilled messages are not archived before appearing in the inbox, and stop upsert from overwriting user archive decisions on re-sync. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
MaximeGaudin
enabled auto-merge (squash)
July 28, 2026 06:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53.
Summary
bulk_archive_beforenow requiressynced_at < cutoff— a message sent days ago but only synced seconds ago (backfill, daemon restart) is no longer silently archived before the user ever sees it in the inbox.is_archivedon re-sync — removedis_archived = excluded.is_archivedfrom theON CONFLICTclause so that user archive decisions are preserved across re-syncs (Slack always passesfalse, which previously un-archived manually archived messages).Root cause
bulk_archive_beforeusedtimestamp < ?1(the message's original send time) without checkingsynced_at. A message posted 4 days ago that lands in the DB during a catch-up sync would be immediately caught by anyvoid archive --beforetargeting the last 2 days — the user never sees it in their inbox.Separately, the upsert
ON CONFLICTclause unconditionally setis_archived = excluded.is_archived, which for Slack is alwaysfalse. This meant:Test plan
bulk_archive_before_skips_recently_synced_messages— old timestamp + recent synced_at → not archivedupsert_preserves_user_archived_flag— re-upsert withis_archived: falsekeeps the archived statebulk_archive_before_*tests updated and passingcargo testgreenMade with Cursor