Skip to content

fix: CLI and GUI bug sweep#30

Merged
Stensel8 merged 13 commits into
mainfrom
copilot/stresstest-and-bug-finding
May 2, 2026
Merged

fix: CLI and GUI bug sweep#30
Stensel8 merged 13 commits into
mainfrom
copilot/stresstest-and-bug-finding

Conversation

Copy link
Copy Markdown

Copilot AI commented May 2, 2026

Fixed 19 bugs across the CLI (PowerShell) and GUI (C#/WinUI 3).

CLI

  • linux/Invoke-AudioRestart.ps1 - command injection via bash -c; rewritten to call systemctl directly via sudo -u "$user" env KEY=VALUE; DBUS address validated against known transport prefixes before use
  • linux/Invoke-AudioRestart.ps1 - PulseAudio kill+start was a single shell compound string; split into two separate invocations
  • linux/Invoke-DiskCleanup.ps1 - pacman -Rns with an empty list caused a confusing non-zero exit; now skips when pacman -Qdtq returns nothing
  • Start.ps1 - crash when uname -r returns nothing; fixed kernel version regex to also split on - (e.g. 6.1-gentoo)
  • Get-SystemInfo.ps1 - $env:firmware_type is only set in WinPE/MDT, always empty in live sessions; replaced with PEFirmwareType registry read
  • Invoke-BootRepair.ps1 - /offbootdir and /offwindir flags are invalid in a live SFC session; now only passed when running from WinRE (X:\ check)
  • Invoke-HPUpdate.ps1 - HP Image Assistant was installed silently on non-HP hardware; now checks Win32_ComputerSystem.Manufacturer and prompts before continuing
  • menus/Tools.ps1 - unhandled terminating error in a tool script crashed the entire menu session; wrapped in try/catch
  • Test-NetworkContinuous.ps1 - Ctrl+C inside the ping loop propagated an exception back to the menu; wrapped in try/finally
  • Invoke-DiskCleanup.ps1 / Invoke-DiskOptimize.ps1 - bare cleanmgr.exe/dfrgui.exe resolved via PATH; switched to full $env:SystemRoot\System32\... path
  • Invoke-PowerOptions.ps1 - unquoted $env:USER in loginctl call breaks on usernames with spaces
  • Get-LicenseKey.ps1 - (($isWin8Plus -band 2) -shl 2) is always 0 since $isWin8Plus is 0 or 1; removed the dead expression

GUI

  • ProcessRunner.cs - no timeout meant a hung subprocess blocked the UI indefinitely; added configurable timeout (default 10 min) with proper linked CancellationTokenSource disposal
  • UpdateChecker.cs - Version.TryParse failed on pre-release tags like v2.1.0-rc1; strip hyphen suffix before parsing
  • AppSettings.cs - GetBool compared raw == "true" (case-sensitive), silently ignoring "True" and "1"
  • HealthPage.xaml.cs - battery timer started even when the page was navigated away before GatherData completed; added IsLoaded guard
  • HealthPage.xaml.cs - ReadToEnd() after WaitForExit() could deadlock on a full pipe buffer; added 30s hard timeout with Kill(entireProcessTree: true)
  • HealthPage.xaml.cs - smartctl device path was string-interpolated with manual quoting; replaced with RunCaptureWithArgs using ProcessStartInfo.ArgumentList
  • InfoPage.xaml / MainWindow.xaml.cs - stale GitHub URLs

Copilot AI and others added 5 commits May 2, 2026 09:15
…pair SFC, pacman orphan crash, Ctrl+C continuous ping, firmware type registry read, HP device guard, wrap tool invocations in try/catch

Agent-Logs-Url: https://github.com/Stensel8/pcHealth/sessions/cf096b38-0fd6-41db-ae20-3da052e5ff82

Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Stensel8/pcHealth/sessions/cf096b38-0fd6-41db-ae20-3da052e5ff82

Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
…s, wrong repo URLs, regex class, registry property access

Agent-Logs-Url: https://github.com/Stensel8/pcHealth/sessions/012607b5-b250-425e-8f9b-2dbb071b2bb3

Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
…rd, scanArgs if-else, ProcessRunner explicit CTS disposal

Agent-Logs-Url: https://github.com/Stensel8/pcHealth/sessions/012607b5-b250-425e-8f9b-2dbb071b2bb3

Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
…, DBUS pattern variable, WinRE X:\ comment, Write-Debug on missing registry value

Agent-Logs-Url: https://github.com/Stensel8/pcHealth/sessions/012607b5-b250-425e-8f9b-2dbb071b2bb3

Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com>
@github-actions github-actions Bot added windows-11 Windows 11 / GUI related. powershell PowerShell script changes. csharp C# source code changes. linux Linux CLI related. labels May 2, 2026
Comment thread src/CLI/tools/linux/Invoke-AudioRestart.ps1 Fixed
Comment thread src/CLI/tools/linux/Invoke-AudioRestart.ps1 Fixed
Comment thread src/CLI/tools/linux/Invoke-AudioRestart.ps1 Fixed
@Stensel8 Stensel8 marked this pull request as ready for review May 2, 2026 19:11
@Stensel8 Stensel8 self-requested a review as a code owner May 2, 2026 19:11
Copilot AI review requested due to automatic review settings May 2, 2026 19:11
@Stensel8 Stensel8 changed the title fix: CLI/GUI bug sweep — command injection, wrong repo URLs, process hangs, bare exe paths fix: CLI and GUI bug sweep May 2, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a cross-cutting bug-sweep for pcHealth’s PowerShell CLI and WinUI GUI, focused on safer process execution, more reliable OS/environment detection, and correcting stale repository links used across the app.

Changes:

  • Hardens command/process launching in both CLI and GUI, including Linux audio restart, GUI subprocess timeouts, and Windows tool launch paths.
  • Fixes correctness issues in system-info, boot-repair, settings parsing, and license-key decoding logic.
  • Updates stale GitHub links and release-check behavior to point at the current repository owner.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/GUI/pcHealth/Services/UpdateChecker.cs Updates GitHub release API URL and loosens tag parsing for suffixed versions.
src/GUI/pcHealth/Services/ProcessRunner.cs Adds a default timeout path to GUI subprocess execution.
src/GUI/pcHealth/Services/AppSettings.cs Makes boolean settings parsing case-insensitive and accepts "1".
src/GUI/pcHealth/Pages/InfoPage.xaml Fixes repository and issue tracker hyperlinks.
src/GUI/pcHealth/Pages/HealthPage.xaml.cs Guards UI updates after unload and reworks smartctl capture/argument handling.
src/GUI/pcHealth/MainWindow.xaml.cs Fixes the releases URL opened from the update prompt.
src/CLI/tools/linux/Invoke-DiskCleanup.ps1 Skips orphan removal when pacman reports no orphaned packages.
src/CLI/tools/linux/Invoke-AudioRestart.ps1 Removes shell-string execution and validates DBUS forwarding.
src/CLI/tools/Test-NetworkContinuous.ps1 Adds try/finally around the continuous ping loop.
src/CLI/tools/Invoke-PowerOptions.ps1 Quotes the Linux username passed to loginctl.
src/CLI/tools/Invoke-HPUpdate.ps1 Prompts before installing HP tooling on non-HP hardware.
src/CLI/tools/Invoke-DiskOptimize.ps1 Launches Defrag/Optimize from an explicit System32 path.
src/CLI/tools/Invoke-DiskCleanup.ps1 Launches Disk Cleanup from an explicit System32 path.
src/CLI/tools/Invoke-BootRepair.ps1 Switches live-session SFC to /scannow and gates offline flags on environment detection.
src/CLI/tools/Get-SystemInfo.ps1 Reads firmware type from the registry instead of an environment variable.
src/CLI/tools/Get-LicenseKey.ps1 Simplifies a dead bitwise expression in DigitalProductId decoding.
src/CLI/menus/Tools.ps1 Wraps tool execution in try/catch to keep the menu alive on failures.
src/CLI/menus/Main.ps1 Fixes owner branding/URLs and adds browser-launch error handling.
src/CLI/Start.ps1 Guards empty uname -r output before parsing the kernel version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CancellationToken ct = default,
TimeSpan timeout = default)
{
if (timeout == default) timeout = DefaultTimeout;
CancellationToken ct = default,
TimeSpan timeout = default)
{
if (timeout == default) timeout = DefaultTimeout;
Comment on lines +538 to +543
// Read output before WaitForExit to avoid a deadlock when the
// redirected buffer fills up.
var output = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
// 30-second hard cap: a drive that is failing or unresponsive can
// cause smartctl to hang indefinitely without this guard.
if (!proc.WaitForExit(30_000))
Comment on lines +581 to +583
proc.Start();
var output = proc.StandardOutput.ReadToEnd();
if (!proc.WaitForExit(30_000))
Comment on lines +57 to +60
if (Test-Path 'X:\') {
# WinRE always maps its RAM-disk to X:\ — this is enforced by the Windows
# boot environment and is not a user-configurable drive letter, so this
# check reliably distinguishes a WinRE session from a normal Windows boot.
Write-Host " Request timed out." -ForegroundColor Red
}
Start-Sleep -Seconds 1
}
Comment thread src/CLI/menus/Tools.ps1 Fixed
Stensel8 added 3 commits May 2, 2026 21:29
Remove an extra '#' in a comment so it reads 'Requires -Version 7.0' and more clearly explains that using '#Requires -Version 7.0' would throw at parse time and block the re-launch under PowerShell 7. This is a cosmetic clarification only.
@Stensel8 Stensel8 merged commit e2bb62c into main May 2, 2026
33 of 35 checks passed
@Stensel8 Stensel8 deleted the copilot/stresstest-and-bug-finding branch May 2, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

csharp C# source code changes. linux Linux CLI related. powershell PowerShell script changes. windows-11 Windows 11 / GUI related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants