What happened
Multiple task-runner processes running concurrently can simultaneously read the same task as todo in Get-NextWorkflowTask, both pass the claim check, and both attempt git worktree add to the same path. The second call fails fatally, leaving the task in failed or stuck in-progress.
fatal: 'C:\Users...\worktrees<project>\task-<id>-<name>' already exists
Root cause: Get-NextWorkflowTask reads task state without a cross-runner lock. Lock-TaskMutex in Invoke-TaskStatusHandler covers only the HTTP status write — not the read → claim → worktree-creation sequence. Two runners can both observe status = todo before either completes the transition to in-progress.
What you expected
Each task claimed by exactly one runner. Concurrent runners pick distinct tasks; no two runners attempt the same worktree path.
Steps to reproduce
- Create N ≥ 5
todo script tasks in .bot/workspace/tasks/standalone/.
- Launch one pinned runner per task simultaneously:
foreach ($id in $taskIds) {
Start-Job {
& pwsh -File Invoke-DotbotProcess.ps1 -Type task-runner -TaskId $using:id -Continue
}
}
- Observe task-runner logs — multiple runners report
fatal: '...' already exists for the same worktree path.
- Inspect task files — affected tasks land in
failed.
Environment
OS: Windows 11
dotbot: current main
PowerShell: 7.x
Severity
high
Logs / screenshots
[task-runner] git worktree add 'C:...\task-t_4aB2cD3e-stress-task-3' HEAD
fatal: 'C:...\task-t_4aB2cD3e-stress-task-3' already exists
[task-runner] worktree creation failed for task t_4aB2cD3e
What happened
Multiple task-runner processes running concurrently can simultaneously read the same task as
todoinGet-NextWorkflowTask, both pass the claim check, and both attemptgit worktree addto the same path. The second call fails fatally, leaving the task infailedor stuckin-progress.fatal: 'C:\Users...\worktrees<project>\task-<id>-<name>' already existsRoot cause:
Get-NextWorkflowTaskreads task state without a cross-runner lock.Lock-TaskMutexinInvoke-TaskStatusHandlercovers only the HTTP status write — not the read → claim → worktree-creation sequence. Two runners can both observestatus = todobefore either completes the transition toin-progress.What you expected
Each task claimed by exactly one runner. Concurrent runners pick distinct tasks; no two runners attempt the same worktree path.
Steps to reproduce
todoscript tasks in.bot/workspace/tasks/standalone/.fatal: '...' already existsfor the same worktree path.failed.Environment
OS: Windows 11
dotbot: current main
PowerShell: 7.x
Severity
high
Logs / screenshots
[task-runner] git worktree add 'C:...\task-t_4aB2cD3e-stress-task-3' HEAD
fatal: 'C:...\task-t_4aB2cD3e-stress-task-3' already exists
[task-runner] worktree creation failed for task t_4aB2cD3e