feat: robust upgrade detection — non-interactive git, auth injection, 24h cache#29
Merged
ericchansen merged 3 commits intomainfrom May 1, 2026
Merged
Conversation
… 24h cache - _git_env(): GIT_TERMINAL_PROMPT=0, SSH BatchMode, gh auth token injection via GIT_CONFIG_COUNT (Renovate pattern) - check_plugin(): _cached_latest param to skip network on cache hit - UpgradeCache: disk-backed 24h TTL cache at ~/.copilot/upgrade-cache.json - Wire cache into _check_upgrades_async, invalidate after upgrade Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves plugin upgrade detection robustness by making git operations non-interactive, adding GitHub auth token injection support, and introducing a 24-hour disk cache to reduce network calls and failures for end users.
Changes:
- Add
_git_env()and route all git subprocess calls through it to avoid interactive prompts and optionally inject GitHub auth viaGH_TOKEN/GITHUB_TOKENorgh auth token. - Add a disk-backed
UpgradeCache(~/.copilot/upgrade-cache.json) with TTL-based reads and graceful handling for missing/corrupt cache. - Update the Plugins tab to use the cache for background upgrade checks and invalidate cache entries after successful plugin upgrades; add tests for cache and new upgrade-detection behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/copilotsetup/plugin_upgrades.py |
Adds non-interactive/auth-aware git env and adds cached-latest + fetch-fallback behavior in check_plugin(). |
src/copilotsetup/upgrade_cache.py |
New disk-backed cache wrapper around check_plugin() with TTL and schema validation. |
src/copilotsetup/tabs/plugins.py |
Switches plugin upgrade detection to use UpgradeCache and invalidates cache after upgrades. |
src/copilotsetup/config.py |
Adds upgrade_cache_json() path helper for cache location. |
tests/test_plugin_upgrades.py |
Adds unit tests for _git_env(), _cached_latest, and fetch-failure fallback behavior. |
tests/test_upgrade_cache.py |
Adds tests covering cache load/reset behavior, TTL, invalidation, and multi-plugin entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…verified flag - Only write cache on actual network checks (not cache hits) - Memoize _git_env() per session (gh auth token called once, not 30-50×) - UpgradeCache singleton so background thread and upgrade handler share lock - network_verified flag prevents false UP_TO_DATE caching after fetch failure - Tests for all four fixes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2104345 to
8cc01dd
Compare
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
Makes plugin upgrade detection robust for all users, including non-developers with private repos and multi-account setups. Based on patterns from Homebrew, pip, npm, gh CLI, k9s, and Renovate.
Non-interactive git (
_git_env)GIT_TERMINAL_PROMPT=0— git never hangs waiting for credentialsGIT_SSH_COMMANDwith-oBatchMode=yes— kills SSH passphrase promptsgh auth tokenusing Renovate-styleGIT_CONFIG_COUNTenv vars (zero files touched)ghis not installed or not authenticatedGraceful fetch fallback
_cached_latestparameter oncheck_plugin()allows skipping network entirely when cache is fresh24h disk cache (
UpgradeCache)~/.copilot/upgrade-cache.jsonwith per-plugin{latest_version, checked_at}rto force refresh.write_json()with.bakrotationcopilot plugin updateTests
_git_env(): terminal prompt, SSH batch mode, token injection via env vars, no-gh fallback_cached_latest: cache hit skips fetch, up-to-date detectionUpgradeCache: set/get, TTL expiry, invalidation, corruption, schema mismatch, multi-plugin independence