Repository navigation
fix(opencode2): refresh expired model catalog in place - #200
Merged
Merged
Conversation
Track the age of the published catalog and retry expired discovery on existing host activity. Keep the current inventory on failure and preserve config-load discovery in OpenCode 1.x. Fixes oakimov#194
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Reject empty discovery responses before persisting a replacement. Refresh legacy empty snapshots on demand and use the turn context hook to recheck expiry when host events are unavailable.
adonm
added a commit
to adonm/cursor-opencode-provider
that referenced
this pull request
Nov 24, 2026
Adopt upstream's oakimov#199 pricing table, oakimov#200 in-place catalog refresh, oakimov#201 CURSOR_PROGRESS_CONTINUATION opt-out, and oakimov#202 local AI SDK entry. The fork's earlier ports (deb1787, 2bbab84, 9bf27b0 gate) are dropped where upstream now covers the same ground. Keep the fork-only pieces upstream still lacks: the seven-day conversation snapshot default with fixed 24 h .tmp cleanup and resolver-derived test ages, scripts/build-atomic.sh, scripts/sync-upstream.sh, the stale-dist gate, and test/updater-build.test.ts. Retire the last topic branch: nothing on perf/cache-ttl-and-lean-runtime remains that upstream or this merge does not already cover, so TOPICS is empty and the updater tests seed a synthetic topic into the copied script.
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.
Scope: OpenCode 2.x refreshes its Cursor picker in place after the published catalog expires.
src/models.tsaddsdiscoverModelCache; OpenCode 1.x still usesdiscoverModelsduring config load and has no daemon catalog latch.Start with
ensureModelsinsrc/plugin-opencode2.ts. Session activity checks the published snapshot’s original timestamp. A successful refresh reloads the provider, not the Location; failed, empty, or timed-out refreshes leave the picker alone and back off. A credential switch clears that backoff. The existing alias hook reads the updated catalog.Verified: Frozen install, typecheck, build, and 299 targeted tests passed. Bun LCOV covered all 66 changed executable lines. Re-ran #194’s stub A/B on stock OpenCode 2.3.0 with external networking blocked:
f1c38d2kept only Argon with zero discovery calls; this branch made one call, emittedprovider.updatedandmodel.updated, and added Carbon. A stubbed 503 kept Argon. No live 24-hour wait or prompts; no prompt-cache code changed.Fixes #194