Skip to content

fix(taskctl): worktree commits to dev branch + dependent task not scheduled after completion (#281, #282) #283

@randomm

Description

@randomm

Two related bugs in pulse.ts + worktree/index.ts

Bug 1 (#282): Commits land on dev branch instead of feature branch

Root cause (worktree/index.ts lines 345, 359):

git worktree add --no-checkout -b ${info.branch} ${info.directory}
// then later:
git reset --hard  // resets to HEAD but stays on dev — never checks out the new branch

--no-checkout + git reset --hard leaves the worktree on dev HEAD. The branch opencode/<slug> is created but never checked out. Commits go to dev.

Fix: After git reset --hard, add git checkout ${info.branch} (or use git checkout -b ${info.branch} without --no-checkout).

Bug 2 (#281): Dependent task stays stuck open/idle after deps close

Root cause (pulse.ts):
After commitTask() closes a task and publishes BackgroundTaskEvent.Completed, the Pulse loop still waits up to 5 seconds before calling scheduleReadyTasks() again. In practice, the next tick never reschedules the dependent task — likely because inProgressCount is miscounted or the tick fires before the DB write is visible.

Fix: After commitTask() successfully closes a task, immediately call scheduleReadyTasks() inline rather than waiting for the next Pulse tick.

Acceptance Criteria

  • After adversarial APPROVED + @ops commit, git log shows commit on opencode/<task-slug> branch, NOT dev
  • After a task closes, dependent tasks are scheduled within one Pulse tick (≤5s)
  • bun test and bun run typecheck pass
  • Existing pulse/worktree tests updated to cover these scenarios

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