Repository navigation
Run Windows agent framework jobs in WSL - #76536
Conversation
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
| "$pathVariables = @('GITHUB_WORKSPACE', 'RUNNER_TEMP', 'RUNNER_TOOL_CACHE', 'GITHUB_ENV', 'GITHUB_OUTPUT', 'GITHUB_PATH', 'GITHUB_STEP_SUMMARY', 'GITHUB_EVENT_PATH', 'HOME', 'TEMP', 'TMP', 'TMPDIR')", | ||
| "$pathVariableSet = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)", | ||
| "foreach ($name in $pathVariables) { [void]$pathVariableSet.Add($name) }", | ||
| "$environmentNames = [System.Environment]::GetEnvironmentVariables('Process').Keys | Where-Object { $_ -notin @('PATH', 'WSLENV') }", |
Co-authored-by: pelikhan <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Critical Windows runner defects can abort startup, prevent Codex discovery, and expose trusted setup scripts to agent modification before host steps execute them with credentials.
5 open issues
Separate writable runtime artifacts from read-only setup scripts · New Add npm's global bin directory to the WSL PATH · New Emit LF line endings in Windows-generated Linux scripts · New Translate Linux artifact paths for native Windows helpers · New Preserve the step's working directory in the WSL wrapper · New
What changed in this PR
This PR adds a WSL execution adapter to gh-aw’s Windows framework jobs, addressing the Linux runtime requirement in #76464 while retaining native Windows Actions.
Changes:
- Wraps generated POSIX steps in PowerShell launchers that execute through Ubuntu WSL.
- Adds Linux tooling, Docker, Node.js setup, and host/WSL path mapping.
- Updates rendering tests and regenerates the Windows probe workflow.
| File | Description |
|---|---|
pkg/workflow/windows_runner.go |
Implements WSL bootstrap, script wrapping, and path adaptation. |
pkg/workflow/jobs.go |
Passes job identity to scope Windows adaptation. |
pkg/workflow/jobs_test.go |
Tests WSL rendering, runtime setup, and artifact paths. |
pkg/workflow/compiler_safe_outputs_steps.go |
Supplies safe-output job identity during checkout lint preparation. |
pkg/workflow/compiler_lint_test.go |
Updates Windows expectations to WSL execution. |
pkg/workflow/compiler_lint_checkouts_test.go |
Updates checkout rendering calls with job identity. |
pkg/workflow/awf_installer_integration_test.go |
Checks installer commands inside encoded WSL payloads. |
.github/workflows/windows.lock.yml |
Regenerates the probe with WSL execution and mapped artifact paths. |
Review effort: Balanced (auto)
| & $wsl.Source --set-default Ubuntu | ||
| if ($LASTEXITCODE -ne 0) { throw 'WSL could not select the Ubuntu distribution.' } | ||
| $env:WSLENV = 'GITHUB_WORKSPACE/p:RUNNER_TEMP/p:RUNNER_TOOL_CACHE/p' | ||
| & $wsl.Source --distribution Ubuntu --user root --exec bash -lc 'set -euo pipefail; test -d "$GITHUB_WORKSPACE"; test -d "$RUNNER_TEMP"; mkdir -p "$RUNNER_TEMP/gh-aw"; if [ -L /tmp/gh-aw ]; then [ "$(readlink -f /tmp/gh-aw)" = "$(readlink -f "$RUNNER_TEMP/gh-aw")" ]; elif [ -e /tmp/gh-aw ]; then echo "WSL bootstrap cannot map /tmp/gh-aw: the path already exists."; exit 1; else ln -s "$RUNNER_TEMP/gh-aw" /tmp/gh-aw; fi; export DEBIAN_FRONTEND=noninteractive; apt-get update -qq; apt-get install -y --no-install-recommends ca-certificates curl docker.io gh git jq nodejs npm xz-utils; if ! pgrep -x dockerd >/dev/null; then nohup dockerd --host=unix:///var/run/docker.sock >"$RUNNER_TEMP/gh-aw/dockerd.log" 2>&1 </dev/null & fi; for attempt in $(seq 1 60); do docker info >/dev/null 2>&1 && exit 0; sleep 1; done; echo "WSL Docker daemon did not become ready." >&2; tail -n 50 "$RUNNER_TEMP/gh-aw/dockerd.log"; exit 1' |
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $env:WSLENV = 'RUNNER_TEMP/p:GH_AW_WSL_NODE_VERSION' | ||
| & wsl.exe --distribution Ubuntu --user root --exec bash -lc 'set -euo pipefail; version="${GH_AW_WSL_NODE_VERSION#v}"; if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Invalid WSL Node.js version." >&2; exit 1; fi; archive="node-v${version}-linux-x64.tar.xz"; staging="$(mktemp -d)"; trap ''rm -rf "$staging"'' EXIT; curl -fsSL "https://nodejs.org/dist/v${version}/$archive" -o "$staging/$archive"; curl -fsSL "https://nodejs.org/dist/v${version}/SHASUMS256.txt" -o "$staging/SHASUMS256.txt"; cd "$staging"; grep -F " $archive" SHASUMS256.txt | sha256sum -c -; install_dir="/usr/local/lib/nodejs/node-v${version}-linux-x64"; mkdir -p "$install_dir"; tar -xJf "$archive" -C "$install_dir" --strip-components=1; ln -sfn "$install_dir/bin/node" /usr/local/bin/node; ln -sfn "$install_dir/bin/npm" /usr/local/bin/npm; ln -sfn "$install_dir/bin/npx" /usr/local/bin/npx' |
| "$decompressor = [System.IO.Compression.DeflateStream]::new($compressedStream, [System.IO.Compression.CompressionMode]::Decompress)", | ||
| "$reader = [System.IO.StreamReader]::new($decompressor, [System.Text.Encoding]::UTF8)", | ||
| "try { $scriptContent = $reader.ReadToEnd() } finally { $reader.Dispose() }", | ||
| `$scriptContent = 'unset GH_AW_NODE_BIN; cd "$GITHUB_WORKSPACE"' + [System.Environment]::NewLine + $scriptContent`, |
| heredoc = delimiter | ||
| var renderedSteps strings.Builder | ||
| for _, step := range steps { | ||
| step = rewriteWindowsActionTempPath(step) |
| "$decompressor = [System.IO.Compression.DeflateStream]::new($compressedStream, [System.IO.Compression.CompressionMode]::Decompress)", | ||
| "$reader = [System.IO.StreamReader]::new($decompressor, [System.Text.Encoding]::UTF8)", | ||
| "try { $scriptContent = $reader.ReadToEnd() } finally { $reader.Dispose() }", | ||
| `$scriptContent = 'unset GH_AW_NODE_BIN; cd "$GITHUB_WORKSPACE"' + [System.Environment]::NewLine + $scriptContent`, |
|
@copilot resolve the merge conflicts on this branch. |
…r-run-wsl-commands # Conflicts: # .github/workflows/windows.lock.yml Co-authored-by: pelikhan <[email protected]>
| "$pathVariableSet = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)", | ||
| "foreach ($name in $pathVariables) { [void]$pathVariableSet.Add($name) }", | ||
| "$processEnvironment = [System.Environment]::GetEnvironmentVariables('Process')", | ||
| "$environmentNames = $processEnvironment.Keys | Where-Object { $_ -match '^[A-Za-z_][A-Za-z0-9_]*$' -and $_ -notin @('PATH', 'WSLENV') }", |
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <[email protected]>
|
@copilot resolve the merge conflicts on this branch. |
Co-authored-by: pelikhan <[email protected]>
…r-run-wsl-commands # Conflicts: # .github/workflows/windows.lock.yml Co-authored-by: pelikhan <[email protected]>
Merged current |
Co-authored-by: pelikhan <[email protected]>
|
🎉 This pull request is included in a new release. Release: |


Windows agent jobs currently execute generated POSIX framework and runtime commands directly on the Windows host, where Git Bash does not provide the required Linux environment.
actions/setup-node. Map workspace, runner temp/tool-cache, GitHub command files, and derived Windows paths into WSL; map/tmp/gh-awto runner temp for artifact sharing.Generated POSIX commands are staged in runner temp and invoked through WSL, for example: