Skip to content

Add Linux and macOS PowerShell host support#1

Open
nongman25 wants to merge 1 commit intolemos999:mainfrom
nongman25:feat/linux-pwsh-subagent-support
Open

Add Linux and macOS PowerShell host support#1
nongman25 wants to merge 1 commit intolemos999:mainfrom
nongman25:feat/linux-pwsh-subagent-support

Conversation

@nongman25
Copy link
Copy Markdown

This PR keeps the Windows/PowerShell-first workflow intact, but removes hard-coded assumptions that blocked Linux/macOS usage.

Changes:

  • detect the current PowerShell host instead of requiring powershell.exe
  • fix session path handling for non-Windows environments
  • document pwsh usage on Linux/macOS
  • document /sub fallback to direct codex exec for bounded one-off work

Notes:

  • Verified on Ubuntu with pwsh installed
  • Intended to preserve Windows behavior, not replace it
  • Windows-native verification would still be helpful from maintainers

Copilot AI review requested due to automatic review settings March 9, 2026 07:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 pwsh on Linux/macOS and /sub fallback 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
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
return [string]$currentProcessPath
$exeName = [System.IO.Path]::GetFileNameWithoutExtension($currentProcessPath)
if ($exeName -and @('pwsh', 'powershell') -contains $exeName.ToLowerInvariant()) {
return [string]$currentProcessPath
}

Copilot uses AI. Check for mistakes.
Comment on lines +183 to +189
return [string]$currentProcessPath
}

$candidates = if ($script:IsWindowsPlatform) {
@("powershell.exe", "pwsh.exe", "pwsh", "powershell")
} else {
@("pwsh", "powershell")
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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")

Copilot uses AI. Check for mistakes.
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.

2 participants