Skip to content

Commit d544d94

Browse files
lpcoxCopilotCopilot
authored
fix: handle cache-memory cold start in issue duplication detector (#3215)
* fix: handle cache-memory cold start in issue duplication detector The workflow reported missing_data (cache_memory_miss) on first run because issues.json doesn't exist yet. The agent gave up instead of falling through to GitHub search to populate the cache. Fix the prompt to: - Treat empty/missing cache as a normal cold start (not an error) - Explicitly instruct NOT to report missing_data on cache miss - Always search via GitHub API regardless of cache state - Use bash for file I/O instead of relying on MCP server abstractions - Document cache merge behavior for subsequent runs Fixes #3213 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ddb6e5d commit d544d94

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/issue-duplication-detector.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,27 @@ You are an AI agent that detects potentially duplicate issues in this repository
3636

3737
When a new issue is opened, analyze it to determine if it might be a duplicate of an existing issue.
3838

39-
1. **Load cached issue data**: Use the cache-memory MCP server to retrieve previously stored issue signatures from `/tmp/gh-aw/cache-memory/`. The cache contains JSON data with issue numbers, titles, and key phrases.
39+
1. **Load cached issue data**: Read the file `/tmp/gh-aw/cache-memory/issues.json` using bash (e.g., `cat /tmp/gh-aw/cache-memory/issues.json`). This file contains previously stored issue signatures from prior workflow runs.
40+
41+
**Cold start handling**: If the file does not exist or is empty, this is a normal cold start — the cache has not been populated yet. Do NOT report `missing_data`. Still continue to step 2 to fetch the new issue details, skip step 3 because there is no cache to compare against, and then proceed to step 4 to search for issues via the GitHub API and populate the cache for future runs.
4042

4143
2. **Fetch the new issue**: Get the details of issue #${{ github.event.issue.number }} in repository ${{ github.repository }}.
4244

43-
3. **Compare with existing issues**:
45+
3. **Compare with cached issues** (skip if cache was empty):
4446
- Compare the new issue's title and body against cached issue data
4547
- Look for similar titles (considering typos, rephrasing, synonyms)
4648
- Look for similar problem descriptions in the body
4749
- Consider keyword overlap and semantic similarity
4850

49-
4. **Search for potential duplicates**: If the cache is empty or you need more context, use GitHub search to find issues with similar keywords:
51+
4. **Search for potential duplicates via GitHub API**: Always search GitHub for issues with similar keywords, whether or not the cache had data:
5052
- Search for issues with similar titles or key terms
5153
- Focus on open issues first, then consider recently closed ones
5254
- Use `perPage: 10` initially to avoid token limits, paginate if needed
5355

5456
5. **Update the cache**: Store the new issue's signature in the cache-memory for future comparisons:
55-
- Save to `/tmp/gh-aw/cache-memory/issues.json`
57+
- Write to `/tmp/gh-aw/cache-memory/issues.json` using bash (e.g., write the JSON content with `cat > /tmp/gh-aw/cache-memory/issues.json << 'EOF'`)
5658
- Include: issue number, title, key phrases extracted from body, creation date
59+
- Merge with existing cache data if the file already existed
5760
- Keep the cache size manageable (store last 100 issues max)
5861

5962
## Duplicate Detection Criteria

0 commit comments

Comments
 (0)