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 serve uses / as workspace root when CWD has no git repository #36858
When running opencode serve from a directory that is not a git repository (or the git discovery fails), the server reports the workspace root folder as / (filesystem root) instead of the current working directory. This causes the AI model to see all files from the entire filesystem, not just the intended project.
The root cause is in packages/core/src/project.ts:112. When no git repo is found, the fallback uses path.parse(input).root which for any absolute path like /home/user/project returns just /. The input is already a resolved absolute path and should be used directly.
Plugins
No response
OpenCode version
1.17.20
Steps to reproduce
mkdir /tmp/test-project && cd /tmp/test-project
opencode serve (note: directory has no git repo)
Observe that the workspace root is / instead of /tmp/test-project
Activity
github-actions commentedon Jul 14, 2026
This issue might be a duplicate of an existing issue. Please check:
/on Linux) instead of the actual CWD when git discovery fails. That report is foropencode webon Windows, but the underlying bug inproject.tsappears to be the same.Detached start pins service HOME to the workspace: daemon cwd reset t…