Skip to content

[Fix] Prevent duplicate GitHub follow-up quotes - #880

Merged
daniel-lxs merged 3 commits into
developfrom
fix/atomic-github-quote-claim-3dsoje4c9wabp
Jul 29, 2026
Merged

[Fix] Prevent duplicate GitHub follow-up quotes#880
daniel-lxs merged 3 commits into
developfrom
fix/atomic-github-quote-claim-3dsoje4c9wabp

Conversation

@roomote-roomote

Copy link
Copy Markdown
Contributor

Opened on behalf of Daniel Riccio. Follow up by mentioning @roomote-roomote, in the web UI, or in Discord.

What changed

GitHub reply quotes are now claimed atomically before a comment write. A failed provider write restores the claim only when a newer follow-up has not replaced it.

Why this change was made

Concurrent comment writes could read the same pending web follow-up and quote it multiple times.

Impact

Each web follow-up is delivered at most once as a GitHub quote while preserving it for a retry after a failed write.

@roomote-roomote

roomote-roomote Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

1 issue outstanding. See task

  • packages/communication/src/messages.ts:439: SET ... NX only sees the current key. If an older write claims M, a newer follow-up N is claimed and posted successfully, then the older write fails, N has already deleted the key and this restores M. The next response quotes stale M after N, despite the newer follow-up having replaced it. Preserve a generation or tombstone for later claims so restore can reject superseded messages.
  • packages/communication/src/messages.ts:57: If Redis executes the claim but its response is lost (or the API process stops) before claimLatestUserMessageForReplyQuote returns, the pending key has already been deleted and the 30-day claim is left behind. A retry creates a new token, cannot reclaim that stored message, and posts no quote, so the failed request loses the user's follow-up instead of preserving it for retry. Keep the pending message recoverable when acquisition itself fails, or make the claim safely resumable.

Reviewed eb23af0

@daniel-lxs
daniel-lxs marked this pull request as ready for review July 29, 2026 18:27
@daniel-lxs
daniel-lxs merged commit 15fa8e5 into develop Jul 29, 2026
17 checks passed
@daniel-lxs
daniel-lxs deleted the fix/atomic-github-quote-claim-3dsoje4c9wabp branch July 29, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant