Skip to content

feat: worktree lifecycle hardening (orphan cleanup, lock detection) #67

@dougss

Description

@dougss

Summary

Harden worktree management: cleanup orphans on startup, detect lock files, check merge conflicts before PR.

Current State

  • src/integrations/git/worktrees.ts handles creation
  • Config has orphan_worktree_cleanup_on_startup but needs robust implementation
  • No lock detection or proactive conflict checking

Plan

  1. cleanupOrphanWorktrees() — scan worktrees_dir, remove untracked in DB
  2. detectWorktreeLock(repoPath) — check .git/worktrees/*/locked
  3. checkMergeConflicts(repoPath, target)git merge-tree dry-run
  4. Call on daemon startup, before provisioning, and before PR
  5. Emit new event types

Files

  • src/integrations/git/worktrees.ts
  • src/core/pipeline.ts
  • src/harness/events.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions