Repository navigation
feat: feed prior bot comments to model for conceptual dedup - #27
Conversation
Cross-run dedup uses file:category:line keys with a ±5 line proximity window — this misses conceptual duplicates at distant lines (same premise, 100+ lines apart). Feed existing bot comment bodies to the model via a new prior_bot_comments prompt section so it self-suppresses known issues at the semantic level. - Refactor fetchInlineAnchors → fetchInlineCommentState to preserve raw comment bodies alongside anchors - Extend fetchIssueCommentState to return finding bodies (status comment excluded) - Strip dedup anchor HTML before including in prompt - Cap at 30 most recent comments to bound token usage - Add priorBotComments to ReviewContext, flows through to buildUserPrompt - 7 new tests: body passthrough, anchor stripping, status exclusion, cap enforcement, first-run empty case, prompt rendering + ordering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
umm-actually re-reviewed at 1 new finding(s) posted (3 tracked finding(s) across all runs). umm-actually · deepseek/deepseek-v4-pro |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughChangesPrior bot comment context
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/__tests__/orchestrate.test.ts`:
- Around line 1713-1715: Update the test around priorBotCommentsFrom to assert
the complete retained comments array, matching the exact sequence from “finding
10” through “finding 39” in order, rather than checking only its length and
final entry.
In `@src/orchestrate.ts`:
- Around line 429-434: Update the data retrieval used by priorBotComments so
both inline and issue comment client methods return creation timestamps
alongside bodies; merge the two collections chronologically, sort by those
timestamps, then apply PRIOR_COMMENT_CAP before stripping anchors, preserving
the 30 most recent comments regardless of source.
- Around line 429-434: Update the prior-comment assembly around priorBotComments
to enforce an explicit token budget in addition to PRIOR_COMMENT_CAP. After
stripAnchorComment, retain comments newest-first and truncate or stop before the
cumulative token count exceeds the reserved budget, ensuring the bounded content
is what gets appended after context-budget calculation.
In `@src/review/__tests__/prompt.test.ts`:
- Around line 307-313: Update the test around userPrompt to assert the complete
deterministic prior-bot-comments section as one exact rendered block, including
the opening tag with its note attribute, both comment bodies, the delimiter, and
the closing tag; replace the separate toContain assertions for these fragments
while preserving any unrelated prompt assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d031e75b-88fc-4b53-8a5d-e45868a883e9
📒 Files selected for processing (4)
src/__tests__/orchestrate.test.tssrc/orchestrate.tssrc/review/__tests__/prompt.test.tssrc/review/prompt.ts
… sections Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Full-result toEqual on all selectFindings tests (was decomposed property picks that missed droppedAsOverlapping/droppedByCap fields). Collapse 4 fragment toContain calls in the prior-bot-comments prompt test into one full-section assertion. Add pipe-escaping coverage for renderPaths — the only production behavior with no test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…oc, outputs table - AGENTS.md: review/ structure tree now includes filter-non-findings.ts (listed as "non-finding filter") - prompt.ts: buildUserPrompt JSDoc now enumerates the prior-bot-comments and prior-findings sections that follow the diff - README.md: findings_count output description now mentions the non-finding filter stage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| anchors: extractAnchors( | ||
| comments.map((comment) => ({ | ||
| findingComments.map((comment) => ({ | ||
| body: comment.body, | ||
| line: null, | ||
| originalLine: null, | ||
| })), | ||
| ), | ||
| findingBodies: findingComments.map((comment) => comment.body), |
There was a problem hiding this comment.
[low/correctness] Collect findingBodies only from anchored comments in fetchIssueCommentState (confidence: low)
findingBodies is derived from findingComments, which includes any non-status comment regardless of whether it contains a valid anchor. A bot comment that is not a status comment and lacks an anchor would still appear in priorBotComments, polluting the prompt with non-finding text.
Failure scenario: A bot posts a standalone PR comment that does not start with STATUS_ANCHOR and lacks a hidden anchor (e.g., a follow-up note or a future non-finding comment). The comment body is included in priorBotComments, wasting context and potentially confusing the model's conceptual dedup.
Suggested fix
Derive findingBodies only from comments that extractAnchors successfully parses, or filter comments to those containing the anchor pattern before mapping.
Summary
file:category:linekeys with a ±5 line proximity window, which misses conceptual duplicates — findings with the same underlying premise but anchored at different lines (e.g. PR feat: doc-staleness context — mention-based reverse-reference scan #10: false symlink premise raised 3× at lines 183, 219, 336)prior_bot_commentsprompt section so it self-suppresses known issues at the semantic level — handles paraphrases that no lexical similarity measure would catchfetchInlineAnchors→fetchInlineCommentStateto preserve raw comment bodies alongside anchors; extendedfetchIssueCommentStateto return finding bodies (status comment excluded); strip dedup anchor HTML before prompt inclusion; cap at 30Test plan
npm test— 412 tests pass (7 new)npm run lint— 0 warningsnpm run build— compilesdocker build .— image buildsgenerateFindingspriorBotCommentson first run (no prior comments)prior_bot_commentssection with nonce tag and suppression note🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests