fix: upgrade double-lock, flag parsing, and message ordering#277
Merged
Conversation
- Fix acquireLock re-entry: allow same-process PID to re-acquire lock, preventing 'Another upgrade is already in progress' when source and target install directories are the same path. - Add --version and --help flags to upgrade subcommand's OPTIONS so parseArgs doesn't silently swallow them. - Don't handle --version/--help at top-level CLI when a subcommand is present; pass raw args to upgrade so it can parse its own flags. - Persist nightly channel in install script when LORE_VERSION=nightly. - Move 'Applied delta patch' message before 'Binary verified' for correct chronological ordering. - Remove dead formatBytes from upgrade.ts.
1e548b4 to
7897ea6
Compare
This was referenced May 13, 2026
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
downloadBinaryToTemp()acquires a lock theninstallBinary()tries the same lock when source == target dir.handleExistingLockonly allowed re-entry forprocess.ppid, notprocess.pid, causingUpgradeError: Another upgrade is already in progressafter a successful download, leaving a stale.downloadfile behind.--version/--helpflags silently swallowed: The upgrade subcommand didn't declareversionorhelpin its OPTIONS, soparseArgsdropped them. Additionally, top-level CLI intercepted--versionbefore dispatch, solore upgrade --version nightlyjust printed the version and exited.LORE_VERSION=nightly curl ... | bashinstalled the nightly binary but never wrote~/.lore/channel, sogetReleaseChannel()defaulted to"stable"on first run.downloadBinaryToTemp()so it appears in chronological order.Changes
packages/gateway/src/cli/lib/binary.tsexistingPid === process.pid)packages/gateway/src/cli/upgrade.ts--version,--helpto OPTIONS; add help text handler; remove deadformatBytespackages/gateway/src/cli/main.ts--version/--helpat top level when no subcommand; pass raw args to upgradepackages/gateway/src/cli/lib/upgrade.tsdocs/install~/.lore/channelwhen installing nightly