Built-in functions.view returns no content for large files despite documenting automatic truncation

Đang mở Phù hợp với người mới
#5,476 0 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Issue xác định công cụ tích hợp sẵn functions.view và đưa ra trường hợp có thể tái hiện bằng một tệp văn bản 26.400 byte không có view_range. Trước tiên, hãy tìm phần triển khai và mô tả của công cụ, sau đó so sánh phản hồi với tệp lớn với hành vi cắt ngắn được tài liệu mô tả. Hoàn thành khi hành vi và mô tả khớp nhau; hãy tái hiện trường hợp này và kiểm tra ví dụ view_range vẫn hoạt động.

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

Mô tả

area:tools
Describe the bug

The built-in functions.view tool’s description says text files larger than 20KB are truncated. However, reading a larger file without view_range returns only a size-limit message, with no file content.

The exact text from the tool description is:

View files, images, or directories.

  • Images return base64 data and MIME type.
  • Text files return their content.
  • Directories list non-hidden entries up to 2 levels deep.
  • path must be absolute.
  • Files over 20KB are truncated; use view_range for sections.

Thus, it's expected that just calling view for a text file larger than 20KB would return a truncated version of that content at 20KB.

Affected version

1.0.112

Steps to reproduce the behavior
  1. Create a synthetic 26,400-byte, 800-line text file:
    python3 -c 'from pathlib import Path; Path("view-size-repro.md").write_text("0123456789abcdef0123456789abcdef\n" * 800, encoding="utf-8")'
  2. In Copilot CLI, ask:
    Use the built-in view tool to read view-size-repro.md.
    For this test, omit view_range and forceReadLargeFiles.
  3. Observe that the tool returns only:
    File too large to read at once (25.8 KB). Consider using the rg tool to search within the file, or view with view_range to read specific sections.
  4. Ask it to read the same file with view_range: [1,5]. The five lines are returned successfully.
Expected behavior

functions.view behavior should match the tool description, whether that means adjusting the tool description or the tool behavior

Additional context

No response

Ngôn ngữ chính
Python
Star
11.5k
Fork
2k
Merge trung bình
6 giờ 34 phút
Pull request đã merge (30 ngày)
3

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-cli

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

Issue tương tự

Thêm issue về Python

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.