Add Linux and macOS PowerShell host support#1
Add Linux and macOS PowerShell host support#1nongman25 wants to merge 1 commit intolemos999:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Codex subagent orchestrator to run on Linux/macOS by removing Windows-only PowerShell assumptions and documenting pwsh usage, while aiming to preserve existing Windows behavior.
Changes:
- Detect and use an available/current PowerShell host (instead of hard-coding
powershell.exe) when launching hooks and queue/team processes. - Fix non-Windows session log path handling by avoiding backslash-based path literals.
- Expand documentation to cover
pwshon Linux/macOS and/subfallback guidance.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/codex-subagent-orchestrator/scripts/start-codex-subagent-team.ps1 | Adds PowerShell host resolution and uses it for hook execution; fixes session log root path joining. |
| skills/codex-subagent-orchestrator/scripts/start-codex-subagent-queue.ps1 | Adds PowerShell host resolution and uses it when launching the team launcher from the queue runner. |
| skills/codex-subagent-orchestrator/references/sub-command-protocol.md | Documents /sub behavior when no PowerShell host exists on Linux/macOS. |
| skills/codex-subagent-orchestrator/references/spec-format.md | Clarifies that hooks run under the current/available PowerShell host (pwsh vs Windows PowerShell). |
| skills/codex-subagent-orchestrator/SKILL.md | Adds Linux/macOS pwsh launcher guidance and fallback note. |
| README.md | Updates requirements and adds Linux pwsh invocation examples and /sub fallback guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| if (-not [string]::IsNullOrWhiteSpace($currentProcessPath)) { | ||
| return [string]$currentProcessPath |
There was a problem hiding this comment.
Resolve-PowerShellHost returns the current process executable path unconditionally when it can read it. If this script is run under a non-CLI host process (e.g., powershell_ise.exe or another host executable), Start-Process will later invoke that host with CLI-only flags like -EncodedCommand/-NoProfile, which can fail. Consider only accepting the current process path when the process name/path indicates pwsh/powershell, otherwise fall back to $PSHOME\pwsh(.exe)/powershell.exe or the candidate resolution list.
| return [string]$currentProcessPath | |
| $exeName = [System.IO.Path]::GetFileNameWithoutExtension($currentProcessPath) | |
| if ($exeName -and @('pwsh', 'powershell') -contains $exeName.ToLowerInvariant()) { | |
| return [string]$currentProcessPath | |
| } |
| return [string]$currentProcessPath | ||
| } | ||
|
|
||
| $candidates = if ($script:IsWindowsPlatform) { | ||
| @("powershell.exe", "pwsh.exe", "pwsh", "powershell") | ||
| } else { | ||
| @("pwsh", "powershell") |
There was a problem hiding this comment.
Resolve-PowerShellHost returns the current process executable path whenever Get-Process exposes it. If the queue runner is hosted by something other than pwsh/powershell (e.g., a GUI/editor host), the later Start-Process call will try to launch that executable with -File/-NoProfile flags and can fail. Recommend validating the host executable (pwsh/powershell) before returning it, otherwise prefer $PSHOME-based resolution or the existing candidate list.
| return [string]$currentProcessPath | |
| } | |
| $candidates = if ($script:IsWindowsPlatform) { | |
| @("powershell.exe", "pwsh.exe", "pwsh", "powershell") | |
| } else { | |
| @("pwsh", "powershell") | |
| $fileName = [System.IO.Path]::GetFileNameWithoutExtension($currentProcessPath) | |
| if ($fileName -and ($fileName.Equals("pwsh", [System.StringComparison]::OrdinalIgnoreCase) -or $fileName.Equals("powershell", [System.StringComparison]::OrdinalIgnoreCase))) { | |
| return [string]$currentProcessPath | |
| } | |
| } | |
| $candidates = @() | |
| if ($PSHOME -and (Test-Path $PSHOME)) { | |
| if ($script:IsWindowsPlatform) { | |
| $candidates += @( | |
| (Join-Path $PSHOME "pwsh.exe"), | |
| (Join-Path $PSHOME "powershell.exe") | |
| ) | |
| } else { | |
| $candidates += @( | |
| (Join-Path $PSHOME "pwsh"), | |
| (Join-Path $PSHOME "powershell") | |
| ) | |
| } | |
| } | |
| if ($script:IsWindowsPlatform) { | |
| $candidates += @("powershell.exe", "pwsh.exe", "pwsh", "powershell") | |
| } else { | |
| $candidates += @("pwsh", "powershell") |
This PR keeps the Windows/PowerShell-first workflow intact, but removes hard-coded assumptions that blocked Linux/macOS usage.
Changes:
Notes: