copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

ACP mode does not implement session/close — ACP clients cannot release sessions

Open DDKinger opened this issue 4 months ago • 1 comments

Summary

When Copilot CLI runs as an ACP agent (copilot --acp --stdio), it does not implement the ACP session/close request, and its initialize response does not advertise the sessionCapabilities.close capability. As a result an ACP client has no protocol-level way to tell Copilot that a session it created via session/new is finished and can be torn down.

For a client that multiplexes many sessions over a single long-lived copilot --acp process, every session ever created stays resident for the lifetime of the Copilot process. session/cancel only aborts the in-flight turn — it does not release the session — so there is no clean way to reclaim per-session resources short of killing the whole agent process.

Environment

  • GitHub Copilot CLI 1.0.71-0
  • Transport: copilot --acp --stdio

Reproduction

Minimal repro with any ndjson JSON-RPC driver over copilot --acp --stdio:

  1. Send initialize { "protocolVersion": 1, "clientCapabilities": {} } → note sessionCapabilities has no close.
  2. Send session/new { "cwd": "<abs path>", "mcpServers": [] } → capture sessionId.
  3. Send session/close { "sessionId": "<id>" } → observe -32601 "Method not found": session/close.

Expected behavior

  • Copilot CLI should advertise sessionCapabilities.close and implement session/close, allowing ACP clients to release an individual live session without terminating the shared Copilot process.

  • Closing a session should free its in-memory resources while preserving its persisted transcript so it can be resumed later via session/load.

Why this matters

ACP was designed for a client to own the process lifetime while opening and closing many sessions against it. Without session/close:

  • No per-session teardown → unbounded growth: clients can only session/cancel  (turn abort) or kill the entire process; there is no way to release a single finished session. As a result, a long-lived host accumulates every session it ever created for the whole process lifetime, with no bounded-lifetime path and no way to reclaim resources without tearing down every other session sharing that process.

References

  • ACP session/close method and sessionCapabilities.close capability: https://agentclientprotocol.com/protocol/v1/session-setup

DDKinger avatar Jul 14 '26 02:07 DDKinger

Downstream verification update: Copilot CLI 1.0.81 advertises ACP sessionCapabilities.close, and session/close successfully releases an individual session while preserving the shared ACP process. Intelligent Terminal integrated that capability for replaced and tab-owned sessions through microsoft/intelligent-terminal#610 and microsoft/intelligent-terminal#637; the tab-close path shipped in Intelligent Terminal v0.2.2395 (v0.2.23). Unsupported ACP providers still degrade to best-effort cancel plus logical retirement without crashing the host.

yeelam-gordon avatar Sep 01 '26 04:09 yeelam-gordon