openai / openai/codex-plugin-cc

transfer: stale Claude transcript path after session enters a worktree

Open
#502 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
33.3k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

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

  1. Start Claude Code in a repository root.
  2. In that same Claude session, create or enter a Git worktree.
  3. 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:

  1. Take its basename/session UUID.
  2. Search only under ~/.claude/projects for the exact <session-id>.jsonl.
  3. 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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at resolveClaudeSessionPath() and inspect how the session UUID and ~/.claude/projects path are handled when the transcript environment value is unavailable. Reproduce the Git worktree case, then verify that exactly one matching JSONL is selected and that ambiguous or missing matches retain the current error with useful candidates.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, javascript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.