feat(doctor): add patrol pollution detection and fix

Add CheckPatrolPollution to detect stale patrol beads:
- Patrol digests matching 'Digest: mol-*-patrol'
- Session ended beads matching 'Session ended: *'

Includes auto-fix via 'bd doctor --fix' to clean up pollution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
emma
2026-01-20 23:15:37 -08:00
committed by Steve Yegge
parent bf92fda886
commit 4a0f4abc70
4 changed files with 273 additions and 3 deletions

View File

@@ -612,9 +612,10 @@ func runDiagnostics(path string) doctorResult {
result.Checks = append(result.Checks, staleMQFilesCheck)
// Don't fail overall check for legacy MQ files, just warn
// Note: Check 26d (misclassified wisps) was referenced but never implemented.
// The commit f703237c added importer-based auto-detection instead.
// Removing the undefined reference to fix build.
// Check 26d: Patrol pollution (patrol digests, session beads)
patrolPollutionCheck := convertDoctorCheck(doctor.CheckPatrolPollution(path))
result.Checks = append(result.Checks, patrolPollutionCheck)
// Don't fail overall check for patrol pollution, just warn
// Check 27: Expired tombstones (maintenance)
tombstonesExpiredCheck := convertDoctorCheck(doctor.CheckExpiredTombstones(path))