-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[regression] opencode 1.2.21 freezes on session start if the current working directory is a symlink #16522
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Description
- Having a project at
dir/proj, wherediris a symlink, leads to opencode v1.2.21 freezing when starting a new session. - Starting the session with the real path as working directory works fine.
- This used to work until v1.2.21, probably a regression at fix(windows): git path resolution for modified files across Git Bash, MSYS2, and Cygwin #16422
The following code fixed it for me:
--- a/packages/opencode/src/cli/cmd/tui/thread.ts
+++ b/packages/opencode/src/cli/cmd/tui/thread.ts
@@ -120,11 +120,14 @@ export const TuiThreadCommand = cmd({
return
}
- // Resolve relative paths against PWD to preserve behavior when using --cwd flag
+ // Use PWD as the base for resolving relative --project paths so that
+ // symlink-aware shells see the right directory. For the no-project case,
+ // use the real OS cwd so that Instance.directory always matches the
+ // canonical path that git and other tools report.
const root = Filesystem.resolve(process.env.PWD ?? process.cwd())
const cwd = args.project
? Filesystem.resolve(path.isAbsolute(args.project) ? args.project : path.join(root, args.project))
- : root
+ : Filesystem.resolve(process.cwd())
const file = await target()
try {
process.chdir(cwd)Plugins
No response
OpenCode version
1.2.21
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Linux, Ubuntu 24.04
Terminal
Ghostty
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)