--continue / --resume doesn't check the existing live-session registry before re-opening a session already running in another process

Open 💬 5 comments Opened Jun 18, 2026 by g-i-o-r-g-i-o

Problem

claude --continue (and --resume <id> / the picker) reuses the original
session id, so it appends to the same
~/.claude/projects/<proj>/<session>.jsonl. There is currently no check
for whether that session is already open in another live process. Launch
--continue in a directory where a session is already running (a second
terminal / tmux pane on the same project) and two processes end up writing the
same session file, with no warning.
(--fork-session exists precisely to not reuse the id — confirming that
reusing it is the default.)

The needed data already exists

As of v2.1.181 Claude Code already maintains a live-session registry at
~/.claude/sessions/<PID>.json:

{ "pid": 20280, "sessionId": "…", "cwd": "…", "status": "busy", "name": "…" }

One file per live session, PID matches the running claude process, removed on
clean exit. This is essentially the lock-file primitive requested in #19364
(closed as not-planned for inactivity, now locked). The primitive shipped —
what's missing is using it.

Proposed solution

When --continue/--resume is about to resume a session id present in
~/.claude/sessions/ with a still-alive PID (and/or same cwd), Claude Code
should either:

  1. warn and prompt — continue anyway / fork / new session / abort, or
  2. auto-fork (--fork-session) by default, or
  3. at minimum print a non-fatal warning.

Stale entries (PID no longer alive) should just be ignored/cleaned.

Why it matters

Two live processes appending to the same jsonl risks divergent or overwritten
conversation history; concurrent-session anomalies are already reported (#69244).
Today users have to hand-roll a wrapper that reads ~/.claude/sessions/
themselves to get this guard.

Related

  • #19364 — [FEATURE] Add session lock file (the primitive; now effectively exists)
  • #60672 — Process-level active-session tracking + collision guards (broader, git-focused)

Environment

  • Version: 2.1.181 — OS: Windows (mechanism is cross-platform)

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗