[Bug] `/compact` creates duplicate live sessions operating on same directory
Bug Description
# Draft report for Anthropic (Claude desktop app, Code tab)
Title: After /compact, a "(fork)" session appeared and the original session continued to run; both acted on the same folder
Environment
- Claude desktop app for Linux (Code tab), Claude Code 2.1.271, model claude-fable-5-1.
- OS: Linux (Omarchy), Wayland. Remote Control was on for both sessions.
- Permission mode of the fork: bypassPermissions.
What happened (times are BST, 2026-09-20)
1. 20:55 — Session "Codex/Opus workflow orchestration" started (local_43c690cc-8eb7-4c3d-996f-08a0fbf6aefd; transcript bb12f0d7-…). It ran long background shell tasks.
2. About 22:30 — The conversation reached its context limit and /compact ran. A new session appeared with the title "Codex/Opus workflow orchestration (fork)" (local_a85c11ae-6937-40a6-8918-1ff4073db6ed). The user did not ask for a fork, as far as he knows.
3. The fork received this notice: "3 background shell command tasks didn't finish before the previous session ended… They have been marked stopped." This was not true. The original session's process (started 20:55:40) was still alive and still owned those tasks.
4. 22:32 to 22:41 — The original session continued its turn without user input. It launched two more background workers. The fork launched the same two workers. Both wrote to the same files and the same scratch scripts.
5. The fork found the collision only by a process-parent trace (ps) and list_sessions.
Expected
- A compaction does not create a second live session. Or, if a fork is intended, the original stops (or the user sees a clear choice).
- The "tasks didn't finish / marked stopped" notice is not shown while the owner process still runs those tasks.
- A fork gets its own scratchpad path. Here the fork's summary pointed it at the original's scratchpad directory.
Actual
- Two live sessions with the same history and the same standing instructions worked as "lead" in one folder at the same time.
- The user believed he had one conversation.
Impact
- Duplicate agents edited the same documents. One runner script was overwritten. A shared log file holds mixed output. No data loss was found, because both sessions archive before they edit.
Not known
- Whether the fork came from /compact, from a Remote Control reconnect, or from an accidental "fork" action in the UI.
- Whether the original session's later tool calls had a user turn behind them.
Environment Info
- Platform: linux
- Terminal: claude-desktop
- Version: 2.1.274
- Feedback ID: fb5dddf6-672b-4c0f-a853-6c2bc771e0dc
Errors
[]