Skip to content

fix(tui): handle non-git project paths in autocomplete and session fi…#29539

Open
crimsondhaks wants to merge 1 commit into
anomalyco:devfrom
crimsondhaks:fix/autocomplete-non-git-worktree
Open

fix(tui): handle non-git project paths in autocomplete and session fi…#29539
crimsondhaks wants to merge 1 commit into
anomalyco:devfrom
crimsondhaks:fix/autocomplete-non-git-worktree

Conversation

@crimsondhaks
Copy link
Copy Markdown

Issue for this PR

Closes #29537

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

For non-git projects the worktree is set to "/" as a sentinel (see packages/opencode/src/project/project.ts). Two TUI sites passed it through as if it were a real path:

  • cli/cmd/tui/component/prompt/autocomplete.tsx: the chain sync.path.worktree || sync.path.directory || process.cwd() picked "/" because it's truthy, so Reference.resolveAll got "/" as the worktree instead of the project directory.
  • cli/cmd/tui/context/sync.tsx: the sessionListQuery guard didn't catch "/", so path.relative("/", directory) produced a stray relative path that was sent as the session filter scope instead of falling back to scope: "project".

Treats "/" as invalid in both call sites. Same pattern as #29180.

How did you verify your code works?

  • bun typecheck from packages/opencode
  • Pre-push hook (bun turbo typecheck) passed across all 19 packages
  • Confirmed referencePath() already handles worktree === "/" downstream, so the autocomplete change brings the call site into consistency; sessionListQuery now correctly returns scope: "project" for non-git projects.

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…lter

For non-git projects worktree is set to "/". Two TUI sites used this value directly: autocomplete passed "/" to Reference.resolveAll, and the session list filter computed a relative path against "/" instead of falling through to scope=project. Treat "/" as invalid in both, matching the pattern from anomalyco#29180.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant