Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

refactor: unify the two Anthropic-likeness classifiers (hoist vs cache-control)

Đang mở
#891 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng cách đọc familyVendor trong packages/opencode/src/provider/family.ts, sau đó so sánh cách sử dụng nó trong packages/opencode/src/session/prompt.ts với kiểm tra cache-control inline trong packages/opencode/src/provider/transform.ts:284-295. Xác định cách xử lý gateway một cách tường minh của predicate dùng chung, kiểm tra độc lập các hành vi hoist và cache-control, đồng thời xác nhận rằng tỷ lệ cache-hit của gateway không bị suy giảm.

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

Mô tả

Found during v0.8.3 release review (CTO persona). Deferred because it touches a hot path and changes cache-control behavior for gateway traffic — needs design + careful testing (>30 min), not for a patch release.

Context

There are now two independent predicates deciding whether a model is "Anthropic-like":

  1. isAnthropicLikeModel in packages/opencode/src/session/prompt.ts — gates the <system-reminder> system-role hoist (added in #888). Built on familyVendor + providerID + api.id/npm heuristics.
  2. The inline cache-control check in packages/opencode/src/provider/transform.ts:284-295 — gates Anthropic cache_control injection. Hard-codes model.providerID === "altimate-backend" as Anthropic-for-caching.

These deliberately diverge today: transform.ts treats the altimate-backend gateway as Anthropic-for-caching, while isAnthropicLikeModel classifies the same gateway (family: openai) as non-Anthropic. The divergence is correct for the #888 fix, but the two classifiers will drift further apart as gateway models expand, and a future maintainer could unify them wrongly.

Suggested fix

Extract a single shared predicate (built on familyVendor) used by both the hoist decision and the cache-control decision, with explicit handling of the gateway case so the two behaviors can't silently drift. Verify cache-hit rates on gateway traffic don't regress.

Scope

packages/opencode/src/session/prompt.ts, packages/opencode/src/provider/transform.ts, packages/opencode/src/provider/family.ts.

Ngôn ngữ chính
TypeScript
Star
813
Fork
134
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
65

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.

Issue khác của AltimateAI/altimate-code

Tất cả issue của AltimateAI/altimate-code

Issue tương tự

Thêm issue về TypeScript

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.