← Back to PRs

#22859: fix: guard against undefined fileOps properties in compaction safeguard

by miloudbelarebia open 2026-02-21 19:14 View on GitHub →
agents size: XS
## Summary - Adds nullish coalescing (`?? []`) fallbacks for `fileOps.read`, `.edited`, and `.written` in `computeFileLists()` to prevent `TypeError: Cannot read properties of undefined (reading 'filter')` when any of these properties are undefined Without this guard, compaction crashes and falls back to summarization instead of producing real summaries. Fixes #7190 ## Local Validation - [x] Verified the fix handles all three properties (`read`, `edited`, `written`) - [x] Spread + `?? []` pattern is safe for both arrays and undefined values ## Scope XS — 1-line change (2 lines reformatted) in one file ## AI Assistance Used Claude Code for issue investigation and fix implementation. ## Author @miloudbelarebia 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds nullish coalescing guards (`?? []`) to prevent `TypeError` when `fileOps.read`, `fileOps.edited`, or `fileOps.written` are undefined. Without these guards, the spread operators would throw runtime errors, causing compaction to fail and fall back to basic truncation instead of generating proper summaries. <h3>Confidence Score: 5/5</h3> - Safe to merge - defensive guard that prevents runtime errors - Minimal defensive fix that adds proper undefined handling without changing logic. Uses idiomatic TypeScript pattern and matches the PR description's stated intent. - No files require special attention <sub>Last reviewed commit: fa31e1f</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs