Repository navigation
Description
Summary
build.ps1 currently treats a Windows host as unsupported when the OS environment variable is missing, even though PowerShell/.NET can identify the platform directly.
I hit this on a Windows Insider/preview host (25H2, build 26200.8737) from a PowerShell 7 process where $env:OS was not populated. The script failed at the prerequisite stage with This project requires Windows despite running on Windows.
Reproduction
From a Windows PowerShell 7 session:
$env:OS = $null
.\build.ps1 -CheckOnlyBefore the fix, the OS prerequisite check fails because it only checks:
$env:OS -ne "Windows_NT"Expected behavior
build.ps1 should detect Windows from the host/runtime, not from a mutable optional environment variable.
Proposed fix
Use PowerShell's $IsWindows automatic variable when available, with a Windows PowerShell-compatible fallback through [System.Environment]::OSVersion.Platform.
Local validation
On Windows 25H2 build 26200.8737:
./build.ps1 -CheckOnlywith$env:OS = $nullpassed and reportedWindows detected../build.ps1with$env:OS = $nullpassed.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restorepassed: 2417 passed, 29 skipped.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restorepassed: 1154 passed.openclaw-autoreviewon the one-file diff reported no accepted/actionable findings.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 25, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 25, 2026, 8:41 AM ET / 12:41 UTC.
Summary
Keep this issue open: current
mainand the latest release still use the mutableOS=Windows_NTprerequisite check, and the open same-author PR at #822 is the active candidate fix.Reproducibility: yes. from source inspection rather than live Windows execution: current
build.ps1exits when$env:OSis null before any runtime-based Windows check can pass.Root-cause cluster
Relationship:
canonicalCanonical: #821
Summary: This issue is the canonical tracker for the build-script OS detection bug; the open same-author PR is a candidate fix, while the WSL preflight search hit is adjacent but distinct.
Members:
fixed_by_candidate: Fix Windows build detection without OS env var #822 - The PR uses closing syntax for this issue and changes onlybuild.ps1to replace the mutable environment-variable OS check.adjacent_distinct: preflight-wsl UTF-16 parsing bug still present in v0.6.0 (re: #660 closed prematurely) #661 - GitHub search found this Windows-related setup issue, but its root cause is localized/UTF-16 WSL version parsing rather thanbuild.ps1host OS detection.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
No separate ClawSweeper repair job should be queued because the open same-author PR at #822 already owns the candidate fix.
Review details
Best possible solution:
Merge a narrow
build.ps1host/runtime Windows detection fix, preserving the non-Windows fail-fast behavior and validating it with the repository-required build and test commands.Do we have a high-confidence way to reproduce the issue?
Yes, from source inspection rather than live Windows execution: current
build.ps1exits when$env:OSis null before any runtime-based Windows check can pass.Is this the best way to solve the issue?
Yes, the proposed direction is the narrow maintainable fix: use PowerShell/.NET host detection and keep the existing unsupported-platform failure for non-Windows hosts.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
build.ps1control flow and the reporter provided Windows validation.Codex review notes: model internal, reasoning high; reviewed against 4e7982bafb86.
Label changes
Label changes:
P2: This is a normal-priority build-script bug with a clear source path and limited blast radius to affected Windows development environments.impact:other: The affected surface is local build prerequisite availability, which is maintainer-visible but outside the specific data, auth, message, session, security, and crash-loop labels.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:linked-pr-open: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.Label justifications:
P2: This is a normal-priority build-script bug with a clear source path and limited blast radius to affected Windows development environments.impact:other: The affected surface is local build prerequisite availability, which is maintainer-visible but outside the specific data, auth, message, session, security, and crash-loop labels.Evidence reviewed
What I checked:
build.ps1checks$env:OS -ne "Windows_NT", writesThis project requires Windows, and exits before prerequisite checks continue. (build.ps1:146, 4e7982bafb86)./build.ps1 -CheckOnly, so rejecting a Windows host because an optional environment variable is missing breaks an advertised local build path. (README.md:39, 4e7982bafb86)v0.6.3:build.ps1shows the same$env:OS -ne "Windows_NT"check, so the issue is not already fixed in the latest release. (build.ps1:146, 85445c78066b)git log -Sties the original build-script prerequisite check to the commit that addedbuild.ps1; later build-script hardening did not replace this OS detection. (build.ps1:146, 5f18e7b530a6)Test-WindowsHostand replaces the$env:OScheck inbuild.ps1. (build.ps1:146, 4337fe742586)Likely related people:
build.ps1prerequisite detection and later local build-script hardening were authored by Scott Hanselman, including the$env:OScheck that remains today. (role: introduced behavior and build-script area contributor; confidence: high; commits: 5f18e7b530a6, 782153f0313a; files:build.ps1,README.md)build.ps1commit changed build output capture in the same script, making this a relevant recent ownership signal for review routing. (role: recent build-script contributor; confidence: medium; commits: 0e61fa287afb; files:build.ps1)build.ps1lines to the broad current-main import commit, though the more specific build-script history points to earlier authors. (role: current-main provenance signal; confidence: low; commits: 6623cb8410a4; files:build.ps1)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.