Skip to content

TUI autocomplete and session filter mishandle "/" worktree for non-git projects #29537

Closed as not planned

Description

@crimsondhaks

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:

  1. 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.

  2. 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

  1. Run opencode in a directory that has no .git folder (mkdir /tmp/test && cd /tmp/test && opencode)
  2. autocomplete: configure a local "reference" entry in opencode.json — when @-referencing, paths are resolved against "/" instead of the project directory
  3. 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

Activity

  1. github-actions commented on May 27, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If these cover the same underlying problem, it may be worth consolidating.

  2. github-actions commented on Oct 14, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions