feat(04-01): implement CAS checkout, lock release, stale recovery, and migration 16

- Rewrite checkoutTask to use runId-based CAS with checkout_run_id IS NULL guard
- Add releaseTaskLock and recoverStaleLocks methods
- Add lock release in finishRun and cancelRunForDeletion exit paths
- Add migration 16: pending_wakes to wakeup_requests cutover with DROP TABLE
- Replace all pending_wakes references with wakeup_requests
- Add wakeup lifecycle CRUD: enqueue, claim, complete, defer, promote, list
- Update api-server, orchestration-service, worker-service callers
- Update existing database.test.ts for new checkoutTask signature
This commit is contained in:
ZacharyZhang-NY committed 2026-03-26 18:56:54 -04:00
1 parent 02e87dc06d
commit 08935b3379
5 files changed
+326 -71

No files matched your search

+1 -1
View File
@@ -355,7 +355,7 @@ export class AgentApiServer {
return;
}
const previousStatus = task.status;
const success = this.db.checkoutTask(params.issueId!, agentId);
const success = this.db.checkoutTask(params.issueId!, token.runId);
if (!success) {
this.json(res, 409, { error: "Task cannot be checked out — already assigned or not in valid status" });
return;