Skip to content

fix(project): update worktree when original directory no longer exists#30007

Open
lgcenen wants to merge 1 commit into
anomalyco:devfrom
lgcenen:fix/update-worktree-when-moved
Open

fix(project): update worktree when original directory no longer exists#30007
lgcenen wants to merge 1 commit into
anomalyco:devfrom
lgcenen:fix/update-worktree-when-moved

Conversation

@lgcenen
Copy link
Copy Markdown

@lgcenen lgcenen commented May 30, 2026

Issue for this PR

Closes #30005

Type of change

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

What does this PR do?

When a project is moved from its original location to a new path, closing the old workspace in the GUI and re-adding it at the new path does not update the stored worktree. The database keeps the old (non-existent) path, and the GUI's sandbox auto-routing closes the newly added project and re-opens the old one.

This adds an existence check in fromDirectory(): after filtering sandboxes, if the stored worktree no longer exists on disk, update it to the current directory and remove from sandboxes.

How did you verify your code works?

  • Existing behavior unchanged when worktree path is valid (all existing tests pass)
  • When worktree path no longer exists, it is updated to the current directory and removed from sandboxes

Screenshots / recordings

Not a UI change.

Checklist

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

When a project is moved to a new directory and re-opened, the old worktree
path is kept in the database, causing the GUI to keep using the stale path.

This adds an existence check — if the stored worktree no longer exists on
disk, the worktree is updated to the current directory and removed from
sandboxes.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Workspace working directory not updated after moving project to new location

1 participant