Skip to content

TUI referencing local directory when using attach --dir to connect to a remote server. #5380

Closed as not planned

Description

@jeremytondo

Description

I'm testing out a setup where I have the opencode server running on my remote workstation while attaching to it running the TUI on my local Mac laptop (this is an incredible feature btw).

When running opencode attach <url> --dir ~/path/to/project/ it attempts to use a directory on the local machine instead of the remote machine. I'm not sure if this is the intended behavior or not, but I was assuming the server would be the source of truth and look for directories there.

OpenCode version

1.0.146 (both client and server)

Steps to reproduce

  1. Start the server on a remote machine opencode serve --hostname 0.0.0.0
  2. On the local machine attach using the --dir flag opencode attach <url> --dir ~/path/to/project/

Current behavior
Tries to connect to a directory on the local machine.

Expected behavior
TUI opens using the project located at the --dir path on the remote server.

Screenshot and/or share link

No response

Operating System

Remote Host: Arch Linux, Local: MacOS 26.1

Terminal

Ghostty

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 11, 2025
  2. github-actions commented on Dec 11, 2025

    @github-actions
    Contributor

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

    Both issues describe problems with path resolution when using remote servers with attach, where paths are resolved on the client instead of the server. Feel free to ignore if this addresses a specific case not covered by those issues.

  3. jeremytondo commented on Dec 11, 2025

    @jeremytondo
    Author

    The related issues identified by the bot are likely related, but neither deals with using the attach --dir flag, so it may be worthwhile to keep this open? That is, if this is truly not the expected behavior.

  4. self-assigned this
    on Dec 11, 2025
  5. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 11, 2025
  6. terwey commented on Dec 15, 2025

    @terwey

    I have noticed the same behavior. You can reference files in the remote server but it then throws errors as it prefixes it with the local dir.

    Also the attach needs serious work because the slightest error on the server and it just perma-hangs on a blank screen with zero indication to the user what it got stuck on.

  7. added a commit that references this issue on Dec 30, 2025
    b4c560b
  8. cgarrot commented on Jan 10, 2026

    @cgarrot

    I'm experiencing this issue and wanted to provide some context about when this happens:

    General Use Case: Remote Server + Local Client
    When OpenCode server runs on a remote machine (VPS, remote workstation, container) and you attach from a local machine:

    Current behavior:

    # On local machine
    opencode attach http://remote-server:4096 --dir /path/to/project
    # Bug: The --dir path is interpreted as LOCAL machine path
    # Server receives: /local/user/path/to/project (doesn't exist on remote)
    # Result: Wrong directory, or connection fails

    Expected behavior:

    # On local machine
    opencode attach http://remote-server:4096 --dir /path/to/project
    # Should work as: Send directory path to server
    # Server receives: /remote/server/path/to/project (exists on remote)
    # Server does: chdir /remote/server/path/to/project
    # Result: Opens in correct remote directory

    Why this matters:

    1. Multi-project development: Developers work on multiple projects on a remote machine
    2. Fixed server directory: Server starts in a default directory (e.g., /home/user or /workspace)
    3. Remote-first setup: The server is the source of truth, not the local machine

    Common scenarios affected:

    • SSH tunnels to remote OpenCode servers
    • Containerized OpenCode instances
    • Development on remote workstations
  9. github-actions commented on Mar 25, 2026

    @github-actions
    Contributor

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

  10. removed
    bugSomething isn't working
    on May 3, 2026
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