Skip to content

fix(plugin): refresh the served catalog on the configured TTL instead of publishing once at install - #18235

Open
maxmad64bis wants to merge 1 commit into
cheaper-inference:release/v3.8.53from
maxmad64bis:fix/opencode-plugin-v2-stale-served-catalog
Open

maxmad64bis wants to merge 1 commit into
cheaper-inference:release/v3.8.53from
maxmad64bis:fix/opencode-plugin-v2-stale-served-catalog

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #17219

Summary

The served catalog stayed frozen on an earlier calculation even though config and gateway had moved, so new branches stayed missing until a service restart. The plugin published the catalog once at install and never refreshed it, so the configured cache TTL had no effect. Now the catalog refreshes in the background on that TTL, and the served catalog follows the gateway without a restart.

Related Issues

  • No linked issue — reproduced on the release base

Target Branch

  • Base is the active release/v3.8.x branch (the highest open release/v*), not main
  • New feature? From 3.8.55 on it is held with the v4-feature label for the v4 channel

Validation

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • @omniroute/opencode-plugin-v2/tests/catalog-freshness.test.ts — background refresh serves new gateway entries, unchanged catalogs skip reload, refreshes never overlap, one loop per provider id, 60 second floor, a failed refresh keeps the last known catalog, and the stale memory entry is dropped on credential change, plus gateway change, snapshot coherence and branch reactivation without a restart.

Coverage Notes

N/A — no file under the repository's src/, open-sse/, electron/, or bin/ is changed; the plugin lives under @omniroute/opencode-plugin-v2/.

Reviewer Notes

  • Behavior: the served catalog goes from frozen after install to following the gateway within modelCacheTtlMs (five minutes by default), plus one fetch; a failed refresh keeps the last known catalog, and a change that only touches enrichment (names or prices) may not trigger a host reload.
  • Follow-up: the cast on the global loop registry stays confined to one line and could be replaced by a typed guard later; the branch-name charset comes from the worktree and is not addressed here.
  • Merge: after feat(plugin): rework picker names to Provider - Model format #18230.

@maxmad64bis
maxmad64bis force-pushed the fix/opencode-plugin-v2-stale-served-catalog branch 2 times, most recently from 0ce0b8b to 5c59366 Compare October 26, 2026 13:18
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 26, 2026 13:36
@maxmad64bis
maxmad64bis force-pushed the fix/opencode-plugin-v2-stale-served-catalog branch from 5c59366 to bbfbf7e Compare October 27, 2026 13:33
@maxmad64bis
maxmad64bis marked this pull request as draft October 28, 2026 21:42
@maxmad64bis
maxmad64bis force-pushed the fix/opencode-plugin-v2-stale-served-catalog branch from e175594 to 932505d Compare October 28, 2026 21:42
… of publishing once at install

includes e175594: eviction guard and refresh loop trim
@maxmad64bis
maxmad64bis force-pushed the fix/opencode-plugin-v2-stale-served-catalog branch from 932505d to 334fb40 Compare October 28, 2026 22:09
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 29, 2026 18:07

This branch has not been deployed

No deployments
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.

1 participant