Skip to content

feat: background auto-update for openclaw package - #12

Merged
needsbuilder merged 1 commit into
mainfrom
feat/openclaw-auto-update
May 20, 2026
Merged

needsbuilder merged 1 commit into
mainfrom
feat/openclaw-auto-update

Conversation

@needsbuilder

Copy link
Copy Markdown
Owner

Summary

  • Detects new openclaw npm versions in the background and installs them silently (30s after app launch, then every 6h)
  • Stops the Gateway before npm install to avoid the supervisor racing a binary swap, then restarts it
  • DoneStep banner shows progress, success (auto-dismisses after 10s), and failure (with manual retry button)

Implementation Notes

  • New service src/main/services/openclaw-updater.ts orchestrates the check/install/restart loop with an in-flight mutex (isOpenclawUpdating)
  • Shared core extracted in installer.ts: installOpenClawMacCore (chown + npm prefix + install) and installOpenClawWslCore. Manual install IPC and auto-update both go through these
  • runInWslStreaming added to wsl-utils.ts so WSL install logs flow line-by-line to the renderer (otherwise the user would see no progress for 1–3 minutes)
  • Manual install IPC (install:openclaw) now refuses with auto-update-in-progress if the background check is running, so two concurrent npm install -g cannot collide on npm's lockfile
  • stopOpenclawAutoUpdate() wired into runQuitCleanup so the 6h timer doesn't outlive the app

Code Review

Self-review run by the code-reviewer agent before merging found 3 Critical and 5 Important issues — all addressed in this branch:

  • C1 supervisor race → stop gateway pre-install, start post-install
  • C2 timer leak → cleanup in before-quit
  • C3 WSL no progress → runInWslStreaming
  • I1 fragile semver → simple !== comparison (npm latest returns stable only)
  • I3 silent failure UX → red error banner + retry
  • I4 manual/auto collision → mutex via isOpenclawUpdating
  • I5 DRY → shared core in installer.ts
  • M1 macOS chown/prefix missing → folded into shared core
  • M4 WSL timeout 120s → 300s default

Test plan

  • macOS: temporarily lower FIRST_CHECK_DELAY_MS to 5000 and npm i -g openclaw@2026.5.12, then npm run dev. Verify silent install + Gateway restart + success banner
  • macOS: kill network mid-install (nettop watch then disconnect Wi-Fi) → red error banner shows with retry button
  • Windows (WSL): same downgrade + dev run scenario, verify progress logs flow line-by-line in the banner
  • Quit during update: pgrep -f openclaw after app quit returns nothing (no zombie npm)
  • Click manual "Update" button while background check is in flight → IPC returns auto-update-in-progress, no double npm install
  • npm run typecheck and npm run lint pass

Detect new openclaw versions in the background (30s after launch, then
every 6h), install silently, and restart the gateway if it was running.
Progress and errors surface in the DoneStep banner with explicit
success/failure states.

- Extract installOpenClawMacCore / installOpenClawWslCore shared by the
  interactive install flow and the new background updater
- Add runInWslStreaming for line-by-line progress from WSL installs
- Stop gateway before npm install so the supervisor does not race the
  binary swap (avoids spurious gave_up cascades)
- Mutex manual install vs background update via isOpenclawUpdating
- Error banner + manual retry path when auto-update fails
- Wire stopOpenclawAutoUpdate into app quit cleanup
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
easyclaw Ready Ready Preview, Comment May 20, 2026 6:09am

Request Review

@needsbuilder
needsbuilder merged commit 6baafde into main May 20, 2026
3 checks passed
@needsbuilder
needsbuilder deleted the feat/openclaw-auto-update branch May 20, 2026 07:04

This branch was successfully deployed

1 active deployment
Preview — 1b113cdc Deployed May 20, 2026 by vercel[bot]
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