github / github/copilot-cli

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

Aperta
#3,256 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:non-interactive area:sessions
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

## 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.