fix: version-check toast timing, remove terminal output, add cache path constant - #79
Merged
Merged
Conversation
… constant - Toast now fires after version fetch resolves + 2s delay, preventing slow network fetches from suspending into the user's first prompt - Remove console.warn from warnIfStale; toast is the sole notification channel - Remove system prompt injection of update notice (experimental.chat.system.transform) - Export PLUGIN_CACHE_PATH constant as single source of truth for cache path - warnIfStale accepts optional prefetchedLatest to avoid duplicate registry fetches - Single _latestVersionPromise shared across startup paths (one fetch per launch) - Add scripts/opencode-plugins-refresh helper for checking/clearing stale plugin caches - Add 12 new tests covering PLUGIN_CACHE_PATH and warnIfStale prefetch behavior
justin-carper
approved these changes
Jul 27, 2026
justin-carper
left a comment
Collaborator
There was a problem hiding this comment.
Amazing, thank you!
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.
Summary
Fixes the version-check notification behavior so the update toast appears correctly on startup without leaking into the terminal or the first user prompt.
Changes
Bug Fixes
_versionCheckPromise.then(async (result) => { await sleep(2000); showToast() })warnIfStalepreviously printed a multi-lineconsole.warnto stderr on every startup when outdated. Removed — the UI toast is the sole notification channelexperimental.chat.system.transformhook that was injecting update notices into the agent system prompt on the first turnImprovements
PLUGIN_CACHE_PATHconstant — exported fromsrc/version-check.tsas a single source of truth for the opencode plugin cache path (cross-platform). Used by both startup check andcursor_update_plugintoolwarnIfStaleaccepts pre-fetched version —warnIfStale(prefetchedLatest?)skips the registry call when the caller has already resolved it_latestVersionPromiseshared across all startup paths; only one npm fetch per launch regardless of how many paths consume itNew
scripts/opencode-plugins-refresh— helper script for checking/clearing stale plugin caches; supports--check(CI-friendly) and--forceflagsTests
12 new tests added to
test/version-check.test.ts:PLUGIN_CACHE_PATHshape and path segment assertionswarnIfStalewith pre-fetched version skips registry fetchwarnIfStalewithout pre-fetched version calls registry exactly once356 tests, all passing.
Screenshot