diff --git a/lib/projects.ts b/lib/projects.ts index cb9c1ca..4215e40 100644 --- a/lib/projects.ts +++ b/lib/projects.ts @@ -230,6 +230,7 @@ export async function activateWorker( /** * Mark a worker as inactive after task completion. * Preserves sessions map and tier for reuse via updateWorker's spread. + * Clears startTime to prevent stale timestamps on inactive workers. */ export async function deactivateWorker( workspaceDir: string, @@ -239,6 +240,7 @@ export async function deactivateWorker( return updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, + startTime: null, }); } diff --git a/lib/services/health.ts b/lib/services/health.ts index 053bd82..031bbdb 100644 --- a/lib/services/health.ts +++ b/lib/services/health.ts @@ -74,7 +74,7 @@ export async function checkWorkerHealth(opts: { fixed: false, }; if (autoFix) { - await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null }); + await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null }); fix.fixed = true; } fixes.push(fix); @@ -95,7 +95,7 @@ export async function checkWorkerHealth(opts: { await revertIssueLabel(fix); const sessions = { ...worker.sessions }; if (worker.tier) sessions[worker.tier] = null; - await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, sessions }); + await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null, sessions }); fix.fixed = true; } fixes.push(fix); @@ -135,7 +135,7 @@ export async function checkWorkerHealth(opts: { }; if (autoFix) { await revertIssueLabel(fix); - await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null }); + await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null }); fix.fixed = true; } fixes.push(fix);