Conversation
GitHub notifications are mutable — when someone @mentions you on a PR you authored, GitHub updates the existing notification's `reason` field from "author" to "mention" (same notification ID). The previous INSERT OR IGNORE silently dropped these updates since the (source, id) primary key already existed, making mentions invisible to consumers. Now checks if an existing record has different metadata or content before inserting. If changed, deletes the old record and re-inserts with a new rowid so consumer cursors see it as a new unread message. Unchanged records are still silently skipped (no noise). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pufit
approved these changes
Mar 30, 2026
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.
Summary
@mentionsyou on a PR you authored, GitHub updates the existing notification'sreasonfrom"author"to"mention"(same notification ID)INSERT OR IGNOREsilently dropped these updates since the(source, id)primary key already existed, making mentions/tags invisible to consumer cursorsProblem
The
source_messagestable usesPRIMARY KEY (source, id). GitHub notification IDs are stable per thread — when a notification'sreasonchanges (e.g.author→mention), the API returns the same ID with updated fields.INSERT OR IGNOREskipped these entirely.Before fix: 55 stored messages — 51
author, 3comment, 1assign, 0mentionLive GitHub API: 10
mentionnotifications (same IDs as storedauthorrecords)Implementation
In
insert_source_messages():(source, id)already existsDELETEold row, thenINSERTnew onerowid, making it visible to consumer cursors that already read the old versionTest plan
🤖 Generated with Claude Code