Skip to content

fix(tui): handle non-git project paths when opening editor#29180

Open
OpeOginni wants to merge 1 commit into
anomalyco:devfrom
OpeOginni:fix/open-editor
Open

fix(tui): handle non-git project paths when opening editor#29180
OpeOginni wants to merge 1 commit into
anomalyco:devfrom
OpeOginni:fix/open-editor

Conversation

@OpeOginni
Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #16071

Type of change

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

What does this PR do?

When opening the external editor from the TUI prompt or session export, the cwd was resolved as:
project.instance.path().worktree || project.instance.directory() || process.cwd()

For non-git projects, worktree is intentionally set to "/" (see src/project/project.ts). Because "/" is truthy, it was selected as the working directory, causing the editor to open at the filesystem root instead of the actual project directory.

Fix

Treat "/" as an invalid worktree at the three Editor.open() call sites so the fallback chain correctly resolves to project.instance.directory().

How did you verify your code works?

  • Tests Run Successful

Screenshots / recordings

Checklist

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non deterministic behaviour of variants passed into agents in the opencode.json config (Desktop)

1 participant