Description
For non-git projects, the project worktree is intentionally set to "/"
(see packages/opencode/src/project/project.ts where worktree gets that
sentinel value when there's no VCS).
Two TUI sites don't account for this:
-
packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
line 337: worktree: sync.path.worktree || sync.path.directory || process.cwd()
"/" is truthy so it's used directly, instead of falling back to the
project directory.
-
packages/opencode/src/cli/cmd/tui/context/sync.tsx
line 119: the guard !project.data.instance.path.worktree || ...
doesn't catch "/", so the session list filter computes
path.relative("/", "/tmp/foo") = "tmp/foo" and sends that as a
path scope to the server instead of falling through to scope: "project".
Same root cause as PR #29180 (fix(tui): handle non-git project paths
when opening editor), which fixed three other call sites but missed
these two.
Plugins
No response
OpenCode version
1.15.11
Steps to reproduce
- Run opencode in a directory that has no .git folder (mkdir /tmp/test && cd /tmp/test && opencode)
- autocomplete: configure a local "reference" entry in opencode.json — when @-referencing, paths are resolved against "/" instead of the project directory
- session filter: opencode session list query includes a path scope derived from "/" rather than the expected "project" scope
Screenshot and/or share link
No response
Operating System
macOS
Terminal
iTerm2
Description
For non-git projects, the project worktree is intentionally set to "/"
(see packages/opencode/src/project/project.ts where worktree gets that
sentinel value when there's no VCS).
Two TUI sites don't account for this:
packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
line 337:
worktree: sync.path.worktree || sync.path.directory || process.cwd()"/" is truthy so it's used directly, instead of falling back to the
project directory.
packages/opencode/src/cli/cmd/tui/context/sync.tsx
line 119: the guard
!project.data.instance.path.worktree || ...doesn't catch "/", so the session list filter computes
path.relative("/", "/tmp/foo") = "tmp/foo"and sends that as apath scope to the server instead of falling through to scope: "project".
Same root cause as PR #29180 (fix(tui): handle non-git project paths
when opening editor), which fixed three other call sites but missed
these two.
Plugins
No response
OpenCode version
1.15.11
Steps to reproduce
Screenshot and/or share link
No response
Operating System
macOS
Terminal
iTerm2