Repository navigation
Description
Filing separately as you asked in #158. The argument turned out to be a different one than I expected, and narrower, so I want to lead with what did not hold up.
What I tested, including the parts that argue against filing
I went looking for the damage the relocation was supposed to have caused on this machine, per-user 0.4x to per-machine 0.50.0. Most of it is not there:
| Check | Result |
|---|---|
Old root removed, new root C:\Program Files\wmux |
Yes |
| Orphaned uninstall entry from the per-user install | None. One clean HKLM entry, /allusers |
| Start Menu and Desktop shortcuts | All valid, all resolve to the new exe |
wmux's hooks in ~/.claude/settings.json |
Self-healed. All ten read C:/Program Files/wmux/resources/cli/wmux-hook.js |
| Explorer context-menu keys | Absent here, feature not enabled |
| Install path hardcoded anywhere in the repo | Nothing live. One July planning doc, and it carries a different machine's path |
NSIS cleaned up after itself, and everything wmux records self-heals because it rewrites those artifacts every startup. The only casualty was a PATH entry I had added by hand, which is mine and is already covered by #158.
So the "an update silently invalidates absolute paths" framing does not justify an issue any more. You already corrected the installer.nsh comment and wrote the rule into it. That part is done.
The part that is still real
The install moved from a directory this user can write to into one they cannot.
Elevated: False
WRITE to C:\Program Files\wmux: DENIED
%LOCALAPPDATA%\Programs\wmux was user-writable, so electron-updater could download and apply an update with no prompt. C:\Program Files\wmux is not. Every future update on this machine now needs elevation, and the change was made by picking "All Users" in a dialog the installer re-offered during an update, not during a fresh install.
The app has no idea. canSelfUpdate() is the function whose stated contract is exactly this question:
Lines 97 to 100 in 7baf230
| /** True when this build can actually install an update in place. */ | |
| export function canSelfUpdate(): boolean { | |
| return app.isPackaged && !isUpdaterDisabled(); | |
| } |
/** True when this build can actually install an update in place. */
export function canSelfUpdate(): boolean { return app.isPackaged && !isUpdaterDisabled(); }
Packaged, and not disabled. Nothing about whether the install root is writable by the process that would have to write it. There is no perMachine branch, no elevation handling, and no write probe anywhere in updater.ts. So the answer it gives is "yes" for an install where applying in place will need a UAC prompt the user may decline, or admin rights they may not have.
That matters more here than it would in most apps, because oneClick: false plus allowToChangeInstallationDirectory: true with no perMachine pin means the scope page appears on updates, not just first installs:
Lines 32 to 38 in 7baf230
| "nsis": { | |
| "oneClick": false, | |
| "allowToChangeInstallationDirectory": true, | |
| "createDesktopShortcut": true, | |
| "createStartMenuShortcut": true, | |
| "shortcutName": "wmux", | |
| "artifactName": "wmux-${version}-setup.${ext}", |
An existing per-user install that has been quietly self-updating for months can be converted, by one click on a page the user reasonably reads as "confirm the install location", into one that prompts for admin on every update from then on. Nothing announces the change, and the fallback path treats a failure as a generic updater error and points at the GitHub release page.
What I did not verify
I did not run the live upgrade. Confirming the elevation failure end to end means putting a real installer through a real per-user to per-machine transition and watching what quitAndInstall() does without admin, and that is a system-level change I did not want to make speculatively on the machine the report came from. What is measured above is the state that follows the transition, not the transition itself.
So: mechanism and resulting state verified, consequence reasoned from them.
Suggested test matrix
The thing you said you wanted before touching scope. Each cell is "does an update apply without a prompt, with a prompt, or not at all":
| From | To | Admin user | Non-admin user |
|---|---|---|---|
| per-user | per-user (scope unchanged) | baseline | baseline |
| per-user | per-machine (scope changed mid-update) | ? | ? |
| per-machine | per-machine | ? | ? |
| per-machine | per-user | ? | ? |
The second row is the one that happened here. The fourth is worth a look too, since it would strand a machine-wide install's shortcuts and uninstall entry behind a user-scoped replacement.
Options
- Teach
canSelfUpdate()the truth. Probe writability of the install root (or checkperMachine) and return false when applying in place would need rights the process does not have. The badge then falls through to the existing GitHub-release path, which is already the designed safety net, instead of failing later with a generic error. Smallest change, no installer behaviour touched, and it makes the function's own doc comment true again. - Pin the scope.
perMachine: false(or true) removes the mid-update re-offer entirely and makes theinstaller.nshinvariant real. Changes upgrade behaviour for every existing install, which is why you did not want it riding onwmux pingcannot distinguish "not running" from "not on this session's PATH", and the agent block tells the reader to assume the first #158, and it needs the matrix above. - Say something at the moment of the change. Warn from the installer, or on first launch after a root change, that updates will now require admin. Most informative, most work, and it needs somewhere to record the previous root.
- Leave it, and treat "you picked All Users, so you get Windows' rules" as the answer.
I lean 1, and I would keep it separate from 2. 1 is a correctness fix to a function that currently answers a question it does not actually evaluate, it is testable without an installer, and it is true regardless of what you decide about scope. 2 is the policy question and deserves the matrix before anyone touches it. 4 is defensible for the elevation prompt itself, but not for canSelfUpdate() returning true when it cannot.
Happy to send 1 with a test. I would not send 2 without you picking a direction first.
Activity
fix(updater): know when installing will need admin rights (#167)
amirlehmam commentedon Aug 14, 2026
Fixed in 1.0.1 — but not the way option 1 is written, and I want to put the disagreement up front rather than let you find it in the diff.
First: leading with what didn't hold up
You opened by dismantling your own framing. The relocation damage I'd assumed in #158 mostly isn't there — no orphaned uninstall entry, shortcuts all valid, hooks self-healed to
C:/Program Files/wmux/..., nothing in the repo hardcoding an install path. NSIS cleaned up after itself and everything wmux records rewrites on startup. That's a table that argues against filing, and you filed anyway on the one thing that survived it.That is the report I'd want from someone I was paying to do this. It also means I over-corrected in #158: I wrote "any absolute path anyone recorded — PATH entries, shortcuts, scripts" into that comment as though all three were casualties, and only the first one was.
The defect is real, and it's a contract defect
The comment promises strictly more than the body evaluates. Nothing in
updater.tsever asked whether the process could write the directory an update replaces — noperMachinebranch, no elevation handling, no probe. You're right, and it's my comment.Where I didn't follow you
Option 1 says return
falsewhen the root isn't writable. I think that conflates two populations:Returning
falsefor both takes a working path away from every admin with a per-machine install and routes them to a manual download. That's a regression to a large population, shipped in a patch release, on a consequence your own report is careful to mark as reasoned rather than observed ("I did not run the live upgrade"). And separating the two needs an elevation attempt, not a probe — "can this user satisfy UAC" isn't answerable from inside the process.So I fixed the lie without changing the answer:
The probe writes and removes a real file rather than reading ACLs — on Windows the effective answer depends on the process token, integrity level and any redirection in front of the path, and a write that succeeds is the only proof a write will succeed. Cached for the process lifetime, which is sound because the token it depends on can't change without a restart. There's a reset seam for tests.
And the app now says so, which I think is the part that actually addresses "the app has no idea":
7 tests, including the deliberate non-change (per-machine ⇒
canSelfUpdate()still true,updateNeedsElevation()true).Push back if you think that's wrong. The case that would change my mind is evidence that
quitAndInstall()on a per-machine install without admin fails in a way that's worse than the GitHub fallback — a half-applied install, or a wmux that won't start afterwards. Right now I'm weighing "a UAC prompt some users can't satisfy" against "no in-app updates for every per-machine install", and the second looked worse. If your row 2 turns out to leave the install broken rather than merely un-updated,falsebecomes correct and I'll take it.Option 2 and the matrix
Untouched, deliberately, and your matrix is exactly what I wanted before anyone pins scope. Two notes on filling it in:
Row 2 (per-user → per-machine, mid-update) is the one that happened, and it now has an observable signal: with 1.0.1,
updateNeedsElevation()is the machine-readable version of the state you measured by hand.Row 4 (per-machine → per-user) I agree is worth a look and may be worse than row 2 — a user-scoped install replacing a machine-wide one strands the HKLM uninstall entry and the all-users shortcuts, which is real garbage left on the disk rather than merely an inconvenient prompt. If either of us gets to that matrix, I'd start there.
I'm not asking you to run it. It needs real installers against real accounts, and it's my release process.
On the linked line numbers
Permalinking to
7baf230rather than tomasteris a small thing that made this much easier to answer six commits later. Thank you for that, and for splitting it out of #158 as asked.amirlehmam commentedon Aug 14, 2026
1.0.1 is out — https://github.com/amirlehmam/wmux/releases/tag/v1.0.1
Leaving this open rather than closing on my own fix, for the same reason I left #164 open: I did not implement what you recommended, and you are the one holding the measurements. If
updateNeedsElevation()reportstrueon your Program Files install and the dialog now says so before you restart, that closes the half I shipped. If you think thecanSelfUpdate()half should still returnfalse, the argument is live and I would rather have it here than discover later that I picked wrong.One practical note for when you look: the probe is cached for the process lifetime, so it reflects the token wmux started with. Restart it after any elevation change or the reading will be stale by design.
capad-xyz commentedon Aug 14, 2026
You're right, and this machine is the counterexample.
BELLAMI\Aadarsh Upadhyayis in Administrators. The process runs unelevated, as everything does under a split token. So the install root is unwritable to the process and perfectly updatable by the user, one UAC prompt apart. Under option 1 as I wrote it,canSelfUpdate()returnsfalseright here and strips a path that works. That isn't an edge case I overlooked, it's the modal Windows setup, and it would have shipped as a regression to most per-machine installs.Splitting the fact from the capability is the better shape.
canSelfUpdate()answers "is there a path at all",updateNeedsElevation()answers "will it be quiet", and neither pretends to answer "can this human satisfy UAC", which as you say isn't answerable from inside the process.What I can confirm, and what I can't yet
I'm still on 0.50.0, so I verified the input to your logic rather than watching your logic run. Replicating
isInstallRootWritable()exactly, writing a real file into the root and removing it:EPERM rather than ENOENT, so that's the permission answer and not a missing directory. On this install 1.0.1 will report
true. I'll confirm the dialog and tooltip once I'm actually on it.One thing worth naming about where that lands: since admins run unelevated by default,
updateNeedsElevation()is going to betruefor essentially every per-machine install, admin or not. So the dialog string carries the whole distinction, and yours does carry it. "If you cannot grant them, download the installer from the releases page instead" reads correctly to both populations without the code having to work out which one it's talking to.The evidence you asked for
I don't have it, and I'm not going to reason my way there. What
quitAndInstall()does on a per-machine install when UAC is declined is a question about electron-updater's spawn path, and the failure I'd be claiming (half-applied, or a wmux that won't start) is exactly the sort of thing that's wrong when it's guessed.What I do have is the configuration. This box is row 2's end state already: per-machine root, admin account, unelevated process. So updating it from 0.50.0 to 1.0.1 is that test, and I have to do it anyway. I'll take the in-app path, decline the prompt, and report what it leaves behind. If it's merely un-updated, your call stands and I'd leave
canSelfUpdate()alone. If it leaves the install broken, that's yourfalsecondition and I'll say so plainly.Take that over anything I could argue from here.
On #158
Fair, though I doubt I'd have caught the over-correction either if the relocation hadn't happened on my own machine and left me able to check the shortcuts one at a time. The reason that table exists is that I went looking for damage I expected to find and mostly didn't.
Noted on the cache being per-process. I'll restart before reading anything.
amirlehmam commentedon Aug 16, 2026
Status for 1.2.0, since this is still open on your row-2 result.
Nothing in
updater.tschanged.canSelfUpdate(),updateNeedsElevation()andisInstallRootWritable()are as shipped in 1.0.1, the probe is still a real write-and-remove cached for the process lifetime, and the seven tests still pin the deliberate non-change (per-machine ⇒canSelfUpdate()true,updateNeedsElevation()true). So your reading is unaffected and the clock hasn't reset.Your pre-verification stands as the input to it:
EPERMrather thanENOENTis the part that makes it the permission answer.The observation of yours I keep coming back to
That is right, and it is the reason the split holds up. If the function were trying to answer "can this human update", a value that is true for nearly every per-machine install would be useless. It isn't — it answers "will Windows ask", which is true for nearly every per-machine install because that is the fact. The dialog then carries the distinction the code deliberately doesn't attempt.
BELLAMI\Aadarsh Upadhyaybeing in Administrators while the process runs unelevated is the counterexample that would have made option 1 a regression, and you found it against your own recommendation. I'd have shippedfalseon your say-so.Still open on the one thing neither of us has
Your row 2, run for real: take the in-app update on a per-machine install, decline the UAC prompt, and report what it leaves behind.
canSelfUpdate()stays as it isfalsecondition I named, and I'll take itYou said you'd take that over anything you could argue from there, and I agree. I'm not going to close this on my own half of the fix.
One practical note since 1.2.0 is out: if you update from 0.50.0 through the in-app path, that upgrade is the test, and it only runs once per install — 0.50.0 → 1.2.0 rather than → 1.1.1 now, but the transition is the same one. Restart before reading
updateNeedsElevation(), since the probe reflects the token wmux started with.Row 4 (per-machine → per-user) I still think may be worse than row 2, for the reason we agreed: it strands an HKLM uninstall entry and all-users shortcuts, which is real garbage on disk rather than an inconvenient prompt. That one is mine — it needs real installers against real accounts, and it's my release process.
Option 2 remains untouched and still wants the matrix first.
fix(nsis): pin the install scope on update (#167, #158)
amirlehmam commentedon Aug 17, 2026
Option 2 is done in 1.3.0. The half I argued about is unchanged, and still waiting on you.
What shipped
Your title carried a clause the discussion kept treating as background: "…and the scope page re-offered mid-update is how installs get there." That is the part I had deferred in #158 — "pinning the scope here would make the invariant true, but it changes upgrade behaviour for every existing install and cannot be verified without running a real installer, so it is deliberately NOT done" — and it is now fixed.
The asymmetry that allowed it is in electron-builder's own templates, and once seen it is hard to defend. In
assistedInstaller.nsh:The directory page is skipped on an update. The scope page directly above it is not. And
initMultiUserhas already read the existing scope out ofHKLM/HKCUInstallLocationand selected it, in.onInit, before either page renders.So the page was never asking a question the installer needed answered. It was offering a chance to overwrite an answer it already had right.
build/installer.nshnow plugs the documented seam —multiUserUi.nshzeroes both force flags, insertscustomInstallMode, then aborts the page when either is set:Narrow on purpose. It fires only when exactly one installation exists. A first install still gets the choice; a machine carrying both still gets it, because choosing there would be a guess.
/allusersand/currentuserstill work —initMultiUserfolds them into the same two variables, so a deliberate scope change forces itself.How it was verified, since neither of us wanted another reasoned-not-observed claim
I compiled it with
makensisand then ran it: a silent-install harness drives the macro through all four registry states and writes out the decision.That is the whole truth table, executed by NSIS rather than argued from the source.
There is also a unit test, and it deliberately asserts against electron-builder's templates rather than mine — that
customInstallModeis still inserted, that the force flags are still zeroed immediately before it, that the page still aborts, and that the mode page is still unguarded byskipPageIfUpdated. The failure mode for a fix like this is not "it breaks"; it is that a dependency bump renames something and the macro stays valid, keeps compiling, and quietly stops being connected to anything. That is what the test is for. If electron-builder ever guards the page itself, the test fails and the macro should be deleted rather than left to rot.How this relates to the half I did not change
updater.tsis untouched —canSelfUpdate(),updateNeedsElevation()andisInstallRootWritable()are exactly as shipped in 1.0.1, the probe is still a real write-and-remove cached for the process lifetime, and the seven tests still pin the deliberate non-change. So your reading is unaffected and the clock has not reset.The two halves are diagnosis and prevention, not duplicates.
updateNeedsElevation()reports the state honestly; this stops installs arriving in it by accident. Your own machine is the case in point —BELLAMI\Aadarsh Upadhyayin Administrators, process unelevated,EPERMon the probe. That install is in that state; from 1.3.0 no wmux update can put another one there without the user explicitly passing/allusers.What it does not do is make the install path an invariant, and nothing in wmux may start treating it as one — a user can still relocate deliberately. The agent-context block still interpolates
process.resourcesPathfresh on every startup rather than recording it once.Still open on the one thing neither of us has
Unchanged, and still yours: take the in-app update on a per-machine install, decline the UAC prompt, and report what it leaves behind.
canSelfUpdate()stays as it isfalsecondition I named, and I'll take itYou said you'd take that over anything you could argue from there. It is 0.50.0 → 1.3.0 now, but it is the same transition and it still only runs once per install. Restart before reading
updateNeedsElevation(), since the probe reflects the token wmux started with.Row 4 (per-machine → per-user) is still mine, still unrun, and I still think it may be worse than row 2 for the reason we agreed — a stranded HKLM uninstall entry and all-users shortcuts is real garbage on disk rather than an inconvenient prompt.
1.3.0 is out — https://github.com/amirlehmam/wmux/releases/tag/v1.3.0
Leaving this open, same as before: I have shipped my half twice now and you are still the one holding the measurement that decides the other.