fix(multi-review): add configurable diff exclusion and size-based truncation#196
Conversation
…ncation The existing lock-file filter strips known lock files from the PR diff, but large diffs can still exceed the LLM context window when they contain other auto-generated or vendored content. Add two new action inputs: - diff-exclude: comma-separated glob patterns for additional files to exclude (gitignore convention: patterns without '/' match basenames) - diff-max-size-kb: maximum diff size in KB after filtering; if exceeded, only leading file sections are kept with a truncation notice The filterDiff function now accepts FilterDiffOptions with excludePatterns and maxSizeBytes. Truncation keeps whole file sections from the start and appends a notice showing how many of the total sections were included. Fixes #194
|
无遗漏 所有 spec 中的功能点均已完整实现:
|
|
有条件合并 / CONDITIONAL MERGE quality 审查看出 3 个阻塞问题,其余 reviewer 无阻塞项。最终决策采纳最严重发现——有条件合并。 阻塞项 / Blocking Issues
建议项 / Suggestions
📋 各 Reviewer 详细审查结果quality有条件合并 / CONDITIONAL MERGE 该 PR 新增了 阻塞项:
建议项:
security安全无虞 / SECURE 本次 PR 新增 阻塞项:无 建议项:
performance性能良好 / GOOD 该 PR 主要增加 diff 过滤(自定义排除模式)和截断( 阻塞项:无 建议项:无 architecture架构有疑虑 / CONCERNS 本次 PR 为 阻塞项:无 建议项:
|
- Fix globToRegex: ** at start now matches top-level paths (gitignore semantics) **/vendor matches 'vendor' at any depth including root vendor/** matches any file under vendor/ - Rename originalBytes → filteredBytes for semantic accuracy Log message now says 'after filtering' instead of 'original' - Always keep at least first section when truncating to avoid empty diff - Update action.yml description to document gitignore convention for patterns - Add trailing newline to diff-filter.ts - Remove bun.lock that was accidentally committed - Add tests for **/ top-level matching and empty-first-section edge case
Step 1: 获取 PR 和 Issue 上下文PR title: 所有变更文件已读取完毕,进行逐项比对分析。 逐项比对:spec vs 实现1.
|
综合审查报告最终决策:条件合并 / CONDITIONAL MERGE 整体实现质量良好,架构合理,测试覆盖充分。但有一项被多个 reviewer 确认的阻塞问题须先修复。 已确认问题(2+ reviewers 同时指出)
阻塞项 / Blocking Issues
建议项 / Suggestions
📋 各 Reviewer 详细审查结果quality条件合并 / CONDITIONAL MERGE 该 PR 整体质量良好,功能完整、测试覆盖充分。但有一个需要关注的问题: 阻塞项:
建议项:
security存在风险 / AT RISK 安全分析摘要:本次 PR 新增了 阻塞项:无 建议项:
performance性能有疑虑 / CONCERNS 整体来看,本次改动引入了可配置的 diff 排除规则和大小截断功能,实现质量较高,未引入阻塞性性能问题。但存在以下可优化项: 阻塞项:无 建议项:
architecture架构合理 / SOUND 该 PR 在 分析总结:
阻塞项:无 建议项:
|
|
现在我来读取已更改的文件并与 spec 进行比对。以下是逐项分析结果: 逐项比对:spec 与 实现1.
2.
3.
4. 日志
5. 测试(实际10个新测试,超过PR描述的8个)
6. 之前 reviewer 指出的问题已在 HEAD 中修复
无遗漏 所有 PR 描述中的功能点均已完整实现:
PR 描述中的字段名 |
|
可合并 / CAN MERGE 所有四位 reviewer 均未发现阻塞性问题,变更质量高,安全无虞,架构合理,性能无负面影响。存在若干改进建议但均非合并前提。 阻塞项: 无 建议项:
📋 各 Reviewer 详细审查结果quality可合并 / CAN MERGE 变更为 阻塞项:无 建议项:
security安全无虞 / SECURE 安全分析摘要:本 PR 新增了 阻塞项:无 建议项:
performance性能良好 / GOOD 该 PR 新增的自定义文件排除和基于大小的截断功能整体上对性能没有负面影响,截断功能反而有助于控制发送给 LLM 的 diff 大小,是性能优化。 阻塞项:无 建议项:
architecture架构合理 / SOUND 本次 PR 为 multi-review action 增加了可配置的 diff 排除模式和大小截断功能。整体架构设计合理,变更集中且符合现有模式。
阻塞项:无
|



Repro
A PR that includes large auto-generated files (e.g.
pnpm-lock.yamlat 790KB +bun.lockat 411KB = ~1.2MB diff) causes all 4 multi-review agents to fail instantly withUnexpected server error. The entire diff is sent to the LLM in one shot, exceeding the model's context window or request body limit.The existing lock-file filter (PR #195) handles the most common case, but there's no protection against:
Cause
multi-review/src/diff-filter.tshad hardcoded lock-file patterns only — no user-configurable exclusion, and no size-based safety net. If the filtered diff was still too large, the entire review would fail.Fix
diff-excludeinput — comma-separated glob patterns for additional files to exclude from the diff. Uses gitignore convention: patterns without/match basenames (e.g.*.generated.ts), patterns with/match full paths (e.g.vendor/**).diff-max-size-kbinput — maximum diff size in KB after filtering. If exceeded, only leading file sections are kept and a truncation notice is appended. Set to 0 (default) to disable.filterDiff()extended — acceptsFilterDiffOptionswithexcludePatternsandmaxSizeBytes. ReturnsFilterDiffResultwithtruncatedandoriginalBytesfields for logging.Verification
Fixes #194