Canvas open_canvas arguments corrupted by CLI — JSON-RPC serialization bug
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
Describe the bug
The CLI corrupts JSON-RPC arguments when dispatching tool calls to canvas extensions. The model's parsed arguments are concatenated with a trailing }{} suffix, causing malformed JSON. For open_canvas, the truncation happens mid-value producing "Unexpected end of JSON input" errors. The extension never receives any request.
This is reproducible in every session, not just with canvas extensions — list_canvas_capabilities, extensions_manage, and other tools also receive corrupted arguments.
Affected version
GitHub Copilot CLI 1.0.82
Steps to reproduce the behavior
- Install any canvas extension (e.g.,
session-md-reader) in~/.copilot/extensions/ - Start a session and ask Copilot to open the canvas, or trigger any tool call that passes arguments with nested JSON (e.g.,
open_canvas) - Observe the tool call fails with "Unexpected end of JSON input" and
wasSyntaxError: true
Live reproduction in this session (CLI v1.0.82):
# open_canvas — arguments truncated mid-value:
The arguments for the tool call 'open_canvas' were not valid JSON.
Arguments: {"canvasId": "session-md-reader", "input": .
JSON parse error: Unexpected end of JSON input
# list_canvas_capabilities — trailing }{} appended:
The arguments for the tool call 'list_canvas_capabilities' were not valid JSON.
Arguments: {"canvasId": "session-md-reader"}{}.
JSON parse error: Unexpected non-whitespace character after JSON at position 33
# edit — trailing }{} appended:
The arguments for the tool call 'edit' were not valid JSON.
Arguments: {}{}.
JSON parse error: Unexpected non-whitespace character after JSON at position 2
# extensions_manage — trailing }{} appended:
The arguments for the tool call 'extensions_manage' were not valid JSON.
Arguments: {"operation": "inspect", "name": "session-md-reader"}{}.
JSON parse error: Unexpected non-whitespace character after JSON at position 53
Session events log evidence (session 96897afc-a61a-4dc0-8438-12630294f8bd):
| Turn | Tool | Result |
|---|---|---|
| 0 | open_canvas |
success: false, "Unexpected end of JSON input", wasSyntaxError: true |
| 1 | open_canvas (retry) |
Same error |
| 2 | list_canvas_capabilities |
✅ Success (no complex arguments needed) |
| 3 | open_canvas (with extra param) |
Same error |
The toolRequests in the assistant message shows "arguments":{} even though the model correctly outputs <parameter=input>{"sessionUuid": ...} in markdown. The CLI's markdown-to-JSON parser fails to extract the parameter values.
Expected behavior
Tool call arguments should be correctly serialized to valid JSON and dispatched to the extension via JSON-RPC. The extension should receive the full arguments object (e.g., {"canvasId": "session-md-reader", "instanceId": "session-md-reader-96897afc", "input": {"sessionUuid": "..."}}).
Additional context
- Extension logs: The extension shows only
=== ready ===— it never receives any requests because the CLI fails before dispatching. - Extension health: The extension is correctly implemented (valid
inputSchema,requestCanvasRenderer: true, properopenhandler returning{url, title, status}). Verified by/extensions manageshowing it as running. - Reproducibility: 100% reproducible. The bug affects all tools that pass arguments, not just canvas tools.
- Model used: mimo-v2.5 (tool calls output in markdown
<tool_call>format) - OS: Windows 11 (x86_64), PowerShell 7
- Terminal: Windows Terminal
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với các đối số công cụ JSON lồng nhau và theo dõi trình phân tích markdown-sang-JSON của CLI qua quá trình xây dựng toolRequests và điều phối JSON-RPC. So sánh các đối số đã được phân tích với đầu ra markdown của mô hình và xác minh rằng open_canvas, edit và extensions_manage đến được extension với đúng một đối tượng JSON hoàn chỉnh và hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- json, markdown, shell
- Lĩnh vực
- api, cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100