diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx index 2bda73cff76d..911f00aa5e42 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx @@ -334,7 +334,8 @@ export function Autocomplete(props: { Reference.resolveAll({ references: ConfigReference.normalize(sync.data.config.reference ?? {}), directory: sync.path.directory || process.cwd(), - worktree: sync.path.worktree || sync.path.directory || process.cwd(), + worktree: + (sync.path.worktree === "/" ? undefined : sync.path.worktree) || sync.path.directory || process.cwd(), }), ) diff --git a/packages/opencode/src/cli/cmd/tui/context/sync.tsx b/packages/opencode/src/cli/cmd/tui/context/sync.tsx index 9f8a384f777f..95f04358fbef 100644 --- a/packages/opencode/src/cli/cmd/tui/context/sync.tsx +++ b/packages/opencode/src/cli/cmd/tui/context/sync.tsx @@ -116,11 +116,10 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({ function sessionListQuery(): { scope?: "project"; path?: string } { if (!kv.get("session_directory_filter_enabled", true)) return { scope: "project" } - if (!project.data.instance.path.worktree || !project.data.instance.path.directory) return { scope: "project" } + const worktree = project.data.instance.path.worktree + if (!worktree || worktree === "/" || !project.data.instance.path.directory) return { scope: "project" } return { - path: path - .relative(path.resolve(project.data.instance.path.worktree), project.data.instance.path.directory) - .replaceAll("\\", "/"), + path: path.relative(path.resolve(worktree), project.data.instance.path.directory).replaceAll("\\", "/"), } }