Skip to content

Windows: MCP worker survives exit when launched through a wrapper #4972

Description

@svens

Describe the bug

Problem: Exiting the session terminates the MCP launch wrapper but leaves its descendant worker running.

Affected launch chain:

cmd.exe /c run-server.cmd
`- dotnet run --no-build --project ExampleMcpServer.csproj
   `- ExampleMcpServer.exe                                                                                                                                                                                                                                                  

Affected version

GitHub Copilot CLI 1.0.88.

Steps to reproduce the behavior

  1. Configure a local stdio MCP server to launch through a .cmd wrapper running dotnet run.
  2. Start Copilot and wait for the server to initialize.
  3. Exit the session.
  4. Observe that the wrapper terminates but the MCP worker remains alive.

Expected behavior

Terminate the complete session-owned MCP process tree, allowing a bounded graceful shutdown.

Additional context

Suggested fix (copilot generated): Own the process tree using a Windows Job Object with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE. Assign the initial process before it spawns descendants. Cover normal exit, supervisor crashes, and shutdown during startup or an active request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions