Fix #231 stale metadata cache, #235/#240 actionable free-tier 403 hint - #243
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #231
Fixes #235
Fixes #240
1. #231 — Revision-scoped metadata cache (stale context limits)
deepseek-v4.1-flashis 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_KEYnow 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 OpenCodenow 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 asdescribeFreeTierRestriction()insrc/errors.ts, alongside the existing Router.Unavailable hint.Verification
npm run lint— full 7-check gate PASS;tsc --noEmitcleanbuildOpenCodeRequestError, unrelated-message no-op, cache-key/revision binding)muse-spark-1.2-contributor-free) now shows the actionable hint in the error; paid models unaffectedDocs
CHANGELOG.md[Unreleased] entries for both changesdocs/issues/105-20260923-issue231-metadata-cache-revision.md,docs/issues/106-20260923-issue235-240-free-tier-policy.mdMerge method: merge commit (no squash).