Extension canvas.open emits malformed opened event and does not reliably focus
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 6
説明
## 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.
コントリビューションガイド
調査の方向性
Session Briefing adapter とその adapter.test.mjs から始め、session.rpc.canvas.open route と session.canvas.opened event の処理を追跡します。返される snapshot と event を、同梱されている OpenCanvasInstance schema と比較します。event が正常にデシリアライズされ、安定した instance を再度開くと canvas に視覚的にフォーカスが移ることを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- api, cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100