Skip to content

Track packages that cannot finish until the machine reboots - #5464

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
feat/pending-machine-restart
Oct 1, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
feat/pending-machine-restart

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request introduces comprehensive support for tracking and handling system restarts required by package operations. It updates both backend data structures and the user interface to inform users when a restart is needed, provides clear notifications, and enables users to initiate a restart directly from the application. Documentation and localization are also updated to reflect these changes.

The most important changes are:

System Restart Tracking and Exposure:

  • Added fields to API responses and documentation to expose when a system restart is pending and which packages require it, including new documentation for "Pending machine restarts" in docs/IPC.md. [1] [2] [3]

User Interface Enhancements:

  • Added a new SystemRestartService to prompt the user and initiate a system restart, including confirmation dialogs and error handling.
  • Updated the tray icon and menu to display restart status, show a "Restart computer" option when needed, and update tooltips to reflect restart requirements. [1] [2] [3] [4] [5] [6]

Notifications and Operation Feedback:

  • Refactored operation success notifications to append a restart-required message when applicable, using a new OperationNotificationText helper. [1] [2] [3] [4]

ViewModel and State Management:

  • Updated application and operation state to track and expose restart requirements, including new fields in app info and operation history status labels. [1] [2] [3]

Localization and Documentation:

  • Added and updated English strings for all new user-facing messages related to restarts.

These changes ensure that users and fleet tools are clearly informed about pending restarts, can see which packages require them, and have an integrated way to complete the process.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Pending-state identity, multi-session persistence, fallback reboot detection, and premature clearing can produce lost or incorrect restart status.

Review effort: Balanced
Findings: 1 High severity · 4 Medium severity · 1 Low severity

Open (6)
What changed in this PR

Adds end-to-end tracking and presentation of package operations requiring a machine restart.

Changes:

  • Introduces persistent reboot tracking and restart-required operation verdicts.
  • Exposes restart state through IPC, history, notifications, and tray UI.
  • Adds manager tests, documentation, and localization strings.
File Description
src/​UniGetUI.PackageEngine.Tests/​WinGetManagerTests.cs Tests WinGet restart codes.
src/​UniGetUI.PackageEngine.Tests/​PendingRebootStoreTests.cs Tests reboot persistence and cleanup.
src/​UniGetUI.PackageEngine.Tests/​ChocolateyManagerTests.cs Tests Chocolatey reboot codes.
src/​UniGetUI.PackageEngine.Operations/​Reboot/​PendingRebootStore.cs Persists pending-restart packages.
src/​UniGetUI.PackageEngine.Operations/​Reboot/​PendingRebootJsonContext.cs Adds source-generated JSON metadata.
src/​UniGetUI.PackageEngine.Operations/​Reboot/​PendingRebootEntry.cs Defines persisted reboot records.
src/​UniGetUI.PackageEngine.Operations/​Reboot/​BootSession.cs Identifies boot sessions and uptime.
src/​UniGetUI.PackageEngine.Operations/​PackageOperations.cs Records reboot state after operations.
src/​UniGetUI.PackageEngine.Operations/​History/​OperationHistoryRecord.cs Stores restart requirements in history.
src/​UniGetUI.PackageEngine.Operations/​AbstractOperation.cs Handles restart-required verdicts as success.
src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs Maps WinGet restart exit codes.
src/​UniGetUI.PackageEngine.Managers.Chocolatey/​Helpers/​ChocolateyPkgOperationHelper.cs Maps Chocolatey restart exit codes.
src/​UniGetUI.PackageEngine.Enums/​Enums.cs Adds the restart-required verdict.
src/​UniGetUI.Interface.IpcApi/​IpcPackageApi.cs Exposes package restart state.
src/​UniGetUI.Interface.IpcApi/​IpcOperationApi.cs Exposes operation restart state.
src/​UniGetUI.Interface.IpcApi/​IpcLogsApi.cs Exposes historical restart state.
src/​UniGetUI.Interface.IpcApi/​IpcAppApi.cs Adds app-level restart fields.
src/​UniGetUI.Interface.IpcApi/​HeadlessIpcHost.cs Reports restart state headlessly.
src/​UniGetUI.Avalonia/​Views/​Pages/​SettingsPages/​SettingsBasePage.axaml.cs Distinguishes application restart state.
src/​UniGetUI.Avalonia/​ViewModels/​Pages/​LogPages/​OperationHistoryRowViewModel.cs Displays restart-required history badges.
src/​UniGetUI.Avalonia/​Infrastructure/​WindowsAppNotificationBridge.cs Uses shared success notification text.
src/​UniGetUI.Avalonia/​Infrastructure/​TrayService.cs Adds restart tray status and action.
src/​UniGetUI.Avalonia/​Infrastructure/​SystemRestartService.cs Confirms and requests Windows restart.
src/​UniGetUI.Avalonia/​Infrastructure/​OperationNotificationText.cs Appends restart guidance to notifications.
src/​UniGetUI.Avalonia/​Infrastructure/​MacOsNotificationBridge.cs Uses shared success notification text.
src/​UniGetUI.Avalonia/​Infrastructure/​AvaloniaOperationRegistry.cs Separates app restart state and notification text.
src/​UniGetUI.Avalonia/​Infrastructure/​AvaloniaBootstrapper.cs Reports restart state through IPC.
src/​Languages/​lang_en.json Adds restart-related English strings.
docs/​IPC.md Documents restart-related IPC fields.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.PackageEngine.Operations/Reboot/PendingRebootStore.cs Outdated
Comment thread src/UniGetUI.Avalonia/Infrastructure/SystemRestartService.cs Outdated
Comment thread src/UniGetUI.PackageEngine.Operations/Reboot/PendingRebootStore.cs
Comment thread src/UniGetUI.PackageEngine.Operations/Reboot/PendingRebootStore.cs
Comment thread src/UniGetUI.PackageEngine.Operations/Reboot/PendingRebootStore.cs
Comment thread src/Languages/lang_en.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Restart state can be lost or become stale across cancellation and retry paths, and the IPC contract cannot enumerate every pending package.

Review effort: Balanced
Findings: None

Resolved since last review (6)
Previously missed (5)

In code that hasn't changed since last review

Medium severity Expose pending reboot package entries to clients

docs/​IPC.md:425

The documented fields do not actually let a client enumerate all pending packages: the app response exposes only a count, while systemRestartPending only decorates packages returned by another query. A reboot-required uninstall is removed from the installed/upgradable loaders (PackageOperations.cs:1561-1566), so its pending record may have no package payload to query. Expose the pending entries through the app response or a dedicated endpoint, or narrow the claim that fleet tools can identify which packages are waiting.

Medium severity Announce immersive restart confirmation to screen readers

src/​UniGetUI.Avalonia/​Infrastructure/​SystemRestartService.cs:82

This immersive confirmation is not guaranteed to be announced as a native modal window. The established pattern explicitly announces these prompts (PolicyEditorConfirmationPrompt.cs:43-48); without that, a screen-reader user may miss both the imminent restart warning and the focused action buttons.

Medium severity Inserting enum member changes AutoRetry's numeric value

src/​UniGetUI.PackageEngine.Enums/​Enums.cs:47

Inserting RestartRequired before AutoRetry changes the existing public enum member's numeric value from 4 to 5. Previously built consumers or persisted numeric values for AutoRetry would now be interpreted as a restart requirement. Append the new member instead (or assign explicit stable values).

Medium severity Reset SystemRestartRequired before each operation run

src/​UniGetUI.PackageEngine.Operations/​AbstractOperation.cs:353

SystemRestartRequired is assigned only after _runOperation returns. The UI and IPC API allow retrying a succeeded operation, so a prior true remains exposed while the rerun is queued/running and remains set if that rerun takes an early cancellation path. Reset this per-run flag at the start of MainThreadCore, before any early return, so canceled history and live IPC do not report the previous attempt's result.

Medium severity Persist restart-required result before post-operation cancellation

src/​UniGetUI.PackageEngine.Operations/​PackageOperations.cs:136

The store update only runs for the final OperationSucceeded event. Once a manager returns RestartRequired, _runOperation continues into post-operations; if the user cancels during one, the final event is canceled and no pending reboot is recorded even though the installer has already requested one. Capture and persist the restart-required result before post-operations or other late cancellation paths.

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "54906600-bdd1-11f1-98b9-fceadfb9e055",
	"headSha": "20bcbb4ffb8c0bfbe95819751cb3022807b486ec",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit e0ec8e2 into main Oct 1, 2026
7 of 8 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the feat/pending-machine-restart branch October 1, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants