github / github/copilot-cli

ACP mode does not advertise session.fork capability (slash /fork exists; ACP method missing)

未關閉
#3,256 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:non-interactive area:sessions
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

## Summary

The Copilot CLI's ACP mode (`agency copilot --acp`, wrapping copilot 1.0.45) does **not** advertise a `fork` capability in its `InitializeResponse.agentCapabilities.sessionCapabilities`, even though the v1.0.45 PTY UI does ship a working `/fork` slash command (release notes; #3252).

This blocks ACP-only clients from using the SDK's `unstable_forkSession()` to do things like generate summaries off a fork without polluting the original session.

## Probe result

Sending an `initialize` JSON-RPC over stdio:

```bash
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{"fs":{"readTextFile":false,"writeTextFile":false},"terminal":false}}}' \
| agency copilot --acp
```

returns:

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": 1,
"agentCapabilities": {
"loadSession": true,
"mcpCapabilities": { "http": true, "sse": true },
"promptCapabilities": { "image": true, "audio": false, "embeddedContext": true },
"sessionCapabilities": { "list": {} }
},
"agentInfo": { "name": "Copilot", "title": "Copilot", "version": "1.0.45" },
...
}
}
```

`sessionCapabilities` only contains `list`. No `fork`.

## Why we want it

Downstream context: [copilot-ide](https://github.com/shachaf-ashkenazi/copilot-ide) generates session summaries by shelling out to `agency copilot -p "..."`, which spawns a one-shot session, gets a response, and exits. We then have to:

- Snapshot `~/.copilot/session-state/` before the spawn
- Diff after to find the scratch session(s) the CLI created
- `rm -rf` them so they don't pollute the user's SessionList

That's ~60 lines of cleanup ceremony in `summaryService.ts` plus a `SCRATCH_PREFIXES` filter elsewhere. With `session.fork` exposed in ACP, the entire dance collapses to:

```
forkSession(originalId) → connection.prompt(...) → collect chunks → closeSession()
```

— no on-disk pollution, no snapshot/diff, no scratch sessions ever appearing in the user's list.

The SDK side already has it: `@agentclientprotocol/sdk` v0.21.0 ships `unstable_forkSession()` documented as "allowing operations like generating summaries without affecting the original session's history." We just need the agent (Copilot CLI) to advertise the capability and respond to the corresponding ACP method.

## Ask

1. Add `fork` to `sessionCapabilities` in the ACP `InitializeResponse` (and implement the corresponding `session.fork` / `session/fork` ACP method, following the SDK's `unstable_forkSession` shape).
2. If there's a stability/timeline concern (the SDK still flags it `unstable_`), it'd be useful to know what's blocking stabilization.
3. Confirm whether the existing v1.0.45 `/fork` slash command can be wired to the same backend, or whether the ACP path needs a separate implementation.

## Environment

- agency 2026.5.11.1 (wrapping Copilot CLI 1.0.45)
- @agentclientprotocol/sdk 0.21.0
- macOS (aarch64)

## Related

- Internal slash command: github/copilot-cli#3252 (`/fork` shipped in v1.0.45)
- Downstream tracker: shachaf-ashkenazi/copilot-ide#37
- SDK audit that surfaced this: shachaf-ashkenazi/copilot-ide#32

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。