Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#891 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
backend

Research direction

Start by reading familyVendor in packages/opencode/src/provider/family.ts, then compare its use in packages/opencode/src/session/prompt.ts with the inline cache-control check in packages/opencode/src/provider/transform.ts:284-295. Define the shared predicate's explicit gateway handling, verify the hoist and cache-control behaviors independently, and confirm gateway cache-hit rates do not regress.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
813
Forks
134
Avg merge
2d 3h
Merged PRs (30d)
65

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AltimateAI/altimate-code

All issues in AltimateAI/altimate-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.