Skip to content

Bug: non-interactive-env hook hardcodes shellType='unix', breaks on Windows PowerShell #3000

@edision

Description

@edision

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 shellType is 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions