[bot] Anthropic Beta Messages `compaction` parameter (on-demand compaction) not captured in span metadata

Đang mở Phù hợp với người mới
#237 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
82/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ruby
Lĩnh vực
observability

Hướng nghiên cứu

Đọc lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb, tập trung vào METADATA_FIELDS, BETA_METADATA_FIELDS và capture_beta_fields; lib/braintrust/contrib/anthropic/patcher.rb xác định điểm tích hợp. Thêm việc thu thập metadata của request cho compaction trong beta instrumentation, sau đó kiểm tra các bài test beta Messages instrumentation hiện có để xác nhận trường này xuất hiện trong các request compaction. Issue không nêu tên file test nào.

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

Mô tả

<!-- provider-gap-audit: anthropic-compaction-param-not-captured -->

Summary

Anthropic's compact-2026-09-04 beta (released September 2026) lets callers trigger on-demand compaction of a conversation via a top-level compaction request parameter on client.beta.messages.create, returning a signed compaction block (stop_reason: "compaction", a summary in content, and a signature) in place of a normal reply. This is a distinct, documented execution mode of the beta Messages API. The compaction parameter is not captured anywhere in this repo's Anthropic beta instrumentation.

What is missing

  • BetaMessages::InstanceMethods::METADATA_FIELDS and BETA_METADATA_FIELDS do not include compaction, so a request that sets it is traced identically to a normal message request — the metadata gives no indication the call was a compaction request.
  • capture_beta_fields explicitly special-cases betas and output_format but has no equivalent handling for compaction.
  • The response's stop_reason: "compaction" is still captured generically via finalize_metadata's existing stop_reason handling, but without the request-side compaction field, there's no way to see why a compaction response was produced versus e.g. hitting a stop sequence.

Braintrust docs status

supported (in another Braintrust SDK, not Ruby) — https://docs.braintrust.dev/integrations/ai-providers/anthropic documents, for the Python SDK, that Messages spans capture request parameters including compaction, context_management, and diagnostics, and separately that OTel export sums anthropic.compaction spans for token accounting. The Ruby-specific sections of the same page describe no equivalent compaction metadata capture — this is a concrete Ruby-specific parity gap against Braintrust's own Python instrumentation of the identical upstream beta.

Upstream sources

Local repo files inspected

  • lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb — METADATA_FIELDS (lines 29–32), BETA_METADATA_FIELDS (lines 35–37), and capture_beta_fields (lines 146–166) have no compaction handling
  • lib/braintrust/contrib/anthropic/instrumentation/messages.rb — stable (non-beta) METADATA_FIELDS (lines 25–28), shown for contrast; compaction is beta-only upstream so this file is unaffected
  • lib/braintrust/contrib/anthropic/patcher.rb — confirms BetaMessagesPatcher is the integration point that would need the added field
Ngôn ngữ chính
Ruby
Star
9
Fork
11
Merge trung bình
1 ngày 11 giờ
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 braintrustdata/braintrust-sdk-ruby

Tất cả issue của braintrustdata/braintrust-sdk-ruby

Issue tương tự

Thêm issue về Ruby

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.