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 web does not inherit terminal's current working directory #35326
When starting opencode web from a terminal, the working directory should default to the terminal's current working directory (where the command was invoked). However, it currently defaults to the system root / instead.
Plugins
No response
OpenCode version
1.17.13
Steps to reproduce
cd /Users/zhentao/Desktop/AI/Opencode
Run opencode web
The app's working directory is / instead of the project directory
Expected behavior: opencode web should inherit $PWD from the shell session where it was launched.
I chat with deepseek v4 flash, and it finds that Root Cause:
The web and serve commands set instance: false in effectCmd, which skips all directory resolution logic that the tui and run commands use.
The TUI command explicitly calls process.chdir() using process.env.PWD (the shell's original CWD), but web/serve do not.
When the web frontend makes API requests without a directory param or x-opencode-directory header, the server falls back to process.cwd(), which is / if the process was started from a GUI or service manager.
Submitted PR #35976 with the fix (rebase of the previously auto-closed #31473, with the conflict in core/project.ts resolved against the current git.repo.discover API). Awaiting review from a maintainer.
Activity
github-actions commentedon Jul 4, 2026
This issue might be a duplicate of an existing issue. Please check:
opencode webresolves working directory to system/drive root instead of the CWD where the command was invoked (previously reported on Windows, this report is on macOS)Zhentao-He commentedon Jul 5, 2026
I chat with deepseek v4 flash, and it finds that
Root Cause:
webandservecommands setinstance: falseineffectCmd, which skips all directory resolution logic that thetuiandruncommands use.process.chdir()usingprocess.env.PWD(the shell's original CWD), butweb/servedo not.directoryparam orx-opencode-directoryheader, the server falls back toprocess.cwd(), which is/if the process was started from a GUI or service manager.ninetyfive666 commentedon Jul 6, 2026
Same for me on Fedora KDE 44 with opencode installed via curl.
airvzxf commentedon Jul 8, 2026
Submitted PR #35976 with the fix (rebase of the previously auto-closed #31473, with the conflict in core/project.ts resolved against the current git.repo.discover API). Awaiting review from a maintainer.
github-actions commentedon Sep 7, 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.