Skip to content

Run Windows agent framework jobs in WSL - #76536

Merged
pelikhan merged 9 commits into
mainfrom
copilot/windows-grower-run-wsl-commands
Nov 10, 2026
Merged

pelikhan merged 9 commits into
mainfrom
copilot/windows-grower-run-wsl-commands

Conversation

Copilot AI commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • WSL execution: Route built-in framework Bash steps through Ubuntu WSL, with a fail-fast availability check. Native Windows Actions remain on the host.
  • Runtime and paths: Bootstrap Ubuntu, Linux tooling, Docker, and the Linux Node version selected by actions/setup-node. Map workspace, runner temp/tool-cache, GitHub command files, and derived Windows paths into WSL; map /tmp/gh-aw to runner temp for artifact sharing.
  • Scope: Apply the adapter only to built-in framework jobs; leave unrelated Windows jobs and non-Windows rendering unchanged.

Generated POSIX commands are staged in runner temp and invoked through WSL, for example:

$env:WSLENV = $wslEnv
& wsl.exe --distribution Ubuntu --user root --exec bash --noprofile --norc -e -o pipefail $wslScriptPath

Comment thread pkg/workflow/windows_runner.go Outdated
"$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') }",
Copilot AI changed the title [WIP] Introduce WSL-backed execution for Windows agent commands Run Windows agent framework jobs in WSL Nov 10, 2026
Copilot AI requested a review from pelikhan November 10, 2026 15:44
@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 15:48
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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'
Comment thread pkg/workflow/windows_runner.go Outdated
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'
Comment thread pkg/workflow/windows_runner.go Outdated
"$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)
Comment thread pkg/workflow/windows_runner.go Outdated
"$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`,
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…r-run-wsl-commands

# Conflicts:
#	.github/workflows/windows.lock.yml

Co-authored-by: pelikhan <[email protected]>

Copilot AI commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Resolved and pushed in a149da8 by merging main and regenerating the conflicted Windows workflow lock file. All 365 workflows compiled; Windows/WSL and impacted tests passed. The final gate reported existing Go lint findings; CodeQL timed out.

Comment thread pkg/workflow/windows_runner.go Outdated
"$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') }",
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI and others added 2 commits November 10, 2026 18:14
…r-run-wsl-commands

# Conflicts:
#	.github/workflows/windows.lock.yml

Co-authored-by: pelikhan <[email protected]>

Copilot AI commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Merged current main and regenerated the conflicted Windows workflow lock file in 6b27114.

@pelikhan
pelikhan merged commit ef36c0c into main Nov 10, 2026
47 checks passed
@pelikhan
pelikhan deleted the copilot/windows-grower-run-wsl-commands branch November 10, 2026 19:09
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[windows-grower] Run Windows agentic framework commands inside WSL

4 participants