Context
Three PowerShell hygiene issues surfaced by Liszt (PowerShell) during the 2026-05-28 fan-out, all in or adjacent to the production launcher and worktree manager:
-
git -C in production launcher — scripts/Invoke-PolyphonySdlc.ps1:833 is the last surviving git -C in production code. On Windows, git -C with paths containing spaces produces unreliable results and can silently misdetect the platform (falling back to 'ado' without warning, or embedding a multi-line error string into $remoteUrl). Fix: Push-Location/Pop-Location wrapper.
-
$Comment injection surface — scripts/Invoke-PolyphonySdlc.ps1:357,424-456 embeds $Comment verbatim into a PowerShell here-string that is passed to pwsh -Command. If $Comment contains newlines or backticks (reachable via conductor workflow inputs to the reset path), the child window opens with a syntax error and the exit sidecar records "exit_code": null with no diagnostic. Fix: sanitize $Comment at parameter-bind time (reject or strip [\r\n + backtick]).
-
Missing retry-with-backoff in worktree teardown — .conductor/registry/scripts/worktree-manager.ps1:254-272 deletes git worktrees without the retry-with-backoff pattern that was backported to src/Polyphony/Journal/Reset/Deleters/GitWorktreeDeleter.cs:37-64. Worktree deletion on Windows is prone to transient file-lock failures; without retry, the script fails hard. Fix: backport the C# retry pattern to the PS script.
Parent epic: #522 (Squad short-term wins, 2026-05-28 fan-out)
Acceptance criteria
Owner
- Primary: Liszt (PowerShell — production launcher + worktree-manager)
- Secondary: Reich (worktree teardown retry — owns git/worktree seam)
Estimated effort
4–6 hours
File anchors
scripts/Invoke-PolyphonySdlc.ps1 (lines 833, 357, 424-456)
.conductor/registry/scripts/worktree-manager.ps1 (lines 254-272)
src/Polyphony/Journal/Reset/Deleters/GitWorktreeDeleter.cs (lines 37-64 — retry source of truth)
In-situ clause
Apply DU patterns and hygiene fixes opportunistically where natural in your scope. Don't make these the primary focus.
Context
Three PowerShell hygiene issues surfaced by Liszt (PowerShell) during the 2026-05-28 fan-out, all in or adjacent to the production launcher and worktree manager:
git -Cin production launcher —scripts/Invoke-PolyphonySdlc.ps1:833is the last survivinggit -Cin production code. On Windows,git -Cwith paths containing spaces produces unreliable results and can silently misdetect the platform (falling back to'ado'without warning, or embedding a multi-line error string into$remoteUrl). Fix:Push-Location/Pop-Locationwrapper.$Commentinjection surface —scripts/Invoke-PolyphonySdlc.ps1:357,424-456embeds$Commentverbatim into a PowerShell here-string that is passed topwsh -Command. If$Commentcontains newlines or backticks (reachable via conductor workflow inputs to the reset path), the child window opens with a syntax error and the exit sidecar records"exit_code": nullwith no diagnostic. Fix: sanitize$Commentat parameter-bind time (reject or strip[\r\n+ backtick]).Missing retry-with-backoff in worktree teardown —
.conductor/registry/scripts/worktree-manager.ps1:254-272deletes git worktrees without the retry-with-backoff pattern that was backported tosrc/Polyphony/Journal/Reset/Deleters/GitWorktreeDeleter.cs:37-64. Worktree deletion on Windows is prone to transient file-lock failures; without retry, the script fails hard. Fix: backport the C# retry pattern to the PS script.Parent epic: #522 (Squad short-term wins, 2026-05-28 fan-out)
Acceptance criteria
scripts/Invoke-PolyphonySdlc.ps1:833:git -C $mainWorktree remote get-url originreplaced withPush-Location $mainWorktree; try { git remote get-url origin } finally { Pop-Location }patternscripts/Invoke-PolyphonySdlc.ps1:357,424-456:$Commentvalidated/sanitized against newlines and backtick injection before heredoc embedding.conductor/registry/scripts/worktree-manager.ps1:254-272: retry-with-backoff loop backported fromGitWorktreeDeleter.cs:37-64for worktree deletionOwner
Estimated effort
4–6 hours
File anchors
scripts/Invoke-PolyphonySdlc.ps1(lines 833, 357, 424-456).conductor/registry/scripts/worktree-manager.ps1(lines 254-272)src/Polyphony/Journal/Reset/Deleters/GitWorktreeDeleter.cs(lines 37-64 — retry source of truth)In-situ clause
Apply DU patterns and hygiene fixes opportunistically where natural in your scope. Don't make these the primary focus.