[BUG] Desktop: finished Project threads keep live sessions and fill the process cap, so new Project sessions are refused
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
A claude.ai Project cannot start a new session on my Mac. It shows:
Couldn't start in ~/Projects/my-app The maximum number of sessions are already running in your folder. End an existing session in that folder, then try again.
The slots are held by Project threads that finished long ago. Their pull requests are merged, and they do nothing. Three problems together cause this:
- Finished threads come back after each restart. Each Project thread starts a local Code session over Remote Control (
admitted (new, nudge poll)inremote-control.log). After each desktop app restart, the Project resumes every thread it holds (admitted (resume, nudge poll)), finished threads included. Each one gets a live process again and takes a slot. - The desktop app never frees those slots. The process cap is
max(6, floor(totalmem / 3 GiB)), so it is 8 on a 24 GB Mac. The governor can stop an idle session to make room, but its victim filter skips a session that has Remote Control on. A Project start does not evict at all:admit()returnscli_capand the start is refused (refused (cli_cap)inremote-control.log). - I cannot end them from the Mac side.
archive_sessionrefuses each one with "it still has live work (an agent run, a Remote Control client, a queued message or a background task)". The sessions run no task. The only children are MCP servers. Turning Remote Control off is refused too: "Remote Control was started from your phone or claude.ai and stays on for this session."
Result: 5 idle, finished threads plus 3 working sessions fill all 8 slots, and the Project cannot start its next thread.
The refusal message is also wrong. It says "in your folder", but cli_cap is an app-wide cap over every folder.
What Should Happen?
- A thread whose work is finished (for example, its pull request merged, or it has been idle for a long time) does not keep a process that blocks new Project sessions.
- One of these should be true:
- The Project does not resume finished threads after a restart.
- The governor can evict an idle Remote Control session for a Project start, as it does for a user start.
- The Mac side can end a Project thread's session.
- The refusal message names the real limit: the number of live sessions on the device, not in the folder.
- The cap can be set by the user. This Mac runs 8 sessions with memory to spare.
Error Messages/Logs
remote-control.log
11:41:10 admitted (new, nudge poll) session=cse_…: ~/Projects/my-app
11:42:07 refused (cli_cap) session=cse_…: ~/Projects/my-app
11:42:07 refusal delivered (cli_cap) session=cse_…
11:42:24 refused (cli_cap) session=cse_…: ~/Projects/my-app
main.log
[CliGovernor] at cap=8; would evict local_… (idle 1478s) for user spawn
[CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 8 effective
For each of the finished threads, remote-control.log shows admitted (resume, nudge poll) after each app restart.
Steps to Reproduce
- On a Mac with the desktop app, turn on Remote Control for a folder, and connect a claude.ai Project to it.
- In the Project, start enough threads to fill the cap (8 on a 24 GB Mac). Let them finish their work.
- Restart the desktop app. The Project resumes every thread, and each one gets a live process.
- In the Project, start a new thread. It is refused with the "maximum number of sessions" message.
- On the Mac, try to archive one of the finished sessions with the session tools. It is refused as "live work".
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.281 (Claude Code), desktop app 2.9939.2
Platform
Anthropic API
Operating System
macOS 27.0
Additional Information
24 GB RAM. The refusal says the sidebar can still archive these sessions. Ending the thread in the Project is the other way I know to free the slot.
4 Comments
Same issue observed.
<img width="1226" height="274" alt="Image" src="https://github.com/user-attachments/assets/7d042f32-eaff-4556-be1f-03f0e59010b8" />
Same here on macOS, 18 GB RAM, Claude desktop app 2.9939.4, so the cap is 6. Project threads are refused with
refused (cli_cap)in~/Library/Logs/Claude/remote-control.logwhile 6+ sessions are loaded (main.log[CliGovernor] … N effective). Code-tab sessions can still start past the cap; project threads can't.What makes it stick: the memory-pressure sweep logs "evicted 0 of 0 idle" because it skips any session with Remote Control enabled. With "Connect new sessions to Remote Control" on, that's every session, so idle sessions never free a slot. Archiving stopped project threads frees nothing. Only archiving loaded Code-tab sessions does.
Workaround so far: archive finished sessions by hand. Settings → Claude Code → "Archive inactive sessions" helps over days but not same-day. A visible "N of 6 loaded" indicator, or letting idle Remote Control sessions be evicted, would fix it for us.
Same behaviour on Linux with
claude remote-control --spawn worktreein server mode, Claude Code 2.1.284. Three Projects share one folder. The folder's slots were all taken, and a new thread got "The maximum number of sessions are already running in your folder. End an existing session in that folder, then try again." The app then showed the "Allow Claude to work in a folder on your device" card with every other folder listed, which reads as an approval problem when the folder is simply full. In my case the cap was one I had set myself with--capacity 4, so raising it fixed the immediate problem. The card is still misleading.Related request: #98385 (folder approvals that survive a Remote Control server restart).
Seeing this on the same versions (desktop app 2.9939.2, Claude Code 2.1.281, macOS 14.4.1, 24 GB RAM), but in a worse form: the live session count goes far past the cap instead of refusing new starts.
Governor log, first memory-pressure line per day (
main.log):The cap on this machine is 8 (
at cap=8; would evict …appears earlier in the logs). The last eviction that actually happened was2026-09-25 12:44 [CCD] Pausing session local_… (governor_evict). After that,at cap; yielding warm spawnkeeps being logged, but sessions keep being admitted anyway.Remote Control correlation:
Enabling remote control for session local_…was logged for 20 sessions on Sep 25 and 30 on Sep 26, the same two days the live count jumped from 1 to 49. That fits the victim filter skipping Remote Control sessions. There is noremote-control.logon this machine, so I couldn't checkadmitted (resume, …).Impact: 66
claudeprocesses were spawned by the desktop app, 62 of them more than a day old. Together they had a ~15.6 GB footprint, plus ~3.9 GB of per-session stdio MCP server processes (one per session). On a 24 GB Mac, swap reached 21.8 of 22.5 GB and the load average reached ~227. The whole machine was unusable until the sessions were cleared.So besides the eviction filter, something admits Remote Control sessions without counting them against the cap. A session that gets past the cap is never evicted afterwards, so the count only grows.