fix: prevent duplicate PR comments via similarity-based deduplication (issue #1495)#1496
Open
konard wants to merge 5 commits into
Open
fix: prevent duplicate PR comments via similarity-based deduplication (issue #1495)#1496konard wants to merge 5 commits into
konard wants to merge 5 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1495
Issue #1495: Multiple repeated comments were posted after `ready to merge` on link-foundation/box#73. Root cause: no deduplication for AI-generated or system-generated PR comments across sessions. Changes: - Add comment-dedup.lib.mjs: text normalization, overlap-coefficient similarity scoring, and deduplication check before posting - Integrate postCommentWithDedup() into auto-merge "Ready to merge" and "Auto-merged" comment posting paths - Add "Comment deduplication" section to all AI agent system prompts (claude, codex, opencode, agent) instructing the AI to check for existing similar comments before posting - Add case study documentation with timeline reconstruction - Add 26 unit tests for normalization, similarity, and real-world duplicate detection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ready to merge without clear demarcation of working sessionsThe no-misleading-character-class rule flagged the combined character
ranges. Use \p{Emoji_Presentation} instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard
marked this pull request as ready for review
March 29, 2026 18:29
This reverts commit e3c6a25.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (3579KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit or discard them. Uncommitted files: Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback. |
Download session log (23K lines) and PR #73 comments JSON to docs/case-studies/issue-1495/ for root cause analysis of duplicate comment incident. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
🔄 Auto-restart 1/3 LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (4547KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
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
Fixes #1495 — Multiple repeated comments were posted after
ready to mergeon link-foundation/sandbox#73. After an AI work session completed, 4+ duplicate "Validation Complete" comments were posted within a 37-second window.Root Cause
The hive-mind system had no deduplication mechanism for:
Changes
comment-dedup.lib.mjs: Text normalization, overlap-coefficient similarity scoring, and deduplication check before posting commentsnormalizeCommentForComparison()— strips markdown, timestamps, emoji, table formattingcomputeSimilarity()— overlap coefficient on keyword setscomputeCommentSimilarity()— combines header matching with word overlap for better accuracycheckForRecentSimilarComment()— checks recent PR comments within a time windowpostCommentWithDedup()— drop-in replacement forgh pr commentwith built-in dedupsolve.auto-merge.lib.mjs: "Ready to merge" and "Auto-merged" comments now usepostCommentWithDedup()with 10-minute window and 0.7 similarity thresholddocs/case-studies/issue-1495/Test Plan
tests/comment-dedup.test.mjs— all passing