Skip to content

fix: allow deletion of pre-marker workspaces - #865

Merged
mariusvniekerk merged 2 commits into
mainfrom
t3code/fix-undeletable-workspace
Aug 9, 2026
Merged

fix: allow deletion of pre-marker workspaces#865
mariusvniekerk merged 2 commits into
mainfrom
t3code/fix-undeletable-workspace

Conversation

@mariusvniekerk

Copy link
Copy Markdown
Collaborator

Workspaces created before ownership markers remained valid Git worktrees, but delete and retry operations rejected them after an upgrade. This left workspace records stranded with no recovery path.

This change accepts the live Git registration at the persisted workspace path as cleanup authority. Same-repository replacements follow the workspace lifecycle. Foreign checkouts and symlink targets remain preserved, and retry recreates the ownership marker.

Validation
  • Full Go suite: 6,294 passed, 11 skipped.
  • Non-mutating lint: 0 issues.
  • Push hooks: passed.

generated by a clanker

mariusvniekerk and others added 2 commits August 9, 2026 12:31
Workspaces created before ownership markers remain valid Git worktrees but cannot be deleted or retried after upgrading. The cleanup contract now treats an exact live registration in the persisted workspace repository as sufficient authority while retaining repository-identity and locked recheck protections.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
Workspaces created before ownership metadata was introduced remained valid Git worktrees but became impossible to delete or retry after upgrading. Treating the persisted repository's live registration as cleanup authority restores those lifecycle operations without requiring a migration or manual marker repair.\n\nSame-repository replacements at the persisted path follow the workspace lifecycle. Foreign replacements and symlink targets remain preserved; symlinked paths can be forgotten without stripping the target worktree's Git metadata.\n\nValidation: make test (6,294 tests, 11 skipped); make lint-check (0 issues); full internal/workspace and internal/server/workspacetest packages.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
@roborev-ci

roborev-ci Bot commented Aug 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (225eb08)

The change has one medium-severity symlink-handling issue that can leave stale worktree registrations or cause ambiguous path matches.

Medium

  • internal/workspace/manager.go:3378 — Symlink handling fails when the original worktree registration has not already been pruned. A foreign target leaves the stale registration after successful deletion, blocking recreation at that path. A same-repository target can cause “multiple worktree registrations match path” because both registrations canonicalize through the symlink. The new e2e test avoids these cases by pruning first.
    • Fix: Reject the symlink before canonical marker lookup, then remove only the original registration using lexical path matching without following the symlink. Add an e2e case that replaces the path without first running git worktree prune.

Reviewers: 2 done | Synthesis: codex, 11s | Total: 5m25s

@wesm

wesm commented Aug 9, 2026

Copy link
Copy Markdown
Member

ah thanks...I hit this a bunch

@mariusvniekerk
mariusvniekerk merged commit fd39780 into main Aug 9, 2026
16 checks passed
@mariusvniekerk
mariusvniekerk deleted the t3code/fix-undeletable-workspace branch August 9, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants