Skip to content

fix(agent): report which Windows installer check failed and install in one transaction - #1492

Merged
AnthonyRonning merged 5 commits into
masterfrom
claude/windows-installer-fixes
Nov 7, 2026
Merged

AnthonyRonning merged 5 commits into
masterfrom
claude/windows-installer-fixes

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A Windows 11 Pro user's Maple Work 0.0.18 install failed at stage 22 with 0x4E000005. That code comes from the installer's own preflight guard (windows_fs.rs invalid_at), not from a Windows read or write failure. But the dialog says it could not read or write, and the guard's label goes to stderr, which NSIS drops. 18 guard reasons share that one exit code, so the report can't tell us which one fired.

We reproduced the route on a Windows 11 VM by granting BUILTIN\Users Modify on %LOCALAPPDATA%\Programs. The guard also refuses a parent that only lets other accounts create folders, which is stricter than a new install needs.

Changes

Three commits:

  1. Support codes and logs. A failed install now reports a fixed code such as MWI/installation/validate-installation-parent/foreign-write-ace, plus the Windows build, elevation, native error, build identity and elapsed time. Ctrl+C in the error dialog copies it. The last ten logs are kept in %LOCALAPPDATA%\Maple Work Installer Logs. Paths, accounts, raw error text and app data stay out of the report, and a canary test checks that. Logging is best effort and never changes the result.
  2. Folder creation in a new install's parent. A parent of a new install may let other accounts create subfolders (FILE_ADD_SUBDIRECTORY) and nothing else. Everything else stays strict: the installed root and files, other foreign write rights, unsafe owners, reparse points and hard links are still refused. The new root still gets its own protected ACL.
  3. One native transaction. NSIS now extracts the payload and calls one --internal-windows-installer-install command, which owns admission, locks, copying, registration, shortcuts and activation. It writes durable checkpoints, so a helper that crashes still leaves its last step in the log. A failure before activation restores registration and removes only the shortcuts it created, if they are unchanged. The launcher, uninstaller and previous generation stay for rollback. Legacy helper commands, updater formats, trust policy and activation exit codes are unchanged.

The user's actual trigger is still unknown. This makes the next report say which guard fired, and relaxes the one guard we showed was too strict.

Testing

Not built or tested locally for this PR. Codex wrote and tested the patch on a native Windows 11 Pro ARM64 VM (build 26200.9711) against f09df6ba; the touched files have not changed on master since. From its report:

  • cargo test -p maple-agent-updater (109 unit and 5 native bootstrap tests), workspace Clippy for Windows with -D warnings, cargo fmt --check, and an NSIS 3.12 compile.
  • Native fixtures: fresh install, repeat, injected failure with registry and shortcut rollback, abandoned-intent recovery, upgrade, concurrent installer lock, and ACL cases (folder-creation-only parent accepted, ten other mutation rights refused).
  • Real unsigned Dev installers (builds 9001 and 9002):
    • A fresh /S install under a parent granting Everyone only folder creation exited 0 in 8.4 s and left the parent's ACL unchanged.
    • A repeat install kept the active version.
    • A parent granting delete-child failed with .../foreign-write-ace and created nothing.
    • An upgrade with the old app running was refused (sharing violation, Windows error 32), then succeeded after closing it, keeping the old generation.
    • Uninstall removed the registration and kept user data.

Not covered: x64 hardware, signed Prod packages, installs without elevation (the VM ran elevated), and the app's window after install (the inspection tool failed). Full Linux and macOS CI did not run there.

ci:package is on to build the unsigned Windows x64 and ARM64 installers for testing on our VM, and ci:windows adds the native updater tests and the full Windows suite. Both should come off once we have the results.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@AnthonyRonning AnthonyRonning added ci:windows Run Windows checks on this PR ci:package Build unsigned packages on this PR labels Nov 7, 2026
@AnthonyRonning AnthonyRonning removed the ci:windows Run Windows checks on this PR label Nov 7, 2026
@AnthonyRonning
AnthonyRonning merged commit c7bdcfe into master Nov 7, 2026
24 checks passed
@AnthonyRonning
AnthonyRonning deleted the claude/windows-installer-fixes branch November 7, 2026 19:54
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.

2 participants