Skip to content

fix(worktree): count a tmux pane by where it started as well - #28

Merged
tak-bro merged 1 commit into
mainfrom
fix/tmux-pane-start-path
Oct 29, 2026
Merged

tak-bro merged 1 commit into
mainfrom
fix/tmux-pane-start-path

Conversation

@tak-bro

@tak-bro tak-bro commented Oct 29, 2026

Copy link
Copy Markdown
Member

요약

tmux 3.6(GitHub ubuntu-26.04 runner)에서는 new-session -c <dir> 직후 약 10ms 동안 #{pane_current_path} 가 pane 의 디렉터리가 아니라 tmux 서버의 cwd 를 돌려준다. listener 는 세션이 막 생긴 시점에 worktree 를 정리하기 때문에, 이 창에 걸리면 세션을 재시작한 worktree 가 비어 있다고 판정될 수 있었다. 그 worktree 가 깨끗하고 푸시까지 끝난 상태면 세션이 도는 도중에 지워진다. 데이터는 잃지 않는다.

변경

  • readPaneCwds 가 #{pane_start_path} 도 같이 읽는다. 이 값은 -c 로 준 경로 그대로라서 realOrSelf 로 실제 경로로 바꾼 뒤 비교한다(src/worktree.ts).
  • 단위 테스트를 추가했다. tmux 가 current path 로 서버 cwd 를 돌려주는 상황에서도 start path 로 pane 을 잡는지 본다(src/worktree.test.ts). 수정 전 코드에서는 실패하는 것을 확인했다.
  • ci: pin test and release jobs to ubuntu-24.04 #27 의 ubuntu-24.04 고정을 풀어 ubuntu-latest 로 되돌렸다(test.yml, publish.yml).

검증

  • 로컬: npm run build 통과. vitest 208 파일, 5555 테스트 통과. src/http-proxy.test.ts 는 깨끗한 main 에서도 실패하는 로컬 환경 문제라 제외했다.
  • 이 PR 의 CI 를 ubuntu-latest(26.04, tmux 3.6)에서 돌리면 실제 tmux 를 쓰는 worktree 테스트가 다시 돈다. 이게 핵심 확인이다.

🤖 Generated with Claude Code

On tmux 3.6 (GitHub's ubuntu-26.04 runner) a pane read within ~10 ms of
`new-session -c <dir>` reports the tmux server's cwd as its current path.
The listener reconciles worktrees right when a session appears, so a
clean, pushed worktree whose session was just restarted could be taken
for abandoned and removed under it.

readPaneCwds now reads #{pane_start_path} as well, resolved like the
worktree paths it is compared with. With that, the real-tmux worktree test
passes on ubuntu-latest again, so the ubuntu-24.04 pin from #27 is undone.
@tak-bro
tak-bro marked this pull request as ready for review October 29, 2026 04:55
@tak-bro
tak-bro merged commit 35ad63b into main Oct 29, 2026
4 checks passed
@tak-bro
tak-bro deleted the fix/tmux-pane-start-path branch October 29, 2026 04:55
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant