TUI referencing local directory when using attach --dir to connect to a remote server.
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
- Start the server on a remote machine
opencode serve --hostname 0.0.0.0 - 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
This issue might be a duplicate of existing issues. Please check:
- #4686: TUI sends absolute local paths causing ENOENT on server side (Windows client to Linux server path resolution)
- #4967:
opencode attach: File path duplicates client's relative directory, causing ENOENT (similar attach path duplication issue)
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.
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.
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.