claude-code - 💡(How to fix) Fix [Bug] Git repository state not refreshed when entering worktree in continued session [1 participants]

Official PRs (…)
ON THIS PAGE

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#52339Fetched 2026-04-24 06:09:47
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description when git is created in session and you continue that session and go into a worktree is_git_repository is still set to false and does not refresh to true after git creating and hence the enterworktree tool fails and it forces the user to exit the session and resume for the tool to work

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.118
  • Feedback ID: 6f228296-f60b-4392-8152-7dc8ba656421

Errors

[]

extent analysis

TL;DR

The issue can be potentially resolved by refreshing the is_git_repository flag after creating a Git repository in the session.

Guidance

  • The is_git_repository flag is not updating correctly after creating a Git repository, causing the enterworktree tool to fail.
  • To mitigate this, try manually refreshing the session or re-checking the Git repository status after creation.
  • Investigate if there's an API or command to explicitly update the is_git_repository flag.
  • Consider adding a delay or retry mechanism to allow the flag to update before attempting to use the enterworktree tool.

Notes

The issue seems to be related to the session management and Git repository detection in the ghostty terminal. Without more information about the underlying implementation, it's difficult to provide a definitive fix.

Recommendation

Apply workaround: Implement a retry mechanism or delay to allow the is_git_repository flag to update before using the enterworktree tool, as the root cause of the issue is unclear and a direct fix is not apparent.

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