Summary
/codex:transfer fails after a Claude Code session creates or enters a Git worktree because the Codex plugin keeps the transcript path recorded at SessionStart. Claude subsequently stores the same session ID under the worktree-specific project directory.
Environment
- Claude Code:
2.1.210
- codex-plugin-cc:
1.0.5
- Linux
- Git worktree workflow via Claude Code
Reproduction
- Start Claude Code in a repository root.
- In that same Claude session, create or enter a Git worktree.
- Run
/codex:transfer.
The plugin invokes transfer using the CODEX_COMPANION_TRANSCRIPT_PATH value written by its SessionStart hook.
Actual result
The environment value still points at the original project directory, for example:
~/.claude/projects/-home-...-sh-backend-api/<session-id>.jsonl
That file no longer exists. The real transcript with the exact same session UUID is stored at:
~/.claude/projects/-home-...-sh-backend-api--worktrees-SH-5471/<session-id>.jsonl
Transfer therefore fails with:
Claude session file not found: ~/.claude/projects/.../<session-id>.jsonl
Passing the real path explicitly works around this particular stale-path lookup. Long absolute paths are also easy to accidentally split across lines in the slash command, producing a misleading must be a JSONL file error; that is secondary to the stale automatic lookup.
Expected result
/codex:transfer should transfer the current session after Claude enters a worktree, without requiring users to find the JSONL path manually.
Suggested fix
In resolveClaudeSessionPath(), when CODEX_COMPANION_TRANSCRIPT_PATH is missing:
- Take its basename/session UUID.
- Search only under
~/.claude/projects for the exact <session-id>.jsonl.
- Use the result only if exactly one matching file exists; otherwise retain the current error and show candidate paths or require
--source.
This is deterministic, preserves the current security boundary, and handles Claude worktree-specific project-directory naming.
Summary
/codex:transferfails after a Claude Code session creates or enters a Git worktree because the Codex plugin keeps the transcript path recorded atSessionStart. Claude subsequently stores the same session ID under the worktree-specific project directory.Environment
2.1.2101.0.5Reproduction
/codex:transfer.The plugin invokes transfer using the
CODEX_COMPANION_TRANSCRIPT_PATHvalue written by its SessionStart hook.Actual result
The environment value still points at the original project directory, for example:
That file no longer exists. The real transcript with the exact same session UUID is stored at:
Transfer therefore fails with:
Passing the real path explicitly works around this particular stale-path lookup. Long absolute paths are also easy to accidentally split across lines in the slash command, producing a misleading
must be a JSONL fileerror; that is secondary to the stale automatic lookup.Expected result
/codex:transfershould transfer the current session after Claude enters a worktree, without requiring users to find the JSONL path manually.Suggested fix
In
resolveClaudeSessionPath(), whenCODEX_COMPANION_TRANSCRIPT_PATHis missing:~/.claude/projectsfor the exact<session-id>.jsonl.--source.This is deterministic, preserves the current security boundary, and handles Claude worktree-specific project-directory naming.