Skip to content

fix: use first cwd as launch dir for worktree sessions - #64

Merged
gadflysu merged 5 commits into
masterfrom
fix/62-claude-resume-launch-dir
Jun 26, 2026
Merged

gadflysu merged 5 commits into
masterfrom
fix/62-claude-resume-launch-dir

Conversation

@gadflysu

Copy link
Copy Markdown
Owner

Summary

  • parseJSONL now returns both cwd (last non-empty, for display/filter) and launchDir (first non-empty, for launching)
  • Session gains a LaunchDir field; MetaEntry caches it
  • main.go passes LaunchDir (fallback CWD) to the launcher instead of CWD

Test plan

  • go test ./... passes (3 new tests: TestParseJSONL_LaunchDirIsFirstCWD, TestParseJSONL_LaunchDirEqualsDisplayCWD_WhenNoWorktreeChange, TestSession_LaunchDir_SetFromFirstCWD)
  • Non-worktree sessions unaffected (LaunchDir == CWD when cwd never changes)
  • Worktree session whose transcript tail cwd is .claude/worktrees/... resumes from the original project root

Closes #62

gadflysu added 5 commits June 26, 2026 13:54
Claude resolves transcript storage from the launch directory namespace.
When a session starts in the project root but later records move into a
.claude/worktrees/ path, the last-wins cwd caused aps to cd into the
worktree before resuming — making Claude search a namespace that holds
no transcript.

Fix: parseJSONL now returns both cwd (last non-empty, for display/filter)
and launchDir (first non-empty, for launcher.Claude). Session gains a
LaunchDir field; MetaEntry caches it. main.go passes LaunchDir to the
launcher instead of CWD. For sessions that never change directory,
LaunchDir == CWD so existing behavior is preserved.

Closes #62
Treat incomplete MetaCache entries as misses so old gob caches without LaunchDir are refreshed from JSONL.

Closes #62
Keep Claude resume launches bound to the recorded launch directory and report when the last session cwd exists but is not used.

Closes #62
@gadflysu
gadflysu force-pushed the fix/62-claude-resume-launch-dir branch from 798effa to 99a09da Compare June 26, 2026 06:07
@gadflysu
gadflysu merged commit 18d0980 into master Jun 26, 2026
4 checks passed
@gadflysu
gadflysu deleted the fix/62-claude-resume-launch-dir branch June 26, 2026 07:28
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.

Claude resume launch directory for worktree sessions

1 participant