Repository navigation
fix(windows): create OpenCode runtime staging directories literally - #8162
vaibhavsrv wants to merge 4 commits into
Conversation
0cd1310 to
6e88e16
Compare
|
Thanks for fixing directory creation in OpenCode's staging path and preserving the existing upgrade safeguards. Advisory status: not ready yet Quickest path to merge:
What I checked:
Thanks again; exercising the real extraction path should make the regression test protect the intended fix. |
In ods/installers/windows/lib/opencode-runtime.ps1, Install-ODSOpenCode manages downloading, verifying, and updating the OpenCode binary on Windows. When Destination contains square brackets (e.g. C:\tools\[ods]\bin\opencode.exe), directory creation and the subsequent archive extraction chain fail on wildcard-sensitive parameter binding. Carry literal-path handling through: 1. opencode-runtime.ps1: Use [System.IO.Directory]::CreateDirectory for destination bin and staging directories. 2. detection.ps1: Use -LiteralPath and FullName in Test-ZipIntegrity to validate archives in bracketed paths. 3. ui.ps1: Use -LiteralPath and [System.IO.Directory]::CreateDirectory in Invoke-ExtractionWithRetry for archive cleanup, directory creation, Expand-Archive, and extraction verification. Extend ods/tests/test-windows-opencode-runtime.ps1 with a real fixture ZIP and production extraction helpers, verifying plain and bracketed destination paths.
6e88e16 to
58c3189
Compare
|
Thanks for the thorough review and guidance @Lightheartdevs. I have carried
All 73 hosted CI checks (including |
|
Thanks for following through on the real ZIP validation and extraction path; the bracketed-path regression now exercises those helpers successfully. Advisory status: not ready yet Quickest path to merge:
What I checked:
The extraction fix is working; completing the download path should close the remaining gap. |
Carry -LiteralPath handling through Show-ProgressDownload, Invoke-DownloadWithRetry, and Invoke-ODSHuggingFaceDownloadFallback to prevent wildcard parameter binding failures when downloading files into bracketed destination directories. Extend ods/tests/test-windows-opencode-runtime.ps1 with unstubbed production download helpers against a local file:// fixture, plain-path regression checks for the GGUF model download caller, and comprehensive bracketed-path coverage.
|
Thanks @Lightheartdevs. Pushed as new commits only (no force-pushes, no history rewrite) to head All 73 hosted CI checks are passing green on GitHub Actions (including Sites updated across the OpenCode install, download, and extraction chain:
|
|
Thanks for carrying literal-path handling through the download step as well as ZIP verification and extraction; this closes the gap from the previous advisory. Advisory status: looks merge-ready What looks good:
What I checked:
Thanks for following through on the complete path. |
Summary
Fixes #8161. Fixes wildcard parameter binding failures across the entire Windows OpenCode installation, download, and archive extraction chain when ODS is installed into directories containing square brackets (e.g.
C:\tools\[ods]\bin\opencode.exeor username paths likeC:\Users\runner[1]\...).Baseline Defect & Reproduction
When
$Destinationcontains square brackets, standard PowerShell path cmdlets treat[and]as wildcard character class specifiers:ods/installers/windows/lib/opencode-runtime.ps1, lines 23 and 25 created destination and staging directories viaNew-Item -ItemType Directory -Path $bin:ods/installers/windows/lib/ui.ps1,Show-ProgressDownloadexecutescurl.exe -o $partFile $Url. While curl writes the.partfile successfully, line 426 evaluatedif ($curlExit -eq 0 -and (Test-Path $partFile))without-LiteralPath, returning$falseand leavingrelease.zip.partun-promoted on disk. Line 427 then invokedMove-Item -Path $partFile, throwing wildcard binding errors on source.ods/installers/windows/lib/ui.ps1,Invoke-DownloadWithRetryevaluated line 480if ((Test-Path $Destination) -and ((Get-Item $Destination).Length -gt 0))without-LiteralPath, returning false-negative$false.ods/installers/windows/lib/detection.ps1,Test-ZipIntegritychecked archive existence usingTest-Path $PathandGet-Item $Path, returningFile not foundfor bracketed archives.ods/installers/windows/lib/ui.ps1,Invoke-ExtractionWithRetryfailed onNew-Item -Path $parentDirandExpand-Archive -Path $ZipPath.Surgical Fix Across Chain
Literal-path semantics are carried through the entire execution path without altering precedence or operational safeguards:
ods/installers/windows/lib/opencode-runtime.ps1: Uses[System.IO.Directory]::CreateDirectoryfor$binand$stage.ods/installers/windows/lib/ui.ps1:Show-ProgressDownload: UsesTest-Path -LiteralPath $partFileandMove-Item -LiteralPath $partFile -Destination $Destination -Force.Invoke-DownloadWithRetry: UsesTest-Path -LiteralPath $DestinationandGet-Item -LiteralPath $Destination.Invoke-ODSHuggingFaceDownloadFallback: UsesTest-Path -LiteralPath $DestinationandGet-Item -LiteralPath $Destination.Get-ODSHuggingFaceDownloadHelper: UsesTest-Path -LiteralPath $candidate.Invoke-ExtractionWithRetry: UsesTest-Path -LiteralPath,Remove-Item -LiteralPath,[System.IO.Directory]::CreateDirectory,Expand-Archive -LiteralPath, andGet-ChildItem -LiteralPath.ods/installers/windows/lib/detection.ps1: InTest-ZipIntegrity, usesTest-Path -LiteralPath $Path,Get-Item -LiteralPath $Path, and opens$fileInfo.FullNamevia[System.IO.Compression.ZipFile]::OpenRead.ods/tests/test-windows-opencode-runtime.ps1: Sourced directly against real production helpers (Show-ProgressDownload,Invoke-DownloadWithRetry,Test-ZipIntegrity,Invoke-ExtractionWithRetry), removing all helper stubs. Exercises real download, verification, extraction, and replacement for plain and bracketed paths (bracket-[test],[a]b,a[,]a).AI Assistance
AI drafted the fix and tests and ran the checks. The human author did not review each line before submission.
Release Lane
release/2.6.xmainStable hotfix reason:
Changed Surface
opencode-runtime.ps1,ui.ps1,detection.ps1).Risk And Validation
git diff --checkods/tests/test-windows-opencode-runtime.ps1covering plain and bracketed destination paths under PowerShell 7 and Windows PowerShell 5.1.windows-latest/ Microsoft Windows Server 2025, build 10.0.26100, imagewindows-2025-vs2026) running the full PowerShell test suite.release/2.6.xCommands/results:
Operational Change Check
If this PR touches installer phases, bootstrap logic, compose stack generation,
service manifests, dashboard API control flows, Hermes, model routing, GPU or
runtime detection, lifecycle commands, host mutation, or network exposure, it
requires release-grade fleet validation before release unless the PR explains a
narrower equivalent.
Notes For Reviewers
ods/installers/windows/lib/opencode-runtime.ps1has 0 open PRs acrossOsmantic/ODS.ods/installers/windows/lib/ui.ps1: Only PR fix(open-webui): bootstrap the admin before LAN exposure instead of first signup #7858 touchesui.ps1(lines 589-593, adding admin credentials toWrite-SuccessCardsummary card); zero overlap with download/extraction helpers.ods/installers/windows/lib/detection.ps1: Only PR fix(models): keep the selected model fully on the GPU #6706 touchesdetection.ps1(lines 158-180 inGet-GpuInfofor NVIDIA memory probe); zero overlap withTest-ZipIntegrity(line 540).windows-latest, imagewindows-2025-vs2026).file://fixtures and a Win32 curl executable shim; live external GitHub network downloads of the OpenCode release payload are not executed in CI.07-devtools.ps1:53,07-devtools.ps1:94-95,ui.ps1:596,opencode-config.ps1:152-176) were preserved untouched to keep PR scope surgical.AI-assisted investigation, implementation and CLI regressions. This strengthens OpenCode runtime staging and download paths, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.
Composed with fix(windows): evaluate model readiness paths literally #8148, fix(windows): accept LLAMA_REASONING in any case so llama-server starts #8151, fix(windows): write compose diagnostic failure reports literally #8155, fix(windows): write install reports to literal paths #8157, and fix(windows): create development footprint backup directories literally #8160 at 2596f8c without conflicts. Production and test diffs passed together; adjacent runtime update checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.