Skip to content

Fix #231 stale metadata cache, #235/#240 actionable free-tier 403 hint - #243

Merged
ltmoerdani merged 2 commits into
mainfrom
fix/issue231-metadata-cache-rev
Sep 23, 2026
Merged

ltmoerdani merged 2 commits into
mainfrom
fix/issue231-metadata-cache-rev

Conversation

@ltmoerdani

Copy link
Copy Markdown
Owner

Fixes #231
Fixes #235
Fixes #240

1. #231 — Revision-scoped metadata cache (stale context limits)

deepseek-v4.1-flash is real (it is in the official Go endpoint table and in the live models.dev registry at 1M context / 384K output), but users saw stale numbers like 262K. The models.dev metadata snapshot is persisted in globalState under a fixed key, so old data survived extension upgrades until the 1-hour TTL refetched or the user ran Refresh Models manually.

Fix: MODEL_METADATA_CACHE_KEY now embeds the bundled-data revision (opencode.modelMetadataCache.v6.<revision>). Every time a release syncs the offline fallback tables, the key changes and stale persisted snapshots are abandoned automatically. Refresh Models remains the manual escape hatch.

2. #235 / #240 — Free-tier restriction (upstream policy, actionable error)

OpenCode restricted free-tier models to their own clients on Sep 17, 2026 (their statement in anomalyco/opencode#49580; anti-abuse measure, per their terms the free tier is not available to third-party clients). Paid Go models are unaffected. This is policy, not a bug we can bypass — any client still showing free models working is spoofing OpenCode's client identity, which violates their terms and breaks within days.

Fix (UX only, no bypass): the specific 403 OpenCode's free tier can only be used from within OpenCode now surfaces as a clear message: "OpenCode restricts this free-tier model to their official app (effective Sep 17, 2026). Use a paid OpenCode Go model, or run free models in the OpenCode app/CLI." Implemented as describeFreeTierRestriction() in src/errors.ts, alongside the existing Router.Unavailable hint.

Verification

  • npm run lint — full 7-check gate PASS; tsc --noEmit clean
  • 484/484 unit tests pass (4 new: free-tier hint matching, end-to-end through buildOpenCodeRequestError, unrelated-message no-op, cache-key/revision binding)
  • Manual: free Zen model request (e.g. muse-spark-1.2-contributor-free) now shows the actionable hint in the error; paid models unaffected

Docs

  • CHANGELOG.md [Unreleased] entries for both changes
  • Issue docs: docs/issues/105-20260923-issue231-metadata-cache-revision.md, docs/issues/106-20260923-issue235-240-free-tier-policy.md

Merge method: merge commit (no squash).

…3 hint (fixes #231, fixes #235, fixes #240)

Metadata cache: embed the bundled-data revision in
MODEL_METADATA_CACHE_KEY (v5 -> v6.<revision>). When a release syncs the
offline fallback tables, the key changes and stale persisted snapshots
are abandoned automatically instead of surviving until the 1-hour TTL
refetch — users were stuck on old limits (262K context for
deepseek-v4.1-flash, which is 1M/384K upstream) across upgrades.

Free-tier 403: OpenCode restricted free-tier models to their official
clients on Sep 17, 2026 (policy, anomalyco/opencode#49580). The gateway
error is now replaced with an actionable hint: use a paid Go model or
run free models in the OpenCode app/CLI — no bypass by design, since
that would violate OpenCode's terms.

4 new tests; 484/484 unit tests pass; full lint gate pass.
@ltmoerdani
ltmoerdani merged commit 03a4157 into main Sep 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CAN NOT USE FREE MODELS OpenCode's free tier can only be used from within OpenCode [BUG] Wrong details for Deepseek Flash 4.1

1 participant