Merge pull request #1202 from plarson/fix/skip-blocked-todo-reclaim

fix: skip blocked todo tasks during self-owned reclaim
This commit is contained in:
gsxdsm
2026-05-30 16:33:52 -07:00
committed by GitHub
3 changed files with 23 additions and 0 deletions

View File

@@ -7722,6 +7722,20 @@ describe("SelfHealingManager reclaimSelfOwnedBranchConflicts", () => {
expect(store.updateTask).toHaveBeenCalledWith("FN-500", expect.objectContaining({ worktree: "/tmp/fn-500", branch: "fusion/fn-500", status: null, paused: false }));
});
it("skips blocked todo tasks with preserved branches", async () => {
(store.listTasks as any)
.mockResolvedValueOnce([{ id: "FN-516", column: "todo", blockedBy: "FN-216", checkedOutBy: null, branch: "fusion/fn-516", worktree: "/tmp/fn-516" }])
.mockResolvedValueOnce([])
.mockResolvedValueOnce([]);
const inspectSpy = vi.spyOn(branchConflictModule, "inspectBranchConflict");
const recovered = await manager.reclaimSelfOwnedBranchConflicts();
expect(recovered).toBe(0);
expect(inspectSpy).not.toHaveBeenCalled();
expect(store.updateTask).not.toHaveBeenCalled();
});
it("skips checked out tasks", async () => {
(store.listTasks as any)
.mockResolvedValueOnce([{ id: "FN-501", checkedOutBy: "agent-1", branch: "fusion/fn-501", worktree: "/tmp/fn-501" }])

View File

@@ -2095,6 +2095,10 @@ export class SelfHealingManager {
for (const task of candidates) {
if (task.checkedOutBy || activeTaskIds.has(task.id.toUpperCase()) || !task.branch || !task.worktree) continue;
if (task.userPaused) continue;
if (task.column === "todo" && task.blockedBy) {
log.log(`[self-healing] skipping blocked todo task ${task.id} during self-owned branch reclaim (blockedBy=${task.blockedBy})`);
continue;
}
if (task.pausedReason === "worktrunk_operation_failed") {
log.log(`[self-healing] skipping worktrunk-paused task ${task.id}`);
continue;