fix(FN-4976): preserve live self-owned session bindings during stale cleanup

Fusion-Task-Id: FN-4976
Fusion-Task-Lineage: b7d6e778-f6b1-4529-b04b-81352a11ddad
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 19:11:30 -07:00
committed by gsxdsm
parent f6ec25b5fa
commit 665173d300
2 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ describe("FN-4973: executor worktree conflict cleanup", () => {
activeSessionRegistry.clear();
});
it("reconciles stale self-owned registry entry before removal", async () => {
it("clears stale self-owned registry entry before removal", async () => {
const store = createMockStore();
const executor = new TaskExecutor(store, "/tmp/test");
store.listTasks.mockResolvedValue([]);
@@ -28,7 +28,7 @@ describe("FN-4973: executor worktree conflict cleanup", () => {
expect(activeSessionRegistry.lookupByPath(CONFLICT_PATH)).toBeNull();
expect(store.logEntry).toHaveBeenCalledWith(
"FN-4973",
"Reconciled stale self-owned active-session registration",
"Cleared stale self-owned activeSessionRegistry entry",
CONFLICT_PATH,
);
});

View File

@@ -8881,7 +8881,7 @@ Backward compat fallback: if JSON is unavailable, you may still begin output wit
taskId: string,
): Promise<boolean> {
const activeSessionRecord = activeSessionRegistry.lookupByPath(worktreePath);
if (activeSessionRecord?.taskId === taskId) {
if (activeSessionRecord?.taskId === taskId && !this.hasActiveWorktreeBinding(taskId, worktreePath)) {
executorLog.warn(
`[FN-4976] ${taskId}: clearing stale self-owned activeSessionRegistry entry before cleanup for ${worktreePath}`,
);