#22494: fix(post-compaction-audit): show readable label for missing regex requirements
size: S
Cluster:
Error Handling Improvements
## Summary
- replace raw regex `.source` output in post-compaction audit warnings with human-readable labels
- add label-aware required-read handling for regex entries
- update tests to assert readable output (`memory/YYYY-MM-DD.md`) and cover custom labeled regex entries
## Testing
- `pnpm vitest run src/auto-reply/reply/post-compaction-audit.test.ts`
## AI Transparency
- [x] AI-assisted
- [x] Lightly tested (targeted tests only)
Fixes #22339
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Replaces raw regex `.source` output (e.g., `memory\/\d{4}-\d{2}-\d{2}\.md`) with human-readable labels (e.g., `memory/YYYY-MM-DD.md`) in post-compaction audit warnings. The implementation adds a new object format `{ pattern: RegExp, label?: string }` to the `RequiredRead` type, allowing explicit labels for regex patterns while maintaining backward compatibility with plain strings and RegExp values.
- Introduces `resolveRequiredReadMatcher` helper to normalize three input types (string, RegExp, object) into consistent `{ matcher, label }` format
- Updates `DEFAULT_REQUIRED_READS` to use the new labeled format for the memory file pattern
- Adds comprehensive test coverage for custom labeled regex entries
- Improves test assertions to use exact string matching instead of `.includes()` checks
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are well-contained to a single feature (audit warning formatting), maintain backward compatibility, have comprehensive test coverage, and contain no logical errors. The implementation is clean with proper TypeScript typing and appropriate helper function extraction.
- No files require special attention
<sub>Last reviewed commit: 651cc21</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22375: fix(audit): use human-readable labels for RegExp patterns in post-c...
by aldoeliacim · 2026-02-21
91.8%
#22711: fix: post-compaction audit skips non-existent required files
by taw0002 · 2026-02-21
79.1%
#21285: fix(auto-reply): parse toolCall read paths in post-compaction audit
by Jackten · 2026-02-19
74.4%
#22124: fix(agents): remove non-existent WORKFLOW_AUTO.md from post-compact...
by lailoo · 2026-02-20
71.7%
#20465: fix: remove WORKFLOW_AUTO.md from default post-compaction audit reads
by aldoeliacim · 2026-02-19
71.5%
#17244: fix: strip TTS tags from agent replies before delivery (#14652)
by robbyczgw-cla · 2026-02-15
71.4%
#8504: fix: prevent false positives in isSilentReplyText for CJK content
by hanxiao · 2026-02-04
69.9%
#21140: test(security): add regression test for claude-opus-4-6 audit
by dinakars777 · 2026-02-19
69.5%
#19115: fix(logging): improved redaction for config objects and unquoted keys
by Clawborn · 2026-02-17
69.3%
#16962: fix: make auth error detection contextual to prevent false positives
by StressTestor · 2026-02-15
68.7%