Skip to content

fix: finish cleanup before workspace closure - #59

Merged
dkarter merged 1 commit into
mainfrom
fix/remove-before-workspace-close
Nov 18, 2026
Merged

dkarter merged 1 commit into
mainfrom
fix/remove-before-workspace-close

Conversation

@dkarter

@dkarter dkarter commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Motivation

Removing a worktree from its own workspace could kill HWT before it cleared Git's worktree record. Reviewing the same PR again then failed with a stale-worktree error.

Changes

Finish metadata cleanup, release ports and routes, and run post-remove hooks before closing the workspace. Keep bulk deletion detached.

Testing

Remove a clean review worktree from its own workspace, then review the same PR again. It should reopen without manual Git repair. A compiled-binary regression test kills HWT at workspace closure and checks that the same branch can be reopened.

Dependencies

None.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: sound — making workspace closure the final operation prevents caller termination from interrupting essential cleanup while preserving detached bulk deletion.

Reviewed changes cover removal sequencing, error handling, regression coverage, and the lifecycle specification.

  • Cleanup ordering: Git metadata, routes, ports, and post-remove hooks are handled before workspace closure.
  • Close failures: Errors explicitly distinguish a failed workspace close from completed worktree removal.
  • Regression coverage: Unit assertions and a caller-killing E2E test verify cleanup and branch reuse; specification traceability includes the new scenario.
  • Verification: mise exec -- go test ./internal/worktree ./e2e passed.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@dkarter
dkarter marked this pull request as ready for review November 18, 2026 21:14
@dkarter
dkarter merged commit b293f8f into main Nov 18, 2026
6 checks passed
@dkarter
dkarter deleted the fix/remove-before-workspace-close branch November 18, 2026 21:15
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.

1 participant