[BUG] Desktop (Windows): claude://resume imports a CLI session that is still running (claude -p) and starts a second process on it

Open
#111,489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
desktop

Research direction

The repro is fully specified, but the code named in the report (resumeCliSessionNow, importCliSession with its beforeWrite hook, liveOwnershipRefusal, the deep-link handler) lives in the bundled desktop build, not in this repository, so the first step is confirming whether any of that source is reachable here. Reproduce with claude -p --session-id <uuid> plus claude://resume?session=<uuid> and watch the .jsonl in ~/.claude/projects/<project>/ and main.log. Done looks like the deep link running the same live-ownership refusal as the in-app picker.

Written by the indexing model from the issue text.

Description

area:desktop bug has repro platform:windows

Environment

  • Claude desktop 6.28899.2.0 (Windows 11, Microsoft Store/MSIX build)
  • Claude Code 2.1.328 (bundled)

Summary

claude://resume?session=<id> imports a CLI session even while a headless claude -p --session-id <id> run is still writing it. The desktop copies the transcript as it is at that moment, shows it as idle, and starts its own Claude Code process on the same session about 0.1 s later. Two processes then own one session: they write to the same transcript (a duplicate or forked conversation), or the desktop shows a frozen copy while the run continues unseen.

The in-app resume picker checks for a live owner before importing and refuses. The deep-link path skips that check.

Steps to reproduce

  1. Start a long headless run: claude -p --session-id <uuid> "<a task that takes a few minutes>".
  2. While it is still running, open claude://resume?session=<uuid>.
  3. Watch the desktop session and ~/.claude/projects/<project>/<uuid>.jsonl.

Expected

The same behaviour as the in-app resume picker: refuse or wait while the session is running, or follow it read-only until the run ends and then hand it over.

Actual

main.log:

[info] Resume deep link: importing CLI session <id>
[info] Imported CLI session <id> as Desktop session local_<id>
[info] [CCD] Warming session local_<id>
[info] [CCD] Session local_<id> warmed successfully in 110ms

The desktop shows the snapshot as an idle session, and the headless process keeps appending to <id>.jsonl. If the user continues in the desktop, entries with entrypoint: "sdk-cli" and entrypoint: "claude-desktop" interleave in the same transcript.

Data (from 11 days of main.log and the transcripts)

  • 71 resume links in total.
  • 59 were opened after the headless run had ended. All continued cleanly, with no further sdk-cli writes after the import.
  • 11 links (10 sessions) were opened mid-run:
    • 7 sessions got writes from both processes after the import. In 6 the writes were concurrent, for up to about 28 minutes (one run wrote 347 entries after the desktop had started its own process).
    • 3 sessions showed a frozen snapshot while the run kept working for 1 to 5 minutes.

Notes from the bundled code (may be wrong)

  • The resume picker path (resumeCliSessionNow) calls importCliSession with a beforeWrite hook that runs liveOwnershipRefusal and turns a live owner into a refusal.
  • The deep-link handler calls importCliSession(id) with no options, so no live-ownership check runs. The imported record is created with isRunning: false, and the session is warmed straight away.

Related

  • #80773 (a resume link duplicates a session already open as a native Desktop tab)
  • #99349 (a resume link handled twice breaks worktree sessions)
Dominant language
TypeScript
Stars
156k
Forks
25k
Avg merge
16h 19m
Merged PRs (30d)
5

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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.

More from anthropics/claude-code

All issues in anthropics/claude-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.