github / github/copilot-cli

High-severity 1.0.80+ regression: MCP schemas are eagerly injected, adding 354K startup tokens

Đang mở
#4,613 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

triage
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

Severity / impact: High.

Starting in the 1.0.80 runtime line, the CLI appears to have stopped deferring MCP tool schemas. A fresh session now injects the full ambient MCP catalog into the first model request, even when the user submits a trivial prompt that needs no tools.

With the same configuration and equivalent no-tool prompt:

Runtime First-request input tokens Tool definitions marked deferred
1.0.79 49,084 1,597
1.0.81-3 403,209 0

That is 354,125 additional input tokens, an 8.2x request, and an 87.8% reduction when reverting to 1.0.79. The affected request consumes about 38% of a 1.05M-token model window before substantive work begins. An independent earlier 1.0.80-0 observation used 454,691 input tokens, about 43% of that window.

These numbers come from actual first-assistant-request usage accounting, not the /context display estimate.

The behavior increases startup latency and input cost. It also leaves much less context for conversation history, repository content, and the user's task. Large MCP catalogs are a supported configuration and were handled correctly by deferred loading in 1.0.79.

Affected version

  • Known good: 1.0.79
  • Measured affected: 1.0.80-0, 1.0.81-3
  • Environment: macOS on ARM64, Node.js 25.4.0
  • The newer v1.0.81-11 prerelease has not been tested, so I am not claiming it is affected.

Steps to reproduce the behavior

  1. Configure a valid ambient MCP catalog with many tools. The measured configuration had 56 MCP servers and 1,597 deferred tool definitions on 1.0.79.
  2. Start a fresh CLI session on 1.0.81-3.
  3. Submit a no-tool prompt such as: Reply exactly OK without using tools.
  4. Record the first assistant request's input-token usage.
  5. Inspect debug logs for tool-definition deferral.
  6. Repeat with the same configuration and prompt on package runtime 1.0.79, using --no-auto-update so the launcher cannot select a newer cached runtime.

Observed:

  • 1.0.81-3: 403,209 first-request input tokens and zero tool definitions marked with "deferLoading": true.
  • 1.0.79: 49,084 first-request input tokens and 1,597 tool definitions marked with "deferLoading": true.

The raw logs contain private MCP configuration, so they are not attached. The aggregate counts above were derived after redacting tool and server identities.

Expected behavior

The initial request should include enough MCP metadata to discover available tools, while deferring full input schemas until a tool or server is selected. First-request usage should not grow in proportion to every configured tool's complete JSON schema.

This was the observed behavior in 1.0.79, where tool definitions carried "deferLoading": true.

Additional context

This appears to be a runtime regression in the MCP tool-definition serialization or deferred-loading path introduced between 1.0.79 and 1.0.80.

This is distinct from #4189. That issue reports that /context displays the undeferred schema footprint even though actual deferred MCP cost remains small. Here, actual request usage rises to 403K because the deferred markers disappear.

Current workaround:

  1. Launch the cached 1.0.79 package runtime directly.
  2. Always pass --no-auto-update.
  3. Do not rely on pinning only the native launcher, because it can select a newer cached package runtime.

A regression test could create a large synthetic MCP catalog, start a fresh no-tool session, and assert that:

  1. Tool schemas remain deferred in the first model request.
  2. Initial input usage does not scale with the complete schema bytes of every registered tool.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với quá trình tuần tự hóa định nghĩa công cụ MCP và đường dẫn tải trì hoãn, so sánh runtime 1.0.79 với 1.0.80+. Chạy một phiên tổng hợp với danh mục lớn, không có công cụ, rồi kiểm tra yêu cầu đầu tiên gửi đến model và các log debug. Được xem là hoàn tất khi các schema công cụ vẫn giữ các marker deferLoading và mức sử dụng input ban đầu không tăng theo từng schema đã đăng ký.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js
Lĩnh vực
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
50/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.