Skip to content

fix: prevent false cwd split that hides all sessions#40

Merged
matt1398 merged 1 commit intomatt1398:mainfrom
cesarafonseca:fix/cwd-split-no-sessions
Feb 21, 2026
Merged

fix: prevent false cwd split that hides all sessions#40
matt1398 merged 1 commit intomatt1398:mainfrom
cesarafonseca:fix/cwd-split-no-sessions

Conversation

@cesarafonseca
Copy link
Contributor

@cesarafonseca cesarafonseca commented Feb 20, 2026

Summary

  • Fixes a bug where projects with older sessions (missing cwd field in JSONL) would show 0 sessions when selected in the dashboard
  • scanProject was splitting sessions into subprojects whenever cwdGroups.size > 1, but sessions without cwd created a separate __decoded__ group even when all sessions with cwd shared the same value
  • The orphan subproject received a relative fallback path (e.g., "my-project") that failed git identity resolution, causing it to land in a separate repository group with broken session loading
  • Now only counts distinct real cwds when deciding whether to split, treating cwd-less sessions as belonging to the same project

Testing

  • npm run typecheck passes
  • npm test passes
  • Added test in test/main/services/discovery/ProjectScanner.cwdSplit.test.ts covering:
    • Single real cwd + sessions without cwd → no split, 1 project with plain ID
    • Multiple distinct cwds → split into composite-ID subprojects

Sessions without the cwd field (older JSONL format) were creating a
separate subproject group, even when all sessions with cwd shared the
same value. The orphan subproject got a relative fallback path that
failed git identity resolution, causing zero sessions to load on select.

Now only counts distinct real cwds when deciding whether to split,
treating cwd-less sessions as belonging to the same project.
@matt1398 matt1398 merged commit ffa94f5 into matt1398:main Feb 21, 2026
3 checks passed
@matt1398
Copy link
Owner

LGTM! Thanks for the clean fix and the test cases.
Merged.

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.

2 participants