fix(ready): prevent wisps from appearing in bd ready

Add multiple layers of defense against misclassified wisps:
- Importer auto-detects -wisp- pattern and sets ephemeral flag
- GetReadyWork excludes -wisp- IDs via SQL LIKE clause
- Doctor check 26d detects misclassified wisps in JSONL

This addresses recurring issue where wisps with missing ephemeral
flag would pollute bd ready output after JSONL import.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dennis
2026-01-12 23:49:22 -08:00
committed by gastown/crew/dennis
parent 12c7bef159
commit f703237c3d
5 changed files with 204 additions and 81 deletions

View File

@@ -99,6 +99,15 @@ func ImportIssues(ctx context.Context, dbPath string, store storage.Storage, iss
issue.ContentHash = issue.ComputeContentHash()
}
// Auto-detect wisps by ID pattern and set ephemeral flag
// This prevents orphaned wisp entries in JSONL from polluting bd ready
// Pattern: *-wisp-* indicates ephemeral patrol/workflow instances
for _, issue := range issues {
if strings.Contains(issue.ID, "-wisp-") && !issue.Ephemeral {
issue.Ephemeral = true
}
}
// Get or create SQLite store
sqliteStore, needCloseStore, err := getOrCreateStore(ctx, dbPath, store)
if err != nil {

View File

@@ -19,6 +19,7 @@ func (s *SQLiteStorage) GetReadyWork(ctx context.Context, filter types.WorkFilte
whereClauses := []string{
"i.pinned = 0", // Exclude pinned issues
"(i.ephemeral = 0 OR i.ephemeral IS NULL)", // Exclude wisps
"i.id NOT LIKE '%-wisp-%'", // Defense in depth: exclude wisp IDs even if ephemeral flag missing
}
args := []interface{}{}