You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode attach without --dir uses server cwd instead of client cwd #14460
When I run opencode attach <url> without --dir, attach starts in the server process directory (where opencode serve was started), not in the directory where I ran attach.
It seems the attach request is missing the client directory context when --dir is omitted, so the server falls back to its own working-directory default.
This sounds like it's working as it's should. If you're attaching, why would you expect opencode to start in a different directory than where it was started as a server?
This sounds like it's working as it's should. If you're attaching, why would you expect opencode to start in a different directory than where it was started as a server?
Fair, I think this is actually a regression from #8969 though?
#6715 specifically made attach pass the client's process.cwd() as the default directory. After #8969 refactored the --dir handling, the no---dir path started returning undefined, which means no directory header gets sent and the server just falls back to its own cwd.
For context, I run opencode serve as a long-lived system service and connect to it from different project directories. In that setup the server's startup directory isn't really useful as a default, the directory I'm running attach from is what I'd expect it to use. And --dir is already there for when you want to override that.
Activity
github-actions commentedon Feb 20, 2026
This issue might be a duplicate of or closely related to existing issues. Please check:
opencode attach#4966: Same root cause —opencode attachuses server's cwd instead of the client's cwd (closed, but the underlying issue may persist)attach: @ file mentions use client-local path instead of remote directory (related path resolution issue with attach)rmk40 commentedon Feb 20, 2026
This sounds like it's working as it's should. If you're attaching, why would you expect opencode to start in a different directory than where it was started as a server?
rexdotsh commentedon Feb 20, 2026
Fair, I think this is actually a regression from #8969 though?
#6715 specifically made attach pass the client's
process.cwd()as the default directory. After #8969 refactored the--dirhandling, the no---dirpath started returningundefined, which means no directory header gets sent and the server just falls back to its own cwd.For context, I run
opencode serveas a long-lived system service and connect to it from different project directories. In that setup the server's startup directory isn't really useful as a default, the directory I'm runningattachfrom is what I'd expect it to use. And--diris already there for when you want to override that.github-actions commentedon Apr 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
feat(opencode-attach): inject --dir $PWD so attached session uses ter…