Add --gastown flag to bd doctor for gastown-specific checks (#1162)

When running in gastown multi-workspace mode, two checks produce false
positives that are expected behavior:

1. routes.jsonl is a valid configuration file (maps issue prefixes to
   rig directories), not a duplicate JSONL file
2. Duplicate issues are expected (ephemeral wisps from patrol cycles)
   and normal up to ~1000, with GC cleaning them up automatically

This commit adds flags to bd doctor for gastown-specific checks:
- --gastown: Skip routes.jsonl warning and enable duplicate threshold
- --gastown-duplicates-threshold=N: Set duplicate tolerance (default 1000)

Fixes false positive warnings:
  Multiple JSONL files found: issues.jsonl, routes.jsonl
  70 duplicate issue(s) in 30 group(s)

Changes:
- Add --gastown flag to bd doctor command
- Add --gastown-duplicates-threshold flag (default: 1000)
- Update CheckLegacyJSONLFilename to skip routes.jsonl when gastown mode active
- Update CheckDuplicateIssues to use configurable threshold when gastown mode active
- Add test cases for gastown mode behavior with various thresholds

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Roland Tritsch
2026-01-20 22:06:53 +00:00
committed by GitHub
parent f336e669e9
commit 09355eee8c
5 changed files with 277 additions and 18 deletions

View File

@@ -121,7 +121,8 @@ func CheckAgentDocumentation(repoPath string) DoctorCheck {
// CheckLegacyJSONLFilename detects if there are multiple JSONL files,
// which can cause sync/merge issues. Ignores merge artifacts and backups.
func CheckLegacyJSONLFilename(repoPath string) DoctorCheck {
// When gastownMode is true, routes.jsonl is treated as a valid system file.
func CheckLegacyJSONLFilename(repoPath string, gastownMode bool) DoctorCheck {
beadsDir := filepath.Join(repoPath, ".beads")
// Find all .jsonl files
@@ -160,7 +161,9 @@ func CheckLegacyJSONLFilename(repoPath string) DoctorCheck {
// Git merge conflict artifacts (e.g., issues.base.jsonl, issues.left.jsonl)
strings.Contains(lowerName, ".base.jsonl") ||
strings.Contains(lowerName, ".left.jsonl") ||
strings.Contains(lowerName, ".right.jsonl") {
strings.Contains(lowerName, ".right.jsonl") ||
// Skip routes.jsonl in gastown mode (valid system file)
(gastownMode && name == "routes.jsonl") {
continue
}