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
Desktop GUI reopens an existing session with the wrong workspace path after selecting a different project directory #29714
Unexpected project path used by the session: D:\Code\xingsen\mes\merge-dev\operate-backend
CLI version on PATH: 1.14.41 via npm, likely unrelated to the Desktop GUI issue
Description
When I open the OpenCode Desktop GUI and select the project directory:
E:\Code\xingsen\mes\mes_general_dev\operate-backend
the GUI does not start or attach to a session using that workspace. Instead, it keeps jumping back to an existing session whose server-side workspace is:
D:\Code\xingsen\mes\merge-dev\operate-backend
Inside the agent session, the injected working directory and all default tool operations still point to the D: project path, even though I selected the E: project path in the GUI.
Both directories exist on disk, which makes this dangerous because file reads and edits silently happen in the wrong repository instead of failing.
Steps to Reproduce
Start OpenCode Desktop GUI on Windows.
Select/open this project directory:
E:\Code\xingsen\mes\mes_general_dev\operate-backend
Start or continue a chat/session.
Ask the agent to inspect the current working directory or read project files.
Observe that the session is still bound to:
D:\Code\xingsen\mes\merge-dev\operate-backend
Close/open a new GUI session and select the E: path again.
The GUI still returns to or reuses the wrong D: workspace session.
Expected Behavior
When the user selects a project directory in the Desktop GUI, the session should be created or attached with that exact workspace root:
E:\Code\xingsen\mes\mes_general_dev\operate-backend
The server-side working directory, workspace root, and tool execution context should all match the selected GUI path.
Actual Behavior
The GUI appears to reuse or reconnect to an existing server-side session whose workspace root is different:
D:\Code\xingsen\mes\merge-dev\operate-backend
As a result, the agent reads and modifies files in the wrong repository.
Impact
This can cause accidental edits in the wrong project when two similar repositories exist locally. Since both paths are valid, the problem is not obvious until the user notices path mismatches in tool output.
Additional Notes
This looks like the Desktop GUI or backend server may be reusing a stale session/project mapping instead of honoring the newly selected workspace path.
It would be helpful if OpenCode Desktop displayed and validated the effective server-side workspace root for the active session, and either refused to attach to a mismatched workspace or prompted the user before reconnecting to an existing session.
### Plugins
_No response_
### OpenCode version
_No response_
### Steps to reproduce
_No response_
### Screenshot and/or share link
_No response_
### Operating System
_No response_
### Terminal
_No response_
This issue might be a duplicate of existing issues. Please check:
POST /session ignores directory query parameter for session record #23607: POST /session ignores directory query parameter — the server may be ignoring the directory param on session creation and defaulting to process.cwd(), which could explain why the GUI keeps attaching to the wrong workspace session.
This is a missing "check" in the "open project" methods on checking if an existing project is what is being opened. The missing condition is if the filePath is NOT the same, then it is NOT the same project even if it is technically "the same repo."
Activity
github-actions commentedon May 28, 2026
This issue might be a duplicate of existing issues. Please check:
process.cwd(), which could explain why the GUI keeps attaching to the wrong workspace session.If your issue is specifically about the
directoryquery param being ignored when creating sessions, #23607 may be the same root cause.belisoful commentedon Jul 2, 2026
Confirmed! Still an issue in Version 1.17.13.
This is a missing "check" in the "open project" methods on checking if an existing project is what is being opened. The missing condition is if the filePath is NOT the same, then it is NOT the same project even if it is technically "the same repo."
This is a serious non-starter for OpenCode, btw.
github-actions commentedon Sep 1, 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.
Hona commentedon Sep 2, 2026
Fixed for opencode2 launch via #46713
You can try the desktop beta here: https://github.com/anomalyco/opencode-beta