Skip to content

Fix false 'Update available' when versions match - #62

Open
dafacto wants to merge 1 commit into
madrzak:mainfrom
dafacto:fix/version-comparison-parsing
Open

Fix false 'Update available' when versions match#62
dafacto wants to merge 1 commit into
madrzak:mainfrom
dafacto:fix/version-comparison-parsing

Conversation

@dafacto

@dafacto dafacto commented Mar 24, 2026

Copy link
Copy Markdown

Summary

  • openclaw --version returns a decorated string like OpenClaw 2026.3.23-2 (7ffe7e4), but npm view openclaw version returns bare 2026.3.23-2. The raw decorated string was passed directly to compareSemver, causing Number("OpenClaw 2026")NaN(NaN || 0) < 2026 → always reports outdated.
  • compareSemver also only split on ., so versions with - suffixes (e.g. 2026.3.23-2) produced NaN for the patch+suffix segment.

Changes

  • Extract the bare version number from openclaw --version output before comparing
  • Split version strings on both . and - to handle pre-release suffixes
  • Compare all segments (not just first 3) to cover 4-part versions

Test plan

  • Verify Settings page shows "Up to date" when installed and latest versions match
  • Verify "Update available" appears correctly when a newer version exists

🤖 Generated with Claude Code

`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>
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