Skip to content

Fix scanner session loss, slug resume, autopilot race (#28) - #29

Merged
bearmug merged 1 commit into
mainfrom
fix/scanner-session-loss-28
Mar 20, 2026
Merged

Fix scanner session loss, slug resume, autopilot race (#28)#29
bearmug merged 1 commit into
mainfrom
fix/scanner-session-loss-28

Conversation

@bearmug

@bearmug bearmug commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes three related bugs from #28 causing sessions to be invisible or lose autopilot.

  • Phase 1 CWD dedup removed: each Claude process gets its own session instead of collapsing to one per working directory
  • Slug resume fix: findJSONLBySlug() scans JSONL metadata (custom-title/slug) instead of assuming filename matches slug
  • Phase 2 multi-JSONL: findRecentJSONLs() returns all JSONL files modified within 24h, not just the latest per directory
  • Autopilot fallback: ShouldAutoApprove() checks persisted autopilot state when session not yet discovered by scanner (fixes 60s timeout after daemon restart)

Test plan

  • go build ./... && go test ./... — all pass
  • 8 new tests: findRecentJSONLs (3), findJSONLBySlug (3), autopilot fallback (2)
  • Manual: run 2 claude sessions in same repo, verify both appear in TUI
  • Manual: claude --resume <slug>, verify correct session matched
  • Manual: restart daemon with YOLO sessions, verify tools don't block

Closes #28

Scanner:
- Phase 1: remove CWD dedup — each process gets its own session
- Phase 1: slug resolution via findJSONLBySlug (scans custom-title/slug)
- Phase 2: findRecentJSONLs returns all JSONL files within 24h, not just latest

State:
- ShouldAutoApprove falls back to persisted autopilot state when session
  not yet in m.sessions (covers hook-before-scanner race after restart)

Closes #28
@bearmug
bearmug merged commit 124591e into main Mar 20, 2026
1 check passed
@bearmug
bearmug deleted the fix/scanner-session-loss-28 branch March 20, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scanner drops sessions: CWD dedup, slug resume, autopilot race

1 participant