Merge pull request #114 from laurentenhoor/fix/113-starttime-update

fix: clear startTime when deactivating workers to prevent stale timestamps
This commit is contained in:
Lauren ten Hoor
2026-02-11 00:29:18 +08:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -230,6 +230,7 @@ export async function activateWorker(
/** /**
* Mark a worker as inactive after task completion. * Mark a worker as inactive after task completion.
* Preserves sessions map and tier for reuse via updateWorker's spread. * Preserves sessions map and tier for reuse via updateWorker's spread.
* Clears startTime to prevent stale timestamps on inactive workers.
*/ */
export async function deactivateWorker( export async function deactivateWorker(
workspaceDir: string, workspaceDir: string,
@@ -239,6 +240,7 @@ export async function deactivateWorker(
return updateWorker(workspaceDir, groupId, role, { return updateWorker(workspaceDir, groupId, role, {
active: false, active: false,
issueId: null, issueId: null,
startTime: null,
}); });
} }

View File

@@ -74,7 +74,7 @@ export async function checkWorkerHealth(opts: {
fixed: false, fixed: false,
}; };
if (autoFix) { 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; fix.fixed = true;
} }
fixes.push(fix); fixes.push(fix);
@@ -95,7 +95,7 @@ export async function checkWorkerHealth(opts: {
await revertIssueLabel(fix); await revertIssueLabel(fix);
const sessions = { ...worker.sessions }; const sessions = { ...worker.sessions };
if (worker.tier) sessions[worker.tier] = null; 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; fix.fixed = true;
} }
fixes.push(fix); fixes.push(fix);
@@ -135,7 +135,7 @@ export async function checkWorkerHealth(opts: {
}; };
if (autoFix) { if (autoFix) {
await revertIssueLabel(fix); 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; fix.fixed = true;
} }
fixes.push(fix); fixes.push(fix);