Skip to content

OpenCode overwrites data in a different directory without any notification #32803

Closed as not planned

Description

@neirokoder

Description

I work in a single repository but with multiple branches simultaneously. The branches are checked out into different directories (pkb, pkb_develop, pkb_gateway, pkb_checker, etc.).
When opening the pkb_develop directory, OpenCode opened the pkb directory and started making changes there, without any notifications, warnings, or informational windows, and with no way to know that writing was happening to a different directory. I only found out after noticing the data discrepancy.
The same thing happens with the other directories — OpenCode silently redirects everything to the first one.

Plugins

No response

OpenCode version

1.17.7

Steps to reproduce

Steps to Reproduce

  1. Prepare the environment:

    • Clone a single Git repository into several different directories, for example:
      • pkb (main branch)
      • pkb_develop (develop branch)
      • pkb_gateway (gateway branch)
      • pkb_checker (checker branch)
    • In each directory, switch to its respective branch so that the file states differ across directories.
  2. Open and use the pkb directory first:

    • Launch OpenCode and open the pkb directory as the working directory.
    • Make some changes to files there (this establishes it as the initially opened directory).
  3. Close and try to open a different directory:

    • Close the pkb directory (or close OpenCode entirely and relaunch it).
    • Attempt to open any other directory, for example pkb_develop.
  4. Observe which directory is actually opened and where changes land:

    • Check which directory OpenCode actually opens – it will be pkb, not pkb_develop.
    • Without receiving any notification, make file-modifying operations (edit code, create new files, modify existing ones).
  5. Verify where changes were written:

    • After making changes, check which directory actually received those changes.

Actual Result:

  • Once the pkb directory has been opened first, closing it and then trying to open any other directory (e.g. pkb_develop) causes OpenCode to silently open the pkb directory again instead of the selected one.
  • All subsequent file modifications are applied inside pkb, not in the directory the user intended to work in.
  • No notifications, warnings, or indicators appear to inform the user that writing is happening in a different directory. The behavior repeats for all other directories: OpenCode always silently redirects to pkb.

Expected Result:

  • OpenCode should open the directory explicitly selected by the user, regardless of previous sessions.
  • File changes should be written to the currently opened and actively worked‑in directory.
  • Any fallback or redirect to a different directory must be clearly communicated to the user, with a warning and the option to abort.

Screenshot and/or share link

No response

Operating System

Windows 10

Terminal

No response

Activity

  1. github-actions commented on Jun 18, 2026

    @github-actions
    Contributor

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

    These issues all describe the same underlying problem: OpenCode identifies projects by Git remote URL rather than local directory path, causing multiple clones of the same repo to share a project identity and redirect to the first-opened directory.

  2. github-actions commented on Aug 18, 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.

  3. Hona commented on Sep 2, 2026

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions