-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Bug: non-interactive-env hook hardcodes shellType='unix', breaks on Windows PowerShell #3000
Copy link
Copy link
Open
Description
Description
The createNonInteractiveEnvHook in src/hooks/non-interactive-env/index.ts hardcodes shellType as "unix":
const shellType = "unix";
const envPrefix = buildEnvPrefix(NON_INTERACTIVE_ENV, shellType);This causes buildEnvPrefix() to generate export VAR=value; syntax on Windows, even though the Bash tool uses PowerShell (pwsh). PowerShell doesn't recognize export, resulting in:
export: The term 'export' is not recognized as a name of a cmdlet...
Impact
This causes sub-agent infinite loops on Windows. The agent sees the error, retries the git command, but the same export prefix is prepended again, creating a retry loop that never terminates.
Root Cause
buildEnvPrefix()already supports PowerShell syntax (line ~5109 in dist/index.js), generating='value';format- But the caller at line ~24048 never uses it because
shellTypeis hardcoded
Suggested Fix
// Before (broken on Windows)
const shellType = "unix";
// After (works cross-platform)
const shellType = process.platform === "win32" ? "powershell" : "unix";Environment
- oh-my-opencode: 3.1.8
- OS: Windows 11
- Shell: pwsh (PowerShell)
- OpenCode Bash tool:
OS: win32, Shell: pwsh
Workaround
Manually patch dist/index.js line ~24048 with the fix above.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels