Skip to content

bug: external directory access prompt when agent runs cd ./dir && cd ../dir2 #18930

Description

@Skyppex

Description

on occasion, the model will write a bash command which cds into a directory, then runs a command, then cds into a different directory, then runs another command. and sometimes the second one includes the cd ../<other-dir> notation to take you up one level. opencode seems to understand this as accessing an external directory.

i expect this to be safe as it is actually contained under the current working directory. (hard-level difficulty i'm guessing)

Plugins

no plugins

OpenCode version

1.2.13

Steps to reproduce

  1. create two directories: dir1 and dir2
  2. ask the model to run the ls command in both directories like this: cd dir1 && ls && cd ../dir2.
  3. observe the external directory access prompt

Screenshot and/or share link

https://opncd.ai/share/X2xPGJ3Z
Image

Operating System

Windows 11 in WSL2 with Linux (Ubuntu 24.04)

Terminal

WezTerm

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 24, 2026
  2. github-actions commented on Mar 24, 2026

    @github-actions
    Contributor

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

  3. Skyppex commented on Mar 24, 2026

    @Skyppex
    Author

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

    That bot is pretty good, i was looking around to see if there was an existing issue on this too 🙌
    It is a duplicate. i'll close this.

  4. allanlaal commented on Oct 8, 2026

    @allanlaal

    issue still present in 1.18.35

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions