Skip to content

CI: Disable powershell engine event logging before running tests#3457

Open
smalis-msft wants to merge 1 commit into
microsoft:mainfrom
smalis-msft:disable-powershell-logging
Open

CI: Disable powershell engine event logging before running tests#3457
smalis-msft wants to merge 1 commit into
microsoft:mainfrom
smalis-msft:disable-powershell-logging

Conversation

@smalis-msft
Copy link
Copy Markdown
Contributor

We've been seeing a lot of test flakiness lately that seems to be coming from powershell itself crashing during startup, not any of our code. Claude seems to think that disabling this bit of powershell internal logging should fix it. Let's see what happens.

Alternative to #3456

Copilot AI review requested due to automatic review settings May 11, 2026 21:34
@smalis-msft smalis-msft requested review from a team as code owners May 11, 2026 21:34
@smalis-msft smalis-msft added the release-ci-required Add to a PR to trigger PR gates in release mode label May 11, 2026
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a Flowey CI step to disable Windows PowerShell engine event logging on Windows runners to mitigate transient powershell.exe startup crashes that cause test flakiness.

Changes:

  • Introduces a new Flowey node to harden PowerShell event logging via registry settings.
  • Wires the hardening node into the Windows test job’s pre-run dependencies.
  • Adds explicit CI workflow steps to run the hardening node before starting test services.

Reviewed changes

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

Show a summary per file
File Description
flowey/flowey_lib_hvlite/src/lib.rs Exposes the new hardening module from the crate.
flowey/flowey_lib_hvlite/src/harden_powershell_event_log.rs Implements the Windows runner hardening step (registry + event source check).
flowey/flowey_lib_hvlite/src/_jobs/consume_and_test_nextest_vmm_tests_archive.rs Ensures hardening runs before tests on Windows.
ci-flowey/openvmm-pr.yaml Adds pipeline steps to run the hardening node before starting test services.
.github/workflows/openvmm-pr.yaml Adds GitHub Actions steps to run the hardening node in multiple Windows jobs.
.github/workflows/openvmm-pr-release.yaml Adds the hardening step to Windows release PR workflow jobs.
.github/workflows/openvmm-ci.yaml Adds the hardening step to Windows CI workflow jobs.

if (-not (Test-Path $key)) {
New-Item -Path $key -Force | Out-Null
}
Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force
Comment on lines +52 to +81
// Disable Windows PowerShell engine event logging. The key may
// not pre-exist on all runner images, so create it first.
// Failures are logged but non-fatal: the worst case is we fall
// back to the original (occasionally flaky) behavior.
let script = r#"
$ErrorActionPreference = 'Continue'
$key = 'HKLM:\Software\Microsoft\PowerShell\1\PowerShellEngine'
if (-not (Test-Path $key)) {
New-Item -Path $key -Force | Out-Null
}
Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force
# Ensure the 'Windows PowerShell' Event Log source exists with
# the right registration so any path that still tries to use
# it doesn't fault.
try {
if (-not [System.Diagnostics.EventLog]::SourceExists('PowerShell')) {
[System.Diagnostics.EventLog]::CreateEventSource('PowerShell','Windows PowerShell')
}
} catch {
Write-Host "warn: could not verify PowerShell event source: $_"
}
"#;

let output = std::process::Command::new("powershell.exe")
.arg("-NoProfile")
.arg("-NonInteractive")
.arg("-ExecutionPolicy")
.arg("Bypass")
.arg("-Command")
.arg(script)
Comment on lines +62 to +72
Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force
# Ensure the 'Windows PowerShell' Event Log source exists with
# the right registration so any path that still tries to use
# it doesn't fault.
try {
if (-not [System.Diagnostics.EventLog]::SourceExists('PowerShell')) {
[System.Diagnostics.EventLog]::CreateEventSource('PowerShell','Windows PowerShell')
}
} catch {
Write-Host "warn: could not verify PowerShell event source: $_"
}
// back to the original (occasionally flaky) behavior.
let script = r#"
$ErrorActionPreference = 'Continue'
$key = 'HKLM:\Software\Microsoft\PowerShell\1\PowerShellEngine'
if (-not (Test-Path $key)) {
New-Item -Path $key -Force | Out-Null
}
Set-ItemProperty -Path $key -Name 'EnableEventLogging' -Value 0 -Type DWord -Force
Comment on lines +3597 to +3599
- name: harden Windows PowerShell event log
run: flowey.exe e 20 flowey_lib_hvlite::harden_powershell_event_log 0
shell: bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-ci-required Add to a PR to trigger PR gates in release mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants