VS Code extension: sessions that used EnterWorktree are not restored after restarting VS Code (they open as "Untitled")

Aperta
#112,803 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
git, typescript, vscode
Ambito
tooling

Direzione di ricerca

Start from the panel restore path in the VS Code extension, which looks up sessions only in the workspace's project directory under ~/.claude/projects/. Reproduce by calling EnterWorktree in one session, then restarting, and compare the transcript location with the one that restores. Done means restored panels find sessions stored in .claude/worktrees/<name> project directories, or transcripts stay in the original directory. The issue does not name the source files, and the fix touches session storage, so this needs maintainer input.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:ide bug has repro platform:macos platform:vscode

Environment

  • Claude Code VS Code extension (macOS, Darwin 27.0.0)
  • Model: Opus 5.5

Steps to reproduce

  1. Open a git repository folder in VS Code (e.g. ~/projects/my-app).
  2. Open a Claude Code panel and start a conversation.
  3. During the conversation, ask Claude to work in a worktree, so that it calls EnterWorktree (cwd becomes my-app/.claude/worktrees/<name>).
  4. Open another Claude Code panel and have a conversation that does not use EnterWorktree.
  5. Restart the machine (or quit and reopen VS Code).

Expected
Both panels come back with their conversations.

Actual

  • The conversation without EnterWorktree is restored.
  • The conversation that used EnterWorktree reopens as an empty "Untitled" panel.

Observation
The transcripts are not lost. They are saved under a different project directory:

  • Restored session: ~/.claude/projects/-<path>-my-app/<session-id>.jsonl
  • Not restored: ~/.claude/projects/-<path>-my-app--claude-worktrees-<name>/<session-id>.jsonl

I checked three sessions. Both sessions that called EnterWorktree (15 and 19 times) were stored in the worktree directory and were not restored. The one session that entered the worktree only with cd (0 calls) was stored in the main directory and was restored. My guess is that panel restore only looks in the project directory for the workspace folder, so it never finds sessions whose transcript moved to the worktree's directory.

Suggested fix
When restoring a panel, find the session by its ID across the workspace's worktree project directories as well. Or keep the transcript of a session that called EnterWorktree in the original project directory.

Lingua principale
TypeScript
Stelle
157k
Fork
25.1k
Merge medio
20h 25m
PR unite (30g)
4

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anthropics/claude-code

Tutte le issue di anthropics/claude-code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.