From 30c7168f99703da36be2df9c0850cdccedf60ce3 Mon Sep 17 00:00:00 2001 From: starr-openai Date: Fri, 8 May 2026 17:05:01 -0700 Subject: [PATCH] Restore D-first Windows CI drive selection Revert the forced Dev Drive VHD experiment after CI showed the explicit VHD path was viable but slower than using the runner-provided D: drive on windows-latest. Co-authored-by: Codex --- .github/scripts/setup-dev-drive.ps1 | 87 ++++++++++++++--------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/.github/scripts/setup-dev-drive.ps1 b/.github/scripts/setup-dev-drive.ps1 index 48eb78f952..26ca58b837 100644 --- a/.github/scripts/setup-dev-drive.ps1 +++ b/.github/scripts/setup-dev-drive.ps1 @@ -1,19 +1,14 @@ -# Configure a Dev Drive for Windows CI jobs. +# Configure a fast drive for Windows CI jobs. # -# Try to create a Dev Drive VHD explicitly so Windows temp-heavy paths can use a -# trusted ReFS Dev Drive. Fall back to the runner-provided D: drive, then C:, if -# the runner image does not allow that provisioning path. +# GitHub-hosted Windows runners do not always expose a secondary D: volume. When +# they do not, try to create a Dev Drive VHD and fall back to C: if the runner +# image does not allow that provisioning path. -function Select-FallbackDrive { +function Use-FallbackDrive { param([string]$Reason) - if (Test-Path "D:\") { - Write-Warning "$Reason Falling back to existing drive at D:" - return "D:" - } else { - Write-Warning "$Reason Falling back to C:" - return "C:" - } + Write-Warning "$Reason Falling back to C:" + return "C:" } function Invoke-BestEffort { @@ -26,40 +21,44 @@ function Invoke-BestEffort { } } -try { - $VhdPath = Join-Path $env:RUNNER_TEMP "codex-dev-drive.vhdx" - $SizeBytes = 64GB - - if (Test-Path $VhdPath) { - Remove-Item -Path $VhdPath -Force - } - - New-VHD -Path $VhdPath -SizeBytes $SizeBytes -Dynamic -ErrorAction Stop | Out-Null - $Mounted = Mount-VHD -Path $VhdPath -Passthru -ErrorAction Stop - $Disk = $Mounted | Get-Disk -ErrorAction Stop - $Disk | Initialize-Disk -PartitionStyle GPT -ErrorAction Stop - $Partition = $Disk | New-Partition -AssignDriveLetter -UseMaximumSize -ErrorAction Stop - $Volume = $Partition | Format-Volume -FileSystem ReFS -NewFileSystemLabel "CodexDevDrive" -DevDrive -Confirm:$false -Force -ErrorAction Stop - - $Drive = "$($Volume.DriveLetter):" - - Invoke-BestEffort { fsutil devdrv trust $Drive } "Trusting Dev Drive $Drive" - Invoke-BestEffort { fsutil devdrv enable /disallowAv } "Disabling AV filter attachment for Dev Drives" +if (Test-Path "D:\") { + Write-Output "Using existing drive at D:" + $Drive = "D:" +} else { try { - Dismount-VHD -Path $VhdPath - Mount-VHD -Path $VhdPath | Out-Null - } catch { - Write-Warning "Remounting Dev Drive $Drive failed: $($_.Exception.Message)" - if (-not (Test-Path "$Drive\")) { - throw - } - } - Invoke-BestEffort { fsutil devdrv query $Drive } "Querying Dev Drive $Drive" + $VhdPath = Join-Path $env:RUNNER_TEMP "codex-dev-drive.vhdx" + $SizeBytes = 64GB - Write-Output "Using Dev Drive at $Drive" -} catch { - $Drive = Select-FallbackDrive "Failed to create Dev Drive: $($_.Exception.Message)" - Invoke-BestEffort { fsutil devdrv query $Drive } "Querying fallback drive $Drive" + if (Test-Path $VhdPath) { + Remove-Item -Path $VhdPath -Force + } + + New-VHD -Path $VhdPath -SizeBytes $SizeBytes -Dynamic -ErrorAction Stop | Out-Null + $Mounted = Mount-VHD -Path $VhdPath -Passthru -ErrorAction Stop + $Disk = $Mounted | Get-Disk -ErrorAction Stop + $Disk | Initialize-Disk -PartitionStyle GPT -ErrorAction Stop + $Partition = $Disk | New-Partition -AssignDriveLetter -UseMaximumSize -ErrorAction Stop + $Volume = $Partition | Format-Volume -FileSystem ReFS -NewFileSystemLabel "CodexDevDrive" -DevDrive -Confirm:$false -Force -ErrorAction Stop + + $Drive = "$($Volume.DriveLetter):" + + Invoke-BestEffort { fsutil devdrv trust $Drive } "Trusting Dev Drive $Drive" + Invoke-BestEffort { fsutil devdrv enable /disallowAv } "Disabling AV filter attachment for Dev Drives" + try { + Dismount-VHD -Path $VhdPath + Mount-VHD -Path $VhdPath | Out-Null + } catch { + Write-Warning "Remounting Dev Drive $Drive failed: $($_.Exception.Message)" + if (-not (Test-Path "$Drive\")) { + throw + } + } + Invoke-BestEffort { fsutil devdrv query $Drive } "Querying Dev Drive $Drive" + + Write-Output "Using Dev Drive at $Drive" + } catch { + $Drive = Use-FallbackDrive "Failed to create Dev Drive: $($_.Exception.Message)" + } } $Tmp = "$Drive\codex-tmp"