Uh oh!
There was an error while loading. Please reload this page.
fix(installer): pin background jobs to a local cwd — no UNC noise on roaming-profile machines - #437
Conversation
…roaming-profile machines (#409) PowerShell background jobs spawn their runspace in $HOME; on managed machines with roaming profiles that is a UNC share, and every cmd.exe a job starts there prints 'CMD.EXE was started with the above path as the current directory. UNC paths are not supported.' plus a RemoteException error record — 2-6 alarming red blocks on an otherwise healthy install. All five Start-Job sites (wsl --update, wsl --set-default-version, wsl --list, NCT install, NCT verify) now pass a shared -InitializationScript that pins the job to $env:SystemRoot (always local; no-op off-Windows). An AST-based Pester gate fails any future Start-Job that forgets it. Closes#409 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
LukasWodka
commented
Jul 27, 2026
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6132abf. Configure here.
shujaatTracebloc
left a comment
There was a problem hiding this comment.
Reviewed the code, not just the CI state.
Completeness: exactly 5 Start-Job sites in install-k8s.ps1, all 5 now pass -InitializationScript $JobInit. No other job primitive (Start-ThreadJob/-AsJob/Invoke-Command) exists, so nothing was missed — and the AST-gate test makes that guarantee permanent.
Correctness:-InitializationScript runs in the job runspace before the main block, so Set-Location $env:SystemRoot moves cwd off the UNC share before any cmd /c inherits it. SystemRoot is always local on Windows; the guard makes it a no-op off-Windows. $script:JobInit is correctly script-scoped so the unqualified $JobInit inside the functions resolves.
No output pollution (the real risk): Set-Location without -PassThru emits nothing, so the parsed sites stay clean — $distroRaw (wsl --list) receives only $raw, and the update path keys off job State, not output. The behavioral test's Receive-Job … | Should -Be "ran" proves the init block contributes no output.
Manifest regenerated; drift check green. All CI green (Pester on windows + ubuntu); Bugbot clean on 6132abf.
LGTM 🚀
Summary
Fixes the red
RemoteException/CMD.EXE ... UNC paths are not supportedblocks that appear 2–6 times per install on machines whose home directory is a UNC share (roaming profiles — the hospital/enterprise norm). Root cause: PowerShell background jobs start their runspace in$HOME, so everycmd /cinside a job inherits a UNC cwd. Observed live on a customer install (2026-07-27).Change
$script:JobInitscriptblock —if ($env:SystemRoot) { Set-Location $env:SystemRoot }— passed as-InitializationScriptat all fiveStart-Jobsites (wsl --update,wsl --set-default-version 2,wsl --list, NVIDIA toolkit install + verify).Start-Jobin the script carries-InitializationScript(so new jobs can't regress), plus a behavioral test that the init block moves the job cwd and is a no-op whenSystemRootis unset (Linux CI).manifest.sha256regenerated.Type
Bug fix
Test plan
scripts/gen-manifest.shrun;--checkclean.wsl --update/toolkit steps no longer emit CMD.EXE UNC warnings (jobs run fromC:\Windows).🤖 Generated with Claude Code
Note
Low Risk
Installer-only UX fix for job initialization; no auth, cluster, or credential logic changes.
Overview
Fixes misleading red RemoteException noise during Windows installs when the user profile home is a UNC path (common with roaming profiles). PowerShell
Start-Jobrunspaces inherit that cwd, so nestedcmd /ccalls emit CMD’s “UNC paths are not supported” message even when WSL steps succeed.Introduces
$script:JobInit(Set-Location $env:SystemRootwhen set) and passes it as-InitializationScripton all fiveStart-Jobsites (WSL update/default version, WSL list, NVIDIA toolkit install/verify).Pester adds an AST gate so every
Start-Jobininstall-k8s.ps1must include-InitializationScript, plus a behavioral test for the init block.manifest.sha256is updated for the installer script.Reviewed by Cursor Bugbot for commit 6132abf. Bugbot is set up for automated code reviews on this repo. Configure here.