Skip to content

fix: preserve newlines in Git worktree session paths - #1472

Open
Linxiushen wants to merge 1 commit into
anthropics:mainfrom
Linxiushen:fix/worktree-nul-session-paths
Open

Linxiushen wants to merge 1 commit into
anthropics:mainfrom
Linxiushen:fix/worktree-nul-session-paths

Conversation

@Linxiushen

Copy link
Copy Markdown

When a linked Git worktree directory contains a newline, session discovery splits its path as if it were another porcelain field. This can omit the worktree's sessions; a newline followed by worktree can also make the listing include sessions stored under an unrelated project.

Read NUL-delimited git worktree list --porcelain -z output to preserve each path. Real-Git regressions exercise list_sessions and get_session_info, an ordinary space-containing path, and include_worktrees=False. This fixes LF field framing separately from #1225's encoding change.

Validation:

  • New regressions on unchanged upstream: 2 failed, 1 passed; fixed regressions: 3 passed, including a separate reviewer's run.
  • Linux full suite: 1646 passed, 6 skipped. Ruff check/format and mypy pass.
  • Windows: ordinary-path control passes; the two POSIX-only newline cases are skipped.

AI assistance: Codex implemented and tested this change. Tests use real Git and synthetic session transcripts; no live Claude session was run.

This branch has not been deployed

No deployments
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.

1 participant