Skip to content

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

Closed as not planned

Description

@riatzukiza

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

Activity

  1. rekram1-node commented on Oct 22, 2025

    @rekram1-node
    Collaborator

    Hm never encountered this

  2. veracioux commented on Oct 25, 2025

    @veracioux
    Contributor

    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?

  3. veracioux commented on Oct 27, 2025

    @veracioux
    Contributor

    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: #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.

  4. rekram1-node commented on Oct 27, 2025

    @rekram1-node
    Collaborator

    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

  5. veracioux commented on Oct 27, 2025

    @veracioux
    Contributor

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

  6. Br1an67 commented on Mar 1, 2026

    @Br1an67

    I'd like to work on this. The root cause is that Shell.acceptable() passes through POSIX-only shells (sh/dash) which don't support brace expansion. Added them to the blacklist so the fallback picks bash instead.

    PR: #15610

  7. github-actions commented on May 1, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions