How I built an AI code reviewer that knows when to shut up
说明与用途
构建了一个简洁的 AI 代码审查工具,只报告重要发现,按严重程度排序,限制低优先级评论,并透明地报告被抑制的内容。
问题
AI code reviewers often produce noisy, irrelevant feedback, causing developers to disable them and miss real bugs.
结果
The system reduces noise, surfaces real bugs first, and maintains transparency by reporting suppressed comments, improving developer trust and adoption.
工作流
- 1. Receive GitHub webhook for pull_request
- 2. Verify signature and immediately return 200
- 3. In background: fetch diff, call Claude to generate JSON findings
- 4. Validate severity against whitelist and sanitize findings
- 5. Stable‑sort findings by severity (BUG>WARN>NIT>PRAISE)
- 6. Slice to MAX_COMMENTS, compute suppressedCount
- 7. Post inline comments; if anchoring fails, fallback to top‑level comment
- 8. Log errors and suppress failures silently
证据
GitHub wants a 2XX response within roughly 10 seconds of a webhook delivery.
The model returns JSON findings, each with { path, line, severity, message }
- 记录日期: 2026-09-21T18:30:34.583Z