Repository navigation
Retry Chocolatey operations elevated when a package script demands admin - #5495
Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit intoOct 9, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
October 9, 2026 14:52
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation matches the reported failure and is covered by appropriate regression tests.
0 open findings
What changed in this PR
Adds reliable elevated retries for Chocolatey packages whose scripts require administrator privileges.
Changes:
- Detects two additional Chocolatey elevation-error phrases.
- Honors the global prohibition on elevation retries.
- Adds coverage for positive, negative, and prohibited-elevation cases.
| File | Description |
|---|---|
ChocolateyManagerTests.cs |
Tests elevation detection and policy behavior. |
ChocolateyPkgOperationHelper.cs |
Extends elevation matching and respects settings. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉
Integration Details
{
"deliveryId": "1b1917c0-c3f1-11f1-9cd0-a96f5b016884",
"headSha": "6f83113e57c0d6335446ebe41fba3b69350ba98b",
"reviewer": "copilot-pull-request-reviewer[bot]"
}
4 tasks done
Gabriel Dufresne (GabrielDuf)
deleted the
fix/choco-package-script-elevation
branch
October 9, 2026 15:27
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.
Chocolatey updates of
python,python3andpython314always failed in UniGetUI, whilechoco upgrade python python3 python314 -yworks from an elevated console. UniGetUI never retried them as administrator.Root cause
The python314 package checks for admin rights in its own install script (
tools\helpers.ps1). When it isn't elevated, it throws:The Chocolatey operation helper only retries as administrator when the output contains one of a fixed set of phrases. None of them matched this text, so the operation was reported as a plain failure.
Changes
requires Administrative permissionsandrun from elevated promptnow trigger the elevated retry. Each is recognised on its own, so a package script that uses only one of the two sentences is caught too.Notes for reviewers
"Run as Administrator"(capital A). The existingRun as administratorcheck must not match it, or every failed non-elevated run would be retried elevated. Neither new phrase appears in that warning. A test pins that the warning plus an unrelated error still gives a plain failure.Testing
ChocolateyManagerTestspass, anddotnet format whitespaceandstyleare clean.%LOCALAPPDATA%, where choco itself runs without admin rights. A normal system-wide Chocolatey fails earlier with "Access denied", which was already handled.Closes #5492