Skip to content

fix: clean up orphaned sessions with missing worktree paths on startup#107

Merged
everpcpc merged 1 commit intodatabendlabs:mainfrom
everpcpc:lima-w8ykcn83
Feb 10, 2026
Merged

fix: clean up orphaned sessions with missing worktree paths on startup#107
everpcpc merged 1 commit intodatabendlabs:mainfrom
everpcpc:lima-w8ykcn83

Conversation

@everpcpc
Copy link
Member

Summary

When a worktree is deleted outside of the app (e.g., via git worktree remove in the terminal or manually removing the directory), the associated sessions remain in the database as orphans. This PR adds a startup cleanup step that detects and removes these orphaned sessions.

  • SessionManager.cleanupOrphanedSessions() iterates all non-main-repo sessions and permanently deletes any whose worktree_path no longer exists on disk.
  • Called once during app initialization in index.ts, right after initializeFromDatabase().

Tests

  • No Test - Cleanup logic is straightforward filesystem existence check; pre-existing tests unaffected.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@everpcpc everpcpc marked this pull request as ready for review February 10, 2026 13:59
@everpcpc everpcpc merged commit d46c2b4 into databendlabs:main Feb 10, 2026
3 checks passed
@everpcpc everpcpc deleted the lima-w8ykcn83 branch February 10, 2026 13:59
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

Comments