Skip to content

fix: detect new sessions in existing project dirs + scan local-agent-mode sessions - #180

Merged
vakovalskii merged 1 commit into
vakovalskii:mainfrom
NovakPAai:fix/session-discovery-gaps
Apr 17, 2026
Merged

vakovalskii merged 1 commit into
vakovalskii:mainfrom
NovakPAai:fix/session-discovery-gaps

Conversation

@NovakPAai

Copy link
Copy Markdown
Collaborator

Summary

Two session discovery bugs that cause sessions to be invisible in the dashboard:

Bug 1: Cache never invalidates for new sessions in existing projects

_sessionsNeedRescan() only tracked the top-level ~/.claude/projects/ mtime. When a new session starts in an already existing project directory, only the subdirectory mtime changes — not the parent. This caused the cache to extend indefinitely, hiding new sessions until history.jsonl changed or the server restarted.

Fix: also track mtime of each project subdirectory in _projectsSubDirMtimes.

Bug 2: Claude desktop local-agent-mode sessions not scanned

Sessions started via Claude desktop app's local agent mode are stored in:

~/Library/Application Support/Claude/local-agent-mode-sessions/<id>/<id>/local_<id>/.claude/projects/

This directory was never scanned — all those sessions were invisible.

Fix: added detectLocalAgentModeClaudeDirs() (macOS only) that walks the local-agent-mode-sessions tree and collects embedded .claude dirs into EXTRA_CLAUDE_DIRS.

Test plan

  • Start a new Claude Code session in an existing project → verify it appears within 60s without server restart
  • On macOS with Claude desktop app: check ~/Library/Application Support/Claude/local-agent-mode-sessions/ for session files → verify they appear in dashboard
  • Verify session counts don't regress on cold start

…mode sessions

Two session discovery bugs fixed:

1. Cache invalidation: _sessionsNeedRescan() only checked PROJECTS_DIR top-level
   mtime, so new sessions added to existing project subdirs were invisible until
   history.jsonl changed or server restarted. Now also tracks each subdir mtime.

2. Claude desktop local-agent-mode: sessions stored in
   ~/Library/Application Support/Claude/local-agent-mode-sessions/
   were never scanned. Added detectLocalAgentModeClaudeDirs() (macOS only)
   to find embedded .claude dirs and include them in EXTRA_CLAUDE_DIRS.
@vakovalskii
vakovalskii merged commit 4caa7b6 into vakovalskii:main Apr 17, 2026
6 checks passed
vakovalskii added a commit that referenced this pull request Apr 17, 2026
…lytics tabs

Merged PRs:
- #182 (@rrr3try): Show Claude Code recap (away_summary) as session title
- #181 (@NovakPAai): Block bulk delete for filter-hidden sessions
- #180 (@NovakPAai): Detect new sessions in existing dirs + local-agent-mode
- #179 (@NovakPAai): Message sort toggle in session drawer + default setting
- #86 (@NovakPAai): Sub-tabs in Cost Analytics (Overview/Breakdown/History)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
vakovalskii added a commit that referenced this pull request Apr 17, 2026
…lytics tabs (#183)

Merged PRs:
- #182 (@rrr3try): Show Claude Code recap (away_summary) as session title
- #181 (@NovakPAai): Block bulk delete for filter-hidden sessions
- #180 (@NovakPAai): Detect new sessions in existing dirs + local-agent-mode
- #179 (@NovakPAai): Message sort toggle in session drawer + default setting
- #86 (@NovakPAai): Sub-tabs in Cost Analytics (Overview/Breakdown/History)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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