fix: clear empty version-cache lock when update fetch fails#30
Merged
Conversation
The update check touches the version-cache file before calling the GitHub API so concurrent status-line renders don't all issue the request in parallel. If the fetch fails (network blip, rate limit, 5s timeout), the touched file is left on disk at zero bytes with a fresh mtime, and the 24h TTL then suppresses every subsequent update check for a full day even though no data was ever cached. Drop the empty lock in the failure path so the next render retries.
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
The update-check code touches
statusline-version-cache.jsonbefore calling the GitHub API as a stampede lock — so N concurrent status-line renders don't all fire the request in parallel. If the fetch fails (network blip, rate limit, 5-second timeout, or — as happened today — the first render that ran in the narrow window between deleting the cache and the release actually appearing on GitHub), the touched file stays on disk at zero bytes with a fresh mtime. The 24-hour TTL check then sees a "fresh" cache and suppresses every update check for a full day, even though no data was ever written.Code changes
statusline.sh:463-477— After a failedcurl, if the cache file is empty (! -s),rm -fit so the next render retries instead of waiting 24h.statusline.ps1:432-452— Mirror fix: in thecatch, if the cache file exists and hasLength -eq 0,Remove-Itemit.Success path is unchanged; if the cache pre-existed with valid content and the fetch fails, the old content is kept and reused (stale-but-usable fallback), retrying on the normal 24h boundary.
How to test
rm /tmp/claude/statusline-version-cache.json(macOS/Linux) or the Windows equivalent under$env:TEMP\claude\.Update available: …line surfaces whenVERSIONis behind the latest GitHub release.