Repository navigation
Windows and Linux: an update started at launch no longer loses its staged file - #484
Merged
Merged
Conversation
…aged file The app deletes leftover lokalbot.new/.old files 0, 10 and 60 seconds after it starts. An install under way at one of those moments lost the .new file it had staged next to the binary, and the rename failed with "could not replace .../lokalbot: No such file or directory". It happened to `lokalbot install-update` in the update check on a slower CI runner (the install reached its swap about 15 seconds after launch), and could hit anyone who installs an update right after starting LokalBot. install() now lists the folders it replaces files in until it returns, and remove_leftovers skips listed folders. A cleanup pass holds the list while it deletes, so an install can't start in a folder halfway through one.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
lokalbot | 54df4d6 | Commit Preview URL Branch Preview URL |
Nov 11 2026, 10:21 AM |
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 app deletes leftover
lokalbot.new/.oldfiles 0, 10 and 60 seconds after it starts (install::remove_leftovers, scheduled inlokalbot-app/src/updates.rs). An install under way at one of those moments lost the.newfile it had just staged next to the binary, and the rename failed with "could not replace …/lokalbot: No such file or directory".install()now lists the folders it replaces files in until it returns, andremove_leftoversskips listed folders; a cleanup pass holds the list while it deletes, so an install can't start in a folder halfway through one. The list is per folder, so other folders are still cleaned.Validation
Seen in CI: #482's Linux job on the new self-hosted runner
lokalbot-linux-pc(run 42994801514, job 130436132244) failed Check updating from a local feed:lokalbot install-updatestarted at 09:36:57, found the update, and at 09:37:12 loggedupdates: install failed: could not replace /home/ghrunner/actions-runner/_work/_temp/update-e2e/home/.local/bin/lokalbot: No such file or directory (os error 2), consistent with the 10-second pass deletinglokalbot.newbefore the swap. The same step passed on the faster server runner, and onlokalbot-linux-pcin #483's run, so it is timing-dependent.Two new tests in
install.rs:cleanup_skips_a_folder_an_install_is_replacing_files_in: while an install lists a folder, its.newand.oldfiles survive a cleanup pass; another folder is cleaned; once the install is done, they go.an_install_waits_for_a_cleanup_pass_and_lists_its_folder_only_while_it_runs: an install started while a pass holds the list doesn't touch the binaries until the pass ends, replaces them afterwards, and leaves the list as it found it.Mutation check: with the registration line removed from
install(), the second test fails (left: "new app",right: "old app").Run on Linux (Ubuntu 24.04, Rust 1.99.1). Windows uses the same code path; CI's Windows job runs these tests.
Changed test expectations
None (two tests added).
Linked issues
Refs #482
Risk / rollout notes
lokalbot-update's installer changes. A cleanup pass now skips a folder while an install in this process replaces files there; the.oldfiles a Windows install leaves are removed at the next start, as before.