You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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":
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.
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":
isAnthropicLikeModelinpackages/opencode/src/session/prompt.ts— gates the<system-reminder>system-role hoist (added in fix: plan-mode refusals on altimate-default + warning false-positive (#887) #888). Built onfamilyVendor+ providerID + api.id/npm heuristics.packages/opencode/src/provider/transform.ts:284-295— gates Anthropiccache_controlinjection. Hard-codesmodel.providerID === "altimate-backend"as Anthropic-for-caching.These deliberately diverge today:
transform.tstreats thealtimate-backendgateway as Anthropic-for-caching, whileisAnthropicLikeModelclassifies 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.