agents will create empty folders it didn't mean to when using mkdir -p {src,test,...} #2219

Open
opened 2026-02-16 17:34:43 -05:00 by yindo · 5 comments
Owner

Originally created by @riatzukiza on GitHub (Oct 21, 2025).

Description

When some models want to create many folders all at once they'll use the syntax:

mkdir -p src/{folder1,folder2,folder3}`

and it will literally create a folder src/{folder1,folder2,folder3}

OpenCode version

0.15.11

Steps to reproduce

as an agent (I've been using big pickle and glm-4.6) to scaffold a module that will require it to create many directories, like trying to consolidate or move several modules

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

Alacritty

Originally created by @riatzukiza on GitHub (Oct 21, 2025). ### Description When some models want to create many folders all at once they'll use the syntax: ``` mkdir -p src/{folder1,folder2,folder3}` ``` and it will literally create a folder `src/{folder1,folder2,folder3}` ### OpenCode version 0.15.11 ### Steps to reproduce as an agent (I've been using big pickle and glm-4.6) to scaffold a module that will require it to create many directories, like trying to consolidate or move several modules ### Screenshot and/or share link _No response_ ### Operating System Ubuntu 24.04 ### Terminal Alacritty
yindo added the bug label 2026-02-16 17:34:43 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

Hm never encountered this

@rekram1-node commented on GitHub (Oct 21, 2025): Hm never encountered this
Author
Owner

@veracioux commented on GitHub (Oct 25, 2025):

The a/{x,y,z} syntax is called cartesian product and it's not supported by every shell. Since we use the shell from $SHELL to run the commands, the variable probably points to a lesser-featured shell like dash.

@riatzukiza Can you run echo $SHELL in the terminal where you run opencode, and tell me what it prints?

@veracioux commented on GitHub (Oct 25, 2025): The `a/{x,y,z}` syntax is called cartesian product and it's not supported by every shell. Since we use the shell from `$SHELL` to run the commands, the variable probably points to a lesser-featured shell like `dash`. @riatzukiza Can you run `echo $SHELL` in the terminal where you run opencode, and tell me what it prints?
Author
Owner

@veracioux commented on GitHub (Oct 27, 2025):

Actually, I was wrong here (when writing that comment I was thinking about the ! command invocation). It does in fact use /bin/sh, which almost certainly lacks the cartesian product functionality. This issue suggests an implementation which would actually make opencode behave in the way I described in my previous comment: https://github.com/sst/opencode/issues/3479

@rekram1-node Perhaps we can consider implementing the suggestion from #3479, or at least indicate in the system prompt what shell it's dealing with, so it knows to avoid certain capabilities.

@veracioux commented on GitHub (Oct 27, 2025): Actually, I was wrong here (when writing that comment I was thinking about the `!` command invocation). It does in fact use `/bin/sh`, which almost certainly lacks the cartesian product functionality. This issue suggests an implementation which would actually make opencode behave in the way I described in my previous comment: https://github.com/sst/opencode/issues/3479 @rekram1-node Perhaps we can consider implementing the suggestion from #3479, or at least indicate in the system prompt what shell it's dealing with, so it knows to avoid certain capabilities.
Author
Owner

@rekram1-node commented on GitHub (Oct 27, 2025):

I think implementing suggestion > indicate in system prompt.

We should make it bash if possible but need to handle windows otherwise

Don't like all unix systems support bash basically? i guess it doesnt hurt to add a check

@rekram1-node commented on GitHub (Oct 27, 2025): I think implementing suggestion > indicate in system prompt. We should make it bash if possible but need to handle windows otherwise Don't like all unix systems support bash basically? i guess it doesnt hurt to add a check
Author
Owner

@veracioux commented on GitHub (Oct 27, 2025):

I think they do, but we might also want to support containerized use cases like alpine, so a check is a good idea.

@veracioux commented on GitHub (Oct 27, 2025): I think they do, but we might also want to support containerized use cases like alpine, so a check is a good idea.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2219