Source selections attached while a Copilot SDK agent is running don’t reach the model

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
ai-infra-agents

Hướng nghiên cứu

Start with the reproduction: create an SDK session with a pausable tool, send a steering message with mode "immediate" carrying a selection attachment, and inspect the next model request. The selection is persisted in the user.message event but is missing from that request, while the same attachment sent while idle arrives. Find where immediate-mode messages are built for the model and make them handle selections as the idle path does. Done means a regression test that sends a selection during a tool call and asserts the model request includes its text, path and range.

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

Mô tả

I ran into this while dogfooding a language-model provider for Vercel AI Gateway I'm working on, using a Copilot chat.

While the agent was working, I attached a few source selections and asked whether some verbose validation code would benefit from Zod or another approach. The selections appeared as attachment chips in my message, but the agent asked which file I meant. When I pointed out that the selections were attached, it said it had received only a browser-page attachment.

Image

That was confusing: from my perspective, I’d already supplied exactly the context it was asking for.

What we found

I worked with an agent to trace the selections through the installed VS Code agent host. It forwards their text, file paths and ranges to the SDK, and the SDK persists them in its user.message event. However, they’re absent from the request that reaches our model provider.

We then reproduced the behavior using the installed SDK/runtime directly, with synthetic model responses and no VS Code or Vercel provider involved:

Same selection and text-blob attachments Selection reaches model Text blob reaches model
Message sent while idle Yes Yes
mode: "immediate" during a tool call No Yes

Both cases persist the attachments correctly. The comparison reproduced twice.

Reproduction
  1. Create an SDK session with a tool whose handler can be paused.
  2. Have a synthetic model response invoke that tool.
  3. While its handler is paused, send an immediate message containing a selection attachment with text, file path and range, plus a text-blob attachment as a control.
  4. Release the tool and inspect the next model request.

The steering message and text blob are present, but the selection is missing. Sending those same attachments while idle includes the selected code and its location.

Tested with the versions bundled in my VS Code installation:

  • SDK: 1.0.17-unstable.37397886721.gad270aa
  • Runtime: 1.0.92-4.unstable.r37397886721.gad270aa
Expected behavior

I’d expect source selections attached to a steering message to reach the model just as they do when sent while idle.

Reviewing code while an agent continues working feels like a pretty normal use of steering. Ideally, selection rendering would follow the same path for both delivery modes, with a regression test covering attachments sent during a tool call. The visible attachment chips should accurately represent the context the agent receives.

Ngôn ngữ chính
Java
Star
10.7k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

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.

Issue khác của github/copilot-sdk

Tất cả issue của github/copilot-sdk

Issue tương tự

Thêm issue về Java

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.