[Bug]: Shell command failure on win32 platform due to Unix-style export causing excessive retries #7055

Closed
opened 2026-02-16 18:06:02 -05:00 by yindo · 3 comments
Owner

Originally created by @lvmax1998 on GitHub (Jan 21, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

The automated agent environment consistently prepends a Unix-style environment variable export string (export CI=true ...;) to all bash tool commands. On Windows systems, export is not a recognized command.

Critically, when this failure occurs, the agent logic appears to repeatedly retry the command multiple times in a tight loop. This results in a cascade of "not recognized" errors and prevents the task from failing gracefully or proceeding.

Plugins

oh-my-opencode

OpenCode version

1.1.25

Steps to reproduce

  1. Type anything that triggers a bash command execution (e.g., git status)
  2. Observe the command being prefixed with export ...;
  3. The command fails immediately because export is not a valid Windows command.
  4. The system automatically retries the same malformed command multiple times (observed 4+ consecutive attempts in one session), cluttering the logs and stalling execution.

Screenshot and/or share link

Image

Operating System

Windows11

Terminal

Windows Terminal

Originally created by @lvmax1998 on GitHub (Jan 21, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description The automated agent environment consistently prepends a Unix-style environment variable export string (export CI=true ...;) to all bash tool commands. On Windows systems, export is not a recognized command. Critically, when this failure occurs, the agent logic appears to repeatedly retry the command multiple times in a tight loop. This results in a cascade of "not recognized" errors and prevents the task from failing gracefully or proceeding. ### Plugins oh-my-opencode ### OpenCode version 1.1.25 ### Steps to reproduce 1. Type anything that triggers a bash command execution (e.g., git status) 2. Observe the command being prefixed with export ...; 3. The command fails immediately because export is not a valid Windows command. 4. The system automatically retries the same malformed command multiple times (observed 4+ consecutive attempts in one session), cluttering the logs and stalling execution. ### Screenshot and/or share link <img width="2514" height="874" alt="Image" src="https://github.com/user-attachments/assets/c13eab5f-d48b-4670-9374-34834a42efbe" /> ### Operating System Windows11 ### Terminal Windows Terminal
yindo added the windowsbug labels 2026-02-16 18:06:02 -05:00
yindo closed this issue 2026-02-16 18:06:02 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6488: Bash Fork Issues - Investigation Included (documents shell spawning issues including Windows-specific problems and suggests retry logic for transient errors)
  • #8160: fix(sdk): spawn fails on Windows - ENOENT for opencode command (addresses Windows shell spawn issues with shell: process.platform === 'win32' configuration)
  • #8668: [FEATURE]: Option to hide environment variable prefix in bash command display (related to the environment variable export prefix being displayed)

The root cause appears to be related to how bash commands are executed on Windows. The excessive retries you're experiencing might be tied to the transient spawn failures mentioned in #6488, or the shell configuration issue in #8160.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 21, 2026): This issue might be a duplicate of existing issues. Please check: - #6488: Bash Fork Issues - Investigation Included (documents shell spawning issues including Windows-specific problems and suggests retry logic for transient errors) - #8160: fix(sdk): spawn fails on Windows - ENOENT for opencode command (addresses Windows shell spawn issues with `shell: process.platform === 'win32'` configuration) - #8668: [FEATURE]: Option to hide environment variable prefix in bash command display (related to the environment variable export prefix being displayed) The root cause appears to be related to how bash commands are executed on Windows. The excessive retries you're experiencing might be tied to the transient spawn failures mentioned in #6488, or the shell configuration issue in #8160. Feel free to ignore if none of these address your specific case.
Author
Owner

@lvmax1998 commented on GitHub (Jan 21, 2026):

The same error occurred in version v1.1.29.

Image
@lvmax1998 commented on GitHub (Jan 21, 2026): The same error occurred in version v1.1.29. <img width="2514" height="859" alt="Image" src="https://github.com/user-attachments/assets/d47ce30a-be7c-494d-835c-fe481f0ed1e3" />
Author
Owner

@pschiel commented on GitHub (Jan 21, 2026):

This is no opencode issue. There is nothing in opencode that would produce these bash exports.

Your plugin does that.

@pschiel commented on GitHub (Jan 21, 2026): This is no opencode issue. There is nothing in opencode that would produce these bash exports. Your plugin does that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7055