Context: CodeRabbit feedback on upstream PR coleam00#1875 surfaced a likely-valid DB race in our fork.
Problem:
- packages/core/src/db/prd-execution-leases.ts refreshes an existing same-run lease using WHERE id = $7.
- If another path releases the lease after the initial read, the refresh can update a released row back to active.
Impact:
- P2 race-condition correctness issue.
Acceptance criteria:
- Constrain the refresh UPDATE to unreleased rows, e.g. WHERE id = $7 AND released_at IS NULL.
- Keep rowCount checks and surface a clear error when no active row remains.
- Add a regression test for refresh after release/no-op update.
Reference:
Context: CodeRabbit feedback on upstream PR coleam00#1875 surfaced a likely-valid DB race in our fork.
Problem:
Impact:
Acceptance criteria:
Reference: