Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#891 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
backend

調査の方向性

まず packages/opencode/src/provider/family.ts の familyVendor を読み、次に packages/opencode/src/session/prompt.ts での使用方法を、packages/opencode/src/provider/transform.ts:284-295 にある cache-control のインラインチェックと比較します。共有 predicate における gateway の明示的な処理を定義し、hoist と cache-control の動作を個別に検証して、gateway の cache-hit 率が退行しないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
813
フォーク
134
平均マージ
2日 3時間
マージ済み PR(30日)
65

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AltimateAI/altimate-code のほかの issue

AltimateAI/altimate-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。