claude-code - 💡(How to fix) Fix [BUG] /resume inside worktree session switches cwd to main repo [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45402Fetched 2026-04-09 08:06:15
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2
RAW_BUFFERClick to expand / collapse

Bug Description

When using /resume inside a worktree session to resume a previous session from the same worktree, the cwd switches to the main git repository root instead of staying in the worktree.

Steps to Reproduce

  1. In a git repo, start a worktree session: claude -w my-feature
  2. Claude creates a worktree and starts the session in it
  3. Do some work, create a commit, then exit the session while keeping the worktree
  4. Start a new session in the same worktree: claude -w my-feature
  5. Confirm cwd is the worktree directory -- this works correctly
  6. Use /resume to resume the previous session from step 2
  7. Observe that cwd changes to the main repo root instead of staying in the worktree

Expected Behavior

After /resume, the cwd should remain in (or switch back to) the worktree directory, per the v2.1.81 changelog: "Resuming a session that was in a worktree now switches back to that worktree."

Actual Behavior

The cwd switches to the main git repository root after /resume.

Environment Info

  • Platform: macOS (darwin)
  • Version: 2.1.96
  • Terminal: Ghostty

extent analysis

TL;DR

The issue may be resolved by checking the implementation of the /resume command to ensure it correctly handles worktree sessions and updates the cwd accordingly.

Guidance

  • Verify that the /resume command is correctly implemented to switch back to the worktree directory after resuming a previous session, as stated in the v2.1.81 changelog.
  • Check the code that handles the /resume command to ensure it updates the cwd to the worktree directory instead of the main repository root.
  • Test the /resume command with different worktree sessions to see if the issue is consistent or if it's specific to certain scenarios.
  • Consider checking the Ghostty terminal configuration to ensure it's not interfering with the cwd switching.

Example

No code snippet is provided as the issue lacks specific implementation details.

Notes

The issue may be specific to the version 2.1.96 or the Ghostty terminal, and further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Check the implementation of the /resume command and update it if necessary to ensure correct handling of worktree sessions and cwd switching, as this is a more targeted approach to resolving the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING