Skip to content

feat(taskctl): make start command resilient to existing branches #381

@randomm

Description

@randomm

Problem

When taskctl start <issue> is run after a previous failed attempt, it fails with:

Failed to create feature branch feature/issue-N: fatal: a branch named 'feature/issue-N' already exists

This blocks retrying failed pipelines without manual cleanup.

Expected Behavior

taskctl start should:

  • Option A: Detect and clean up stale branches/worktrees automatically
  • Option B: Resume work on existing branches
  • Option C: Use unique branch names per attempt (e.g., feature/issue-N-attempt-2)

Current Workaround

Manual cleanup:

git branch -D feature/issue-N
git worktree remove .worktrees/task-name
taskctl start N

Quality Gates (Non-Negotiable)

  • TDD: Write tests for branch creation logic
  • Linting passes
  • Local verification: all tests pass

Acceptance Criteria

  • taskctl start succeeds even if branch already exists
  • No manual cleanup required
  • Previous failed attempts do not block new attempts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions