Fix false 'Update available' when versions match - #62
Open
dafacto wants to merge 1 commit into
Open
Conversation
`openclaw --version` returns a decorated string like "OpenClaw 2026.3.23-2 (7ffe7e4)" while `npm view openclaw version` returns the bare version "2026.3.23-2". The compareSemver function received the full decorated string, causing Number() to produce NaN for the first segment, which made the comparison always report the installed version as outdated. Additionally, compareSemver split only on '.' but OpenClaw versions use '-' suffixes (e.g. "2026.3.23-2") which produced NaN for the patch segment. Changes: - Extract the bare version number from `openclaw --version` output before comparing - Split version strings on both '.' and '-' to handle pre-release suffixes correctly - Compare all segments (not just first 3) to cover 4-part versions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
openclaw --versionreturns a decorated string likeOpenClaw 2026.3.23-2 (7ffe7e4), butnpm view openclaw versionreturns bare2026.3.23-2. The raw decorated string was passed directly tocompareSemver, causingNumber("OpenClaw 2026")→NaN→(NaN || 0) < 2026→ always reports outdated.compareSemveralso only split on., so versions with-suffixes (e.g.2026.3.23-2) producedNaNfor the patch+suffix segment.Changes
openclaw --versionoutput before comparing.and-to handle pre-release suffixesTest plan
🤖 Generated with Claude Code