Skip to content

Start the Windows update recovery watcher under a neutral file name - #6505

Merged
BunsDev merged 2 commits into
mainfrom
fix/issue-5981-recovery-watcher-name
Nov 17, 2026
Merged

BunsDev merged 2 commits into
mainfrom
fix/issue-5981-recovery-watcher-name

Conversation

@BunsDev

@BunsDev BunsDev commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Refs #5981. #5981 stays open: the end-to-end declined-UAC UI row still needs a release that carries this PR and #6503, plus a newer release to update to.

Problem

Before Restart & install, arm_update_install_recovery copies Cave's executable. The updater's pre-exit teardown then starts the copy as a watcher, which relaunches Cave after a declined or failed install. The copy was named install-watch-<pid>.exe.

With UAC on, Windows installer detection refuses to start an executable whose file name contains words such as "install", "setup" or "update" unless its manifest declares a requestedExecutionLevel. Tauri's default manifest declares none. So the watcher never ran, and a declined UAC prompt left Cave closed with no recorded outcome.

Evidence (packaged Windows 11 VM for #5981, disposable admin profile, EnableInstallerDetection=1)

The UI cannot arm recovery today (#6503), so the main webview was moved over the debug port to Cave's bundled origin. That origin is granted the recovery commands. From there v0.5.21 ran its own sequence against the production v0.5.22 feed: arm, signature-verified download, install, disarm on a rejected install.

  • Run 1: msiexec started and v0.5.21 exited. UAC was declined: consent.exe exit 1223, Windows Installer status 1602. No watcher process appeared, nothing was recorded, and Cave stayed closed.

  • Run 2, with a WMI process start/stop trace: install-watch-9772.exe started and exited 3 ms later with 0xC000042C (STATUS_ELEVATION_REQUIRED).

  • A/B control (same app.exe bytes, run as the profile user, with a malformed watcher flag that should exit 2):

    • install-watch-probe.exe: error 740, "The requested operation requires elevation"
    • update-probe.exe: error 740
    • cave-recovery-probe.exe: exit 2
    • app-copy-probe.exe: exit 2
  • Run 3: Cave's own copy failed again. The same bytes, started as cave-recovery-watch.exe with Cave's exact watcher arguments:

    1. waited for Cave to exit;
    2. found its msiexec, which exited 1602 after the decline;
    3. wrote {"kind":"cancelled","exitCode":1602,...};
    4. relaunched Cave, whose sidecar came back on 3020.

    The relaunched v0.5.21 UI still showed only a fresh update offer: its loopback page is refused update_install_outcome by ACL (Grant the packaged UI its Windows recovery and update-link commands #6503). Read from the bundled origin, the outcome command returned the record.

Change

  • The copy is now cave-recovery-<pid>.exe, chosen by watcher_copy_file_name(). Only the file name matters; the directory stays update-install-watch, and its leftover copies are still removed at startup.
  • A test keeps the name free of the installer-detection keywords (install, setup, update, patch, upgrade). Negative control: the old name fails it.
  • docs/windows-update-preparation.md records the constraint and the acceptance evidence.

Validation

  • cargo test --lib windows_update_recovery: 6/6 pass on macOS.
  • rustfmt --check on the changed file is clean, clippy reports nothing in the changed lines, and docs-check and git diff --check are clean.
  • CI first run, head 26c2d9fe6 (run 43879698067): the Windows native lane built the app and ran all 7 windows_update_recovery tests on Windows, including the new one. All passed, but the lane failed with "Unexpected test count", because windows-startup.yml and its contract in src-tauri/release-runtime.test.mjs pinned the count at 6. The follow-up commit raises the pin to 7. The contract passes locally, and actionlint is clean.
  • Not verified: the end-to-end UI row. It needs a release.

Refs #5981.

Arming update install recovery copies Cave's executable and starts the copy
at the updater's pre-exit teardown. The copy was named install-watch-<pid>.exe.
With UAC on, Windows installer detection refuses to start an executable whose
file name contains "install" or "update" unless its manifest declares a
requestedExecutionLevel, and Tauri's default manifest declares none.

Packaged Windows 11 acceptance (v0.5.21 to v0.5.22, filtered administrator,
EnableInstallerDetection=1) traced the copy exiting with
STATUS_ELEVATION_REQUIRED 3 ms after it started. A declined UAC prompt then
left Cave closed with no recorded outcome. The same app.exe bytes failed with
error 740 as install-watch-probe.exe and update-probe.exe, and started as
cave-recovery-probe.exe. Started under a neutral name with Cave's own
arguments, the watcher found the client msiexec, read 1602 after the decline,
recorded the cancelled outcome and relaunched Cave.

The copy is now cave-recovery-<pid>.exe. A test keeps the name free of
installer-detection keywords. The banner that shows the outcome also needs the
packaged origin's update_install_outcome grant (#6503).
Refs #5981.

windows-startup.yml pins the number of windows_update_recovery tests it
expects, and its contract mirrors the pin. The new installer-detection name
test makes it 7. On the first run all 7 passed on Windows, and the lane failed
only on "Unexpected test count".
@BunsDev
BunsDev merged commit ca7cfa0 into main Nov 17, 2026
23 checks passed
@BunsDev
BunsDev deleted the fix/issue-5981-recovery-watcher-name branch November 17, 2026 01:14
@github-project-automation github-project-automation Bot moved this from Todo to Done in Cave Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant