Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

fix(windows): retain diagnostics in bracketed installation paths (#8165)

Mike Bradley9f5b705f04fc
diff --git a/ods/installers/windows/lib/compose-diagnostics.ps1 b/ods/installers/windows/lib/compose-diagnostics.ps1
index 003831f36..f0ea079af 100644
--- a/ods/installers/windows/lib/compose-diagnostics.ps1
+++ b/ods/installers/windows/lib/compose-diagnostics.ps1
@@ -10,7 +10,7 @@
function Get-ODSComposeEnvFileArgs {
param([string]$InstallDir)
$envPath = Join-Path $InstallDir ".env"
- if (Test-Path $envPath) {
+ if (Test-Path -LiteralPath $envPath) {
return @("--env-file", ".env")
}
return @()
@@ -75,8 +75,8 @@ function Initialize-ODSComposeDockerClientConfig {
)
$dockerConfigDir = Join-Path (Join-Path $InstallDir "data") "docker-client-public"
- if (-not (Test-Path $dockerConfigDir)) {
- New-Item -ItemType Directory -Path $dockerConfigDir -Force | Out-Null
+ if (-not (Test-Path -LiteralPath $dockerConfigDir)) {
+ [System.IO.Directory]::CreateDirectory($dockerConfigDir) | Out-Null
}
$dockerConfig = [ordered]@{ auths = [ordered]@{} }
@@ -122,7 +122,7 @@ function Invoke-ODSDockerCompose {
$userDockerConfigDir = Get-ODSUserDockerConfigDir `
-DockerConfigOverride $previousDockerConfig
- Push-Location $InstallDir
+ Push-Location -LiteralPath $InstallDir
try {
$dockerConfigDir = Initialize-ODSComposeDockerClientConfig `
-InstallDir $InstallDir -UserDockerConfigDir $userDockerConfigDir
@@ -158,10 +158,10 @@ function Get-ODSComposeEnvValue {
)
$envPath = Join-Path $InstallDir ".env"
- if (-not (Test-Path $envPath)) { return $Default }
+ if (-not (Test-Path -LiteralPath $envPath)) { return $Default }
try {
- $line = Get-Content $envPath -ErrorAction Stop |
+ $line = Get-Content -LiteralPath $envPath -ErrorAction Stop |
Where-Object { $_ -match "^$([regex]::Escape($Name))=" } |
Select-Object -First 1
if (-not $line) { return $Default }
@@ -178,14 +178,14 @@ function Get-ODSComposeEnvValue {
function Get-ODSComposeFailedImages {
param([string]$ComposeLogPath)
- if ([string]::IsNullOrWhiteSpace($ComposeLogPath) -or -not (Test-Path $ComposeLogPath)) {
+ if ([string]::IsNullOrWhiteSpace($ComposeLogPath) -or -not (Test-Path -LiteralPath $ComposeLogPath)) {
return @()
}
$pattern = '([a-z0-9._-]+([.:][0-9]+)?/)?[a-z0-9._/-]+:[A-Za-z0-9._-]+'
$imageMatches = @()
try {
- $imageMatches = Select-String -Path $ComposeLogPath -Pattern $pattern -AllMatches -ErrorAction Stop |
+ $imageMatches = Select-String -LiteralPath $ComposeLogPath -Pattern $pattern -AllMatches -ErrorAction Stop |
ForEach-Object { $_.Matches.Value } |
Where-Object {
$_ -match 'ghcr\.io|docker\.io|quay\.io|nvidia|llama|ods|open-webui|qdrant|speaches|comfy|litellm|perplexica'
@@ -204,11 +204,11 @@ function Get-ODSComposeSensitiveEnvValues {
param([string]$InstallDir)
$envPath = Join-Path $InstallDir ".env"
- if (-not (Test-Path $envPath)) { return @() }
+ if (-not (Test-Path -LiteralPath $envPath)) { return @() }
$values = @()
try {
- foreach ($line in (Get-Content $envPath -ErrorAction Stop)) {
+ foreach ($line in (Get-Content -LiteralPath $envPath -ErrorAction Stop)) {
if ($line -notmatch '^([A-Za-z_][A-Za-z0-9_]*)=(.*)$') { continue }
$key = $Matches[1]
$value = $Matches[2].Trim().Trim('"').Trim("'")
@@ -275,14 +275,14 @@ function Add-ODSComposePortReport {
}
if ($connections -and $connections.Count -gt 0) {
- "- ${Label}:${Port} occupied" | Add-Content -Path $ReportPath -Encoding UTF8
+ "- ${Label}:${Port} occupied" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
foreach ($conn in $connections) {
$pidText = if ($conn.OwningProcess) { " pid=$($conn.OwningProcess)" } else { "" }
- " $($conn.LocalAddress):$($conn.LocalPort)$pidText" | Add-Content -Path $ReportPath -Encoding UTF8
+ " $($conn.LocalAddress):$($conn.LocalPort)$pidText" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
else {
- "- ${Label}:${Port} free" | Add-Content -Path $ReportPath -Encoding UTF8
+ "- ${Label}:${Port} free" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
@@ -300,8 +300,8 @@ function Add-ODSComposeCommandSection {
[string[]]$SensitiveValues = @()
)
- "" | Add-Content -Path $ReportPath -Encoding UTF8
- $Title | Add-Content -Path $ReportPath -Encoding UTF8
+ "" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
+ $Title | Add-Content -LiteralPath $ReportPath -Encoding UTF8
try {
$output = & $Command 2>&1 | ForEach-Object { $_.ToString() }
if ($output) {
@@ -312,25 +312,25 @@ function Add-ODSComposeCommandSection {
}
}
if ($First -gt 0) {
- $lines | Select-Object -First $First | Add-Content -Path $ReportPath -Encoding UTF8
+ $lines | Select-Object -First $First | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
elseif ($Last -gt 0) {
$take = [Math]::Min($Last, $lines.Count)
$start = [Math]::Max(0, $lines.Count - $take)
for ($i = $start; $i -lt $lines.Count; $i++) {
- $lines[$i] | Add-Content -Path $ReportPath -Encoding UTF8
+ $lines[$i] | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
else {
- $lines | Add-Content -Path $ReportPath -Encoding UTF8
+ $lines | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
else {
- "(no output)" | Add-Content -Path $ReportPath -Encoding UTF8
+ "(no output)" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
catch {
- "command failed: $_" | Add-Content -Path $ReportPath -Encoding UTF8
+ "command failed: $_" | Add-Content -LiteralPath $ReportPath -Encoding UTF8
}
}
@@ -352,7 +352,7 @@ function Write-ODSComposeFailureReport {
)
$logsDir = Join-Path $InstallDir "logs"
- if (-not (Test-Path $logsDir)) { New-Item -ItemType Directory -Path $logsDir -Force | Out-Null }
+ if (-not (Test-Path -LiteralPath $logsDir)) { [System.IO.Directory]::CreateDirectory($logsDir) | Out-Null }
$stamp = Get-Date -Format "yyyy-MM-dd-HHmmss"
$reportPath = Join-Path $InstallDir "install-report-$stamp.txt"
@@ -375,7 +375,7 @@ function Write-ODSComposeFailureReport {
"- GPU backend: $gpuBackend",
"- Compose command: $composeCommand",
"- Installer log: $(if ($ComposeLogPath) { $ComposeLogPath } else { "unavailable" })",
- "- Cached compose flags: $(if (Test-Path $flagsFile) { Get-Content $flagsFile -Raw } else { "unavailable" })",
+ "- Cached compose flags: $(if (Test-Path -LiteralPath $flagsFile) { Get-Content -LiteralPath $flagsFile -Raw } else { "unavailable" })",
"- Next step: $NextStep",
"",
"Configured model/runtime",
@@ -386,18 +386,18 @@ function Write-ODSComposeFailureReport {
"- CTX_SIZE=$(Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "CTX_SIZE" -Default "unknown")",
"",
"Likely failed image(s)"
- ) | Set-Content -Path $reportPath -Encoding UTF8
+ ) | Set-Content -LiteralPath $reportPath -Encoding UTF8
$failedImages = @(Get-ODSComposeFailedImages -ComposeLogPath $ComposeLogPath)
if ($failedImages.Count -gt 0) {
- $failedImages | ForEach-Object { "- $_" } | Add-Content -Path $reportPath -Encoding UTF8
+ $failedImages | ForEach-Object { "- $_" } | Add-Content -LiteralPath $reportPath -Encoding UTF8
}
else {
- "- none detected from installer log" | Add-Content -Path $reportPath -Encoding UTF8
+ "- none detected from installer log" | Add-Content -LiteralPath $reportPath -Encoding UTF8
}
- "" | Add-Content -Path $reportPath -Encoding UTF8
- "Port checks" | Add-Content -Path $reportPath -Encoding UTF8
+ "" | Add-Content -LiteralPath $reportPath -Encoding UTF8
+ "Port checks" | Add-Content -LiteralPath $reportPath -Encoding UTF8
Add-ODSComposePortReport -ReportPath $reportPath -Label "llama-server" -Port (Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "OLLAMA_PORT" -Default "11434")
Add-ODSComposePortReport -ReportPath $reportPath -Label "open-webui" -Port (Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "WEBUI_PORT" -Default "3000")
Add-ODSComposePortReport -ReportPath $reportPath -Label "dashboard" -Port (Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "DASHBOARD_PORT" -Default "3001")
@@ -405,7 +405,7 @@ function Write-ODSComposeFailureReport {
Add-ODSComposePortReport -ReportPath $reportPath -Label "litellm" -Port (Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "LITELLM_PORT" -Default "4000")
Add-ODSComposePortReport -ReportPath $reportPath -Label "searxng" -Port (Get-ODSComposeEnvValue -InstallDir $InstallDir -Name "SEARXNG_PORT" -Default "8888")
- Push-Location $InstallDir
+ Push-Location -LiteralPath $InstallDir
try {
$envArgs = Get-ODSComposeEnvFileArgs -InstallDir $InstallDir
$sensitiveValues = @(Get-ODSComposeSensitiveEnvValues -InstallDir $InstallDir)
@@ -418,13 +418,13 @@ function Write-ODSComposeFailureReport {
Pop-Location
}
- "" | Add-Content -Path $reportPath -Encoding UTF8
- "Installer log tail" | Add-Content -Path $reportPath -Encoding UTF8
- if ($ComposeLogPath -and (Test-Path $ComposeLogPath)) {
- Get-Content $ComposeLogPath -Tail 160 | Add-Content -Path $reportPath -Encoding UTF8
+ "" | Add-Content -LiteralPath $reportPath -Encoding UTF8
+ "Installer log tail" | Add-Content -LiteralPath $reportPath -Encoding UTF8
+ if ($ComposeLogPath -and (Test-Path -LiteralPath $ComposeLogPath)) {
+ Get-Content -LiteralPath $ComposeLogPath -Tail 160 | Add-Content -LiteralPath $reportPath -Encoding UTF8
}
else {
- "installer log unavailable" | Add-Content -Path $reportPath -Encoding UTF8
+ "installer log unavailable" | Add-Content -LiteralPath $reportPath -Encoding UTF8
}
return $reportPath
@@ -453,7 +453,7 @@ function Write-ODSComposeDiagnostics {
Write-AI "Docs: ods/docs/WINDOWS-TROUBLESHOOTING-GUIDE.md (section: Docker Compose failed)"
Write-Host ""
- Push-Location $InstallDir
+ Push-Location -LiteralPath $InstallDir
try {
$prevEAP = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
diff --git a/ods/installers/windows/lib/install-report.ps1 b/ods/installers/windows/lib/install-report.ps1
index 00c89c0c3..c8e132bb4 100644
--- a/ods/installers/windows/lib/install-report.ps1
+++ b/ods/installers/windows/lib/install-report.ps1
@@ -150,13 +150,13 @@ function Write-ODSInstallReport {
)
$artifactsDir = Join-Path (Join-Path $InstallDir "artifacts") "windows-report"
- New-Item -ItemType Directory -Path $artifactsDir -Force | Out-Null
+ [System.IO.Directory]::CreateDirectory($artifactsDir) | Out-Null
$jsonPath = Join-Path $artifactsDir "report.json"
$txtPath = Join-Path $artifactsDir "report.txt"
$report = New-ODSInstallReport -InstallDir $InstallDir -ComposeFlags $ComposeFlags
- ($report | ConvertTo-Json -Depth 8) | Set-Content -Path $jsonPath -Encoding UTF8
+ ($report | ConvertTo-Json -Depth 8) | Set-Content -LiteralPath $jsonPath -Encoding UTF8
$lines = @()
$lines += "ODS Windows Report"
@@ -200,7 +200,7 @@ function Write-ODSInstallReport {
$lines += ""
$lines += "Raw command snippets are available in report.json."
- $lines | Set-Content -Path $txtPath -Encoding UTF8
+ $lines | Set-Content -LiteralPath $txtPath -Encoding UTF8
Write-Host ""
Write-Chapter "INSTALL REPORT"
diff --git a/ods/installers/windows/ods.ps1 b/ods/installers/windows/ods.ps1
index a0711ba03..445d73037 100644
--- a/ods/installers/windows/ods.ps1
+++ b/ods/installers/windows/ods.ps1
@@ -98,13 +98,13 @@ function Test-DockerRunning {
function Test-Install {
param([switch]$SkipDockerCheck)
- if (-not (Test-Path $InstallDir)) {
+ if (-not (Test-Path -LiteralPath $InstallDir)) {
Write-AIError "ODS not found at $InstallDir. Set ODS_HOME or run installer first."
exit 1
}
$baseCompose = Join-Path $InstallDir "docker-compose.base.yml"
$monoCompose = Join-Path $InstallDir "docker-compose.yml"
- if (-not (Test-Path $baseCompose) -and -not (Test-Path $monoCompose)) {
+ if (-not (Test-Path -LiteralPath $baseCompose) -and -not (Test-Path -LiteralPath $monoCompose)) {
Write-AIError "docker-compose.base.yml not found in $InstallDir"
exit 1
}
@@ -156,8 +156,8 @@ function Get-ComposeFlags {
Ensure-HermesDashboardSessionToken
$flagsFile = Join-Path $InstallDir ".compose-flags"
- if (Test-Path $flagsFile) {
- $raw = (Get-Content $flagsFile -Raw).Trim()
+ if (Test-Path -LiteralPath $flagsFile) {
+ $raw = (Get-Content -LiteralPath $flagsFile -Raw).Trim()
if (($raw -match 'user-extensions') -or (Test-Path -LiteralPath (Join-Path $InstallDir 'data/user-extensions')) -or (Test-Path -LiteralPath (Join-Path $InstallDir '.model-stores.compose.json')) -or
(Test-Path -LiteralPath (Join-Path $InstallDir 'data/model-stores.json'))) {
return (Resolve-ODSModelStoreComposeFlags -Flags ($raw -split "\s+"))
@@ -166,8 +166,8 @@ function Get-ComposeFlags {
}
$launchRecord = Join-Path (Join-Path $InstallDir "logs") "compose-launch.txt"
- if (Test-Path $launchRecord) {
- $composeFlagsLine = Get-Content $launchRecord -ErrorAction SilentlyContinue |
+ if (Test-Path -LiteralPath $launchRecord) {
+ $composeFlagsLine = Get-Content -LiteralPath $launchRecord -ErrorAction SilentlyContinue |
Where-Object { $_ -match "^compose_flags=" } |
Select-Object -First 1
if ($composeFlagsLine) {
@@ -191,21 +191,21 @@ function Get-ComposeFlags {
$nvidia = Join-Path $InstallDir "docker-compose.nvidia.yml"
$mono = Join-Path $InstallDir "docker-compose.yml"
- if (Test-Path $base) {
+ if (Test-Path -LiteralPath $base) {
$flags += @("-f", "docker-compose.base.yml")
- if (Test-Path $nvidia) {
+ if (Test-Path -LiteralPath $nvidia) {
$flags += @("-f", "docker-compose.nvidia.yml")
}
- } elseif (Test-Path $mono) {
+ } elseif (Test-Path -LiteralPath $mono) {
$flags += @("-f", "docker-compose.yml")
}
# Add enabled extension compose files
$extDir = Join-Path (Join-Path $InstallDir "extensions") "services"
- if (Test-Path $extDir) {
- Get-ChildItem -Path $extDir -Directory | ForEach-Object {
+ if (Test-Path -LiteralPath $extDir) {
+ Get-ChildItem -LiteralPath $extDir -Directory | ForEach-Object {
$composePath = Join-Path $_.FullName "compose.yaml"
- if (Test-Path $composePath) {
+ if (Test-Path -LiteralPath $composePath) {
$relPath = $composePath.Substring($InstallDir.Length + 1) -replace "\\", "/"
$flags += @("-f", $relPath)
}
@@ -2610,7 +2610,7 @@ function Invoke-Report {
# Support diagnostics include failed Docker probes; an unavailable daemon
# must not prevent collecting the bundle needed to diagnose it.
Test-Install -SkipDockerCheck
- Push-Location $InstallDir
+ Push-Location -LiteralPath $InstallDir
try {
$flags = Get-ComposeFlags
Write-ODSInstallReport -InstallDir $InstallDir -ComposeFlags $flags | Out-Null
diff --git a/ods/tests/contracts/test-windows-report-outage.ps1 b/ods/tests/contracts/test-windows-report-outage.ps1
index 22b360563..7eb3c184a 100644
--- a/ods/tests/contracts/test-windows-report-outage.ps1
+++ b/ods/tests/contracts/test-windows-report-outage.ps1
@@ -63,8 +63,8 @@ try {
$location = (Get-Location).Path
Invoke-Report
if ((Get-Location).Path -cne $location) { throw 'Report changed caller location' }
- $json = Get-Content (Join-Path $InstallDir 'artifacts/windows-report/report.json') -Raw | ConvertFrom-Json
- $text = Get-Content (Join-Path $InstallDir 'artifacts/windows-report/report.txt') -Raw
+ $json = Get-Content -LiteralPath (Join-Path $InstallDir 'artifacts/windows-report/report.json') -Raw | ConvertFrom-Json
+ $text = Get-Content -LiteralPath (Join-Path $InstallDir 'artifacts/windows-report/report.txt') -Raw
foreach ($name in @('docker_version', 'docker_info', 'compose_config', 'compose_ps')) {
$receipt = $json.compose.$name
if ($receipt.ok -or $receipt.exit_code -ne 1 -or ($receipt.lines -join '') -notmatch 'fixture Docker Desktop unavailable') { throw "Missing failed Docker receipt: $name" }
@@ -80,6 +80,45 @@ try {
if ([IO.File]::ReadAllText($sentinel) -cne 'retain') { throw 'Report changed foreign state' }
Write-Host 'PASS report writes configured diagnostics and failed Docker receipts during outage'
+ # Write-ODSInstallReport must succeed when the installation path contains
+ # square brackets (wildcard characters in PowerShell).
+ $bracketInstallDir = Join-Path $fixture 'install-[bracket-test]'
+ [void][IO.Directory]::CreateDirectory($bracketInstallDir)
+ [IO.File]::WriteAllText((Join-Path $bracketInstallDir 'docker-compose.base.yml'), 'services: {}')
+ [IO.File]::WriteAllText((Join-Path $bracketInstallDir '.env'), "WEBUI_PORT=13000`nDASHBOARD_PORT=13001`n")
+ $bracketReport = Write-ODSInstallReport -InstallDir $bracketInstallDir -ComposeFlags @()
+ if (-not (Test-Path -LiteralPath $bracketReport.JsonPath -PathType Leaf) -or -not (Test-Path -LiteralPath $bracketReport.TextPath -PathType Leaf)) {
+ throw "Install report files were not written to bracketed path: $($bracketReport.JsonPath)"
+ }
+ $bracketJson = Get-Content -LiteralPath $bracketReport.JsonPath -Raw | ConvertFrom-Json
+ if (-not $bracketJson.generated_at -or $bracketJson.platform.computer_name -ne $env:COMPUTERNAME) {
+ throw "Install report json in bracketed path is missing required properties"
+ }
+ # Exercise the actual CLI path, including installation validation and saved flags.
+ [IO.File]::WriteAllText((Join-Path $bracketInstallDir '.compose-flags'), '-f docker-compose.base.yml -f compose.bracket.yaml')
+ $plainInstallDir = $InstallDir
+ $InstallDir = $bracketInstallDir
+ try {
+ Invoke-Report
+ $cliJson = Get-Content -LiteralPath $bracketReport.JsonPath -Raw | ConvertFrom-Json
+ if (($cliJson.compose.flags -join '|') -cne '-f|docker-compose.base.yml|-f|compose.bracket.yaml') { throw 'Bracketed report lost saved flags' }
+ if ((Get-Location).Path -cne $location) { throw 'Bracketed report changed caller location' }
+ Remove-Item -LiteralPath (Join-Path $bracketInstallDir '.compose-flags')
+ $logs = Join-Path $bracketInstallDir 'logs'
+ [void][IO.Directory]::CreateDirectory($logs)
+ $launch = Join-Path $logs 'compose-launch.txt'
+ [IO.File]::WriteAllText($launch, 'compose_flags=-f docker-compose.base.yml -f compose.recovered.yaml')
+ if (((Get-ComposeFlags) -join '|') -cne '-f|docker-compose.base.yml|-f|compose.recovered.yaml') { throw 'Bracketed report lost launch-record flags' }
+ Remove-Item -LiteralPath $launch
+ $extension = Join-Path $bracketInstallDir 'extensions/services/fixture'
+ [void][IO.Directory]::CreateDirectory($extension)
+ [IO.File]::WriteAllText((Join-Path $extension 'compose.yaml'), 'services: {}')
+ [IO.File]::WriteAllText((Join-Path $bracketInstallDir 'docker-compose.nvidia.yml'), 'services: {}')
+ $fallback = (Get-ComposeFlags) -join '|'
+ if ($fallback -cne '--env-file|.env|-f|docker-compose.base.yml|-f|docker-compose.nvidia.yml|-f|extensions/services/fixture/compose.yaml') { throw 'Bracketed report lost detected Compose files' }
+ } finally { $InstallDir = $plainInstallDir }
+ Write-Host 'PASS install report generates successfully in bracketed directories'
+
# Preserve lifecycle refusal: the opt-out belongs only to report generation.
$child = [Diagnostics.ProcessStartInfo]::new()
$child.FileName = (Get-Process -Id $PID).Path
diff --git a/ods/tests/contracts/test-windows-runtime-recovery.ps1 b/ods/tests/contracts/test-windows-runtime-recovery.ps1
index f37789a25..ae0f28c43 100644
--- a/ods/tests/contracts/test-windows-runtime-recovery.ps1
+++ b/ods/tests/contracts/test-windows-runtime-recovery.ps1
@@ -385,7 +385,49 @@ try {
throw "Matching loading process was not preserved"
}
+ # Compose failure diagnostic report must succeed even when the installation
+ # directory contains square brackets (wildcard characters in PowerShell).
+ $bracketInstallDir = Join-Path $testRoot "install-[bracket-test]"
+ [System.IO.Directory]::CreateDirectory($bracketInstallDir) | Out-Null
+ Set-Content -LiteralPath (Join-Path $bracketInstallDir ".env") -Value "GPU_BACKEND=cpu`nODS_MODE=local"
+ # Exercise a fresh install; the earlier fixture deliberately precreates this directory.
+ $freshConfig = Initialize-ODSComposeDockerClientConfig -InstallDir $bracketInstallDir -UserDockerConfigDir $userDockerConfig
+ if (-not (Test-Path -LiteralPath (Join-Path $freshConfig 'config.json') -PathType Leaf)) { throw 'Fresh Docker config missing' }
+ $neighborDir = Join-Path $testRoot 'install-b'
+ [void][IO.Directory]::CreateDirectory($neighborDir)
+ $neighbor = Join-Path $neighborDir 'sentinel'
+ [IO.File]::WriteAllText($neighbor, 'retain')
+ $failureLog = Join-Path $bracketInstallDir 'compose-[failure].log'
+ [IO.File]::WriteAllText($failureLog, 'failed to pull ghcr.io/ods/llama-server:fixture')
+ $images = @(Get-ODSComposeFailedImages -ComposeLogPath $failureLog)
+ if ($images -notcontains 'ghcr.io/ods/llama-server:fixture') { throw 'Bracketed log lost failed image' }
+ function Write-Chapter { param([string]$Message) }
+ function docker {
+ $script:DiagnosticLocations += (Get-Location).Path
+ $global:LASTEXITCODE = 1
+ 'fixture Docker unavailable'
+ }
+ $script:DiagnosticLocations = @()
+ $beforeLocation = (Get-Location).Path
+ $beforeDockerConfig = $env:DOCKER_CONFIG
+ $composeExit = Invoke-ODSDockerCompose -InstallDir $bracketInstallDir -ComposeFlags @() -ComposeArgs @('config')
+ if ($composeExit -ne 1) { throw 'Compose wrapper lost failure status' }
+ Write-ODSComposeDiagnostics -InstallDir $bracketInstallDir -ComposeFlags @() -ComposeLogPath $failureLog -SaveReport
+ if ((Get-Location).Path -cne $beforeLocation -or $env:DOCKER_CONFIG -cne $beforeDockerConfig) { throw 'Diagnostics changed caller state' }
+ if ($script:DiagnosticLocations.Count -ne 9 -or @($script:DiagnosticLocations | Where-Object { $_ -cne $bracketInstallDir }).Count) { throw 'Diagnostics ran outside literal install path' }
+ if ([IO.File]::ReadAllText($neighbor) -cne 'retain' -or @(Get-ChildItem -LiteralPath $neighborDir).Count -ne 1) { throw 'Diagnostics changed wildcard neighbor' }
+ $bracketReport = Write-ODSComposeFailureReport -InstallDir $bracketInstallDir -ComposeFlags @() -Phase "test"
+ if (-not (Test-Path -LiteralPath $bracketReport -PathType Leaf)) {
+ throw "Compose diagnostics report was not written to bracketed install directory: $bracketReport"
+ }
+ $reportContent = Get-Content -LiteralPath $bracketReport -Raw
+ if ($reportContent -notmatch "ODS install failure report" -or $reportContent -notmatch "GPU backend: cpu") {
+ throw "Compose diagnostics report content in bracketed path is incomplete"
+ }
+
Write-Host "[PASS] Windows Compose plugin and native llama-server runtime recovery contracts"
} finally {
Remove-Item -LiteralPath $testRoot -Recurse -Force -ErrorAction SilentlyContinue
}
+# An unavailable Docker daemon is expected fixture data, not the CI exit status.
+exit 0