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.
* 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,
});
}

View File

@@ -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);