Skip to content

fix: update session scanner path when Claude enters worktree#1116

Open
AlseinX wants to merge 1 commit intoslopus:mainfrom
AlseinX:fix/issue-1111
Open

fix: update session scanner path when Claude enters worktree#1116
AlseinX wants to merge 1 commit intoslopus:mainfrom
AlseinX:fix/issue-1111

Conversation

@AlseinX
Copy link
Copy Markdown

@AlseinX AlseinX commented Apr 17, 2026

Summary

  • Session scanner now updates its projectDir when Claude's SessionStart hook reports a cwd change (e.g. entering a worktree)
  • Adds onCwdChange callback mechanism to Session class (same pattern as existing sessionFoundCallbacks)
  • Hook handler in runClaude.ts passes data.cwd to session, which notifies scanner
  • Scanner stops old watchers, updates path, and re-syncs

Test plan

  • Code review confirms the cwd-change callback pattern matches existing sessionFoundCallbacks
  • Cleanup (removeCwdChangeCallback) is called in finally block
  • Scanner re-uses existing sync.invalidate() after path update

Fixes #1111

🤖 Generated with Claude Code

When Claude enters a worktree, it changes cwd but the session scanner
kept watching the original project directory for transcript files.
Now the SessionStart hook's cwd field is used to detect worktree
changes and update the scanner's projectDir, stopping old watchers
and re-syncing to the new path.

Fixes slopus#1111

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
m-bers added a commit to m-bers/happy that referenced this pull request Apr 18, 2026
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.

Terminal-started session (happy claude -w): web shows title but no messages

1 participant