Concurrent thread resume from two terminals causes shared task state and data loss
Resolved 💬 3 comments Opened Mar 26, 2026 by dbasclpy Closed Mar 29, 2026
Bug Description
When the same conversation thread is resumed simultaneously from two separate terminal instances (e.g., claude --resume in Terminal A while Terminal B is already running the same thread), the task lists merge across both sessions. When one terminal is quit, the other terminal's in-flight background agents are orphaned and their work is lost with no way to recover.
Steps to Reproduce
- Open Terminal A, start a Claude Code session — begin working on Task A with background agents
- Open Terminal B, run
claude --resume(or resume the same thread from the session picker) - In Terminal B, start working on an unrelated Task B — create tasks, launch subagents
- Observe: Terminal A's task list now shows Terminal B's tasks mixed in (and vice versa)
- Quit Terminal B (Ctrl+C or close the terminal)
- Observe: Terminal A still shows the mixed task list. Terminal B's subagents are killed silently. No way to resume Terminal B's session — it does not appear as a separate resumable thread.
Expected Behavior
One of:
- Thread locking: Second terminal should be warned that the thread is already active in another process and either block resume or fork a new session
- Session isolation: Tasks and subagents should be namespaced per terminal process, not shared at the thread level
- Graceful recovery: Orphaned subagents should be resumable, or at minimum their partial output should be persisted
Actual Behavior
- Task lists are globally shared per thread ID across all terminal processes
- Tasks from both sessions are interleaved with no indication of which terminal owns which
- Background agents launched by Terminal B are silently killed when Terminal B exits
- Terminal B's conversation is merged into Terminal A's session JSONL — there is no separate session file to resume
- The work done by Terminal B's subagents (file reads, analysis, in-progress code changes) is permanently lost
Impact
- Users who habitually open multiple terminals for different workstreams on the same project can accidentally corrupt session state
- Background agent work (which can represent significant LLM cost and time) is silently discarded
- No warning or error is surfaced — the failure mode is silent data loss
Environment
- Claude Code version: 2.1.83
- Platform: WSL2 (Ubuntu 22.04.5 LTS, kernel 6.6.87.2-microsoft-standard-WSL2)
- Node: v24.1.0
- Terminal: Two separate zsh terminal instances in the same WSL2 distro
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗