-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Reduce false positives in auto-label and duplicate detection #731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,8 +14,9 @@ permissions: | |||||||||||||
|
|
||||||||||||||
| env: | ||||||||||||||
| # Similarity threshold for flagging duplicates (0.0-1.0) | ||||||||||||||
| # 0.85 = very similar, reduces false positives | ||||||||||||||
| SIMILARITY_THRESHOLD: "0.85" | ||||||||||||||
| # 0.92 = very high similarity required, reduces false positives from | ||||||||||||||
| # issues in the same domain/feature area that share vocabulary | ||||||||||||||
| SIMILARITY_THRESHOLD: "0.92" | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| dedup: | ||||||||||||||
|
|
@@ -122,9 +123,31 @@ jobs: | |||||||||||||
| new_body = os.environ.get('NEW_ISSUE_BODY', '') | ||||||||||||||
| query = f'{new_title}\n\n{new_body}' | ||||||||||||||
|
|
||||||||||||||
| threshold = float(os.environ.get('SIMILARITY_THRESHOLD', '0.85')) | ||||||||||||||
| threshold = float(os.environ.get('SIMILARITY_THRESHOLD', '0.92')) | ||||||||||||||
| matches = find_similar_issues(store, query, threshold=threshold, k=3) | ||||||||||||||
|
|
||||||||||||||
| # Additional filter: require title similarity for true duplicates | ||||||||||||||
| # This reduces false positives from issues in the same domain/feature area | ||||||||||||||
| # that share vocabulary but are different tasks | ||||||||||||||
| filtered_matches = [] | ||||||||||||||
| new_title_lower = new_title.lower().strip() | ||||||||||||||
| for m in matches: | ||||||||||||||
| match_title_lower = m.issue.title.lower().strip() | ||||||||||||||
| # Check for significant title overlap | ||||||||||||||
| title_words_new = set(new_title_lower.split()) | ||||||||||||||
| title_words_match = set(match_title_lower.split()) | ||||||||||||||
| shared_words = title_words_new.intersection(title_words_match) | ||||||||||||||
| # Require at least 40% of words to overlap for a duplicate flag | ||||||||||||||
| max_words = max(len(title_words_new), len(title_words_match), 1) | ||||||||||||||
| overlap_ratio = len(shared_words) / max_words | ||||||||||||||
|
Comment on lines
+140
to
+142
|
||||||||||||||
| # Require at least 40% of words to overlap for a duplicate flag | |
| max_words = max(len(title_words_new), len(title_words_match), 1) | |
| overlap_ratio = len(shared_words) / max_words | |
| # Require at least 40% of words in the shorter title to overlap for a duplicate flag | |
| min_words = max(min(len(title_words_new), len(title_words_match)), 1) | |
| overlap_ratio = len(shared_words) / min_words |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to move other high-confidence matches to suggestions has a potential bug. The condition
m not in suggestionswill always be true becausesuggestionsonly contains matches with scores belowauto_threshold(line 132), while this loop checks matches with scores >=auto_threshold. This means duplicates could be added to the suggestions list. Additionally, iterating overmatches[1:]and checkingm.score >= auto_thresholdis redundant since we already have theauto_applylist containing all matches above the threshold.