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
web: starting from a Git repository subdirectory opens sessions at repository root #54647
When using the OpenCode web interface from a subdirectory of a Git repository, new sessions use the repository root as their working directory instead of the directory from which OpenCode was started.
This makes all subsequent conversations operate in the parent repository directory.
Plugins
No response
OpenCode version
v2.0.26
Steps to reproduce
use a Git repository at /path/to/repository.
start a new session from the subdirectory at '/path/to/repository/subdirectory'
Run:
pwd
ls
Expected Behavior
The new session should use the directory from which session was started:
/path/to/repository/subdirectory
Actual Behavior
The session uses the Git repository root instead:
/path/to/repository
For example, when starting a new session from a subdirectory named B inside the repository A, ls shows the contents of A rather than the contents of B.
This behavior does not occur when session is started from a directory that is not inside a Git repository.
Additional Context
The issue is consistently reproducible with the web interface. It appears that OpenCode automatically resolves the working directory to the Git repository root when the launch directory is inside a repository.
Thanks for the report, @ekworp! I think this is a duplicate of #51191, which is still open. It describes the same problem: in the web UI, a new session for a folder inside a Git repository is created at the repository root instead of that folder. It has also been confirmed on v2.0.16.
Possible duplicates and related issues, ordered from most to least likely:
It would help to add a comment on #51191 confirming you still see this on v2.0.26, with the exact command you use to start the web UI (for example opencode web or opencode serve, run from the subdirectory). That way all the details are in one place.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Closing this as a duplicate of #51191. A day has passed with no reply saying how this differs: in both, new web UI sessions for a subdirectory of a Git repository are created at the repository root.
Please follow #51191 for updates. It would help to add a comment there confirming you still see this on v2.0.26, with the command you use to start the web UI. If your problem does turn out to be different, reply here and we can reopen this. Thanks, @ekworp!
Activity
opencode-agent commentedon Oct 11, 2026
Thanks for the report, @ekworp! I think this is a duplicate of #51191, which is still open. It describes the same problem: in the web UI, a new session for a folder inside a Git repository is created at the repository root instead of that folder. It has also been confirmed on v2.0.16.
Possible duplicates and related issues, ordered from most to least likely:
location.directory. That issue also describes a workaround: move the session to the subdirectory withPOST /api/session/{id}/move./initand/reviewuse the Git root instead of the session's directory.It would help to add a comment on #51191 confirming you still see this on v2.0.26, with the exact command you use to start the web UI (for example
opencode weboropencode serve, run from the subdirectory). That way all the details are in one place.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencode-agent commentedon Oct 12, 2026
Closing this as a duplicate of #51191. A day has passed with no reply saying how this differs: in both, new web UI sessions for a subdirectory of a Git repository are created at the repository root.
Please follow #51191 for updates. It would help to add a comment there confirming you still see this on v2.0.26, with the command you use to start the web UI. If your problem does turn out to be different, reply here and we can reopen this. Thanks, @ekworp!