Skip to content

Limit the number of idle/standby PowerShell consoles (default: 10) #40

@doraemonkeys

Description

@doraemonkeys

Is your feature request related to a problem? Please describe.
When using multiple projects, or spawning multiple sub-agents in the same project, PowerShell.MCP can keep opening new
visible PowerShell windows on Windows.

Over time, the desktop fills up with standby consoles that are no longer actively used. This becomes especially
noticeable in long-running agent workflows.

From reading the implementation, this appears to be a lifecycle / resource-management gap rather than just a UX
preference:

  • start_powershell_console only reuses an existing standby console when reason is empty.
  • If reason is provided, it always forces a new console.
  • On Windows, new sessions are launched with CREATE_NEW_CONSOLE, so each additional session becomes a visible
    window.
  • I could not find a limit or eviction policy for idle/standby consoles.

Describe the solution you'd like
Add a configurable maximum number of idle/standby consoles, with a default of 10.

Suggested behavior:

  • Never terminate busy consoles.
  • Reuse an existing standby console whenever possible.
  • If the standby pool is already at the limit, either:
    • reuse one of the existing standby consoles, or
    • close the oldest / least-recently-used standby console before creating a new one.
  • Ideally this limit should apply globally across PowerShell.MCP instances on the machine, or at least per proxy
    process if global coordination is too large for now.

Describe alternatives you've considered

  • Manually closing extra windows.
  • Avoiding reason so reuse can happen, but some agent/sub-agent workflows still need isolated sessions and can
    accumulate many windows.
  • Hiding windows on Windows, but that only masks the symptom; pool lifecycle control seems like the root fix.

Additional context
This issue is much more visible on Windows because every additional session is a visible terminal window.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions