github / github/copilot-cli

Extension canvas.open emits malformed opened event and does not reliably focus

Aperta
#4,112 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:plugins
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

## Problem

A user-scoped Copilot CLI extension can register and manually render a canvas, but calling the documented low-level `session.rpc.canvas.open` route on resume does not reliably make the canvas visible and emits a malformed event warning in the extension process.

Copilot CLI version: `1.0.71-0` on macOS arm64.

## Reproduction

1. Register a canvas through `joinSession({ canvases: [...], requestCanvasRenderer: true })`.
2. After detecting a resumed session, resolve the canvas through `session.rpc.canvas.list()`.
3. Call `session.rpc.canvas.open` with the exact returned provider ID:

```js
await session.rpc.canvas.open({
extensionId: declared.extensionId,
canvasId: declared.canvasId,
instanceId: "stable-instance",
input: { key: "example" },
});
```

A complete implementation and focused tests are available in [the Session Briefing adapter](https://github.com/scotttesler/dotfiles/blob/017f0d30d7c8beb4913634e3a4ffdfbe17e83547/agents/copilot/extensions/session-briefing/adapter.mjs) and [its test](https://github.com/scotttesler/dotfiles/blob/017f0d30d7c8beb4913634e3a4ffdfbe17e83547/agents/copilot/extensions/session-briefing/adapter.test.mjs).

## Actual behavior

- The `canvas.open` promise resolves; the extension's bounded failure diagnostic does not run.
- The extension process logs `failed to deserialize session.canvas.opened payload`.
- The resumed CLI does not reliably show/focus the canvas.
- The SDK rejects the event because the payload does not satisfy `OpenCanvasInstance` (provider identity, instance/canvas IDs, `reopen`, and `availability`).

## Expected behavior

The returned/opened snapshot and `session.canvas.opened` event satisfy the bundled SDK schema, and reopening a stable instance visibly focuses the canvas.

## Additional evidence

- The same canvas renders successfully when opened through the host's `open_canvas` tool with the explicit provider ID.
- Omitting `extensionId` and passing the exact ID returned by `canvas.list()` both produce the malformed-event warning.
- The canvas ID is unique in the session.

A small diagnostic option to log or expose the rejected event shape would also make this class of failure much easier to debug without instrumenting the SDK.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dall’adattatore Session Briefing e dal relativo adapter.test.mjs, quindi traccia la route session.rpc.canvas.open e la gestione dell’evento session.canvas.opened. Confronta lo snapshot e l’evento restituiti con lo schema OpenCanvasInstance incluso. È completato quando l’evento viene deserializzato correttamente e la riapertura di un’istanza stabile porta visibilmente il canvas in primo piano.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
api, cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.