[BUG] Desktop: finished Project threads keep live sessions and fill the process cap, so new Project sessions are refused

Status Open
Reported on v2.1.281
Maintainer reply None cached
Activity 4 comments · opened Sep 25, 2026

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:

  1. Finished threads come back after each restart. Each Project thread starts a local Code session over Remote Control (admitted (new, nudge poll) in remote-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.
  2. 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() returns cli_cap and the start is refused (refused (cli_cap) in remote-control.log).
  3. I cannot end them from the Mac side. archive_session refuses 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

  1. On a Mac with the desktop app, turn on Remote Control for a folder, and connect a claude.ai Project to it.
  2. In the Project, start enough threads to fill the cap (8 on a 24 GB Mac). Let them finish their work.
  3. Restart the desktop app. The Project resumes every thread, and each one gets a live process.
  4. In the Project, start a new thread. It is refused with the "maximum number of sessions" message.
  5. 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.

View original on GitHub ↗

4 Comments

oas-admin · 17 days ago

Same issue observed.

<img width="1226" height="274" alt="Image" src="https://github.com/user-attachments/assets/7d042f32-eaff-4556-be1f-03f0e59010b8" />

cec28007 · 15 days ago

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.log while 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.

GeeWow · 14 days ago

Same behaviour on Linux with claude remote-control --spawn worktree in 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).

rasoolsomji · 14 days ago

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):

2026-09-25  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 1 effective
2026-09-26  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 20 effective
2026-09-27  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 49 effective
2026-09-28  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 53 effective
2026-09-29  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 58 effective
2026-09-30  [CliGovernor] memory pressure (warning): evicted 0 of 0 idle session(s), 62 effective

The cap on this machine is 8 (at cap=8; would evict … appears earlier in the logs). The last eviction that actually happened was 2026-09-25 12:44 [CCD] Pausing session local_… (governor_evict). After that, at cap; yielding warm spawn keeps 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 no remote-control.log on this machine, so I couldn't check admitted (resume, …).

Impact: 66 claude processes 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.