The account-wide autoreview singleton uses a GitHub ref (crq-leader) claimed via atomic
create-if-not-exists, with a heartbeat + TTL-steal. Two residual concurrency gaps remain, both
inherent to GitHub refs lacking compare-and-swap:
- Force-heartbeat window (Codex crq:218):
_leader_beat re-confirms ownership then
force-PATCHes, but a heartbeat delayed past CRQ_LEADER_TTL could still clobber a host that
legitimately stole the stale ref in the gap between the re-read and the PATCH. The window is now
small, but non-zero.
- Heartbeat cadence vs. long passes (Codex crq:915): leadership is refreshed once per pass. On a
huge scope a single pass can exceed CRQ_LEADER_TTL, letting a standby steal mid-pass → brief
double-leadership.
Impact is low: the state lock serializes all mutations (no corruption) and dedup/fired-markers
catch duplicate review requests; worst case is brief, self-correcting duplicate scanning.
Proposed options: heartbeat periodically within a pass (not just at the top); cap pass duration;
or move leader election to a primitive that has CAS if cross-host failover at scale matters. For
single-daemon deployments the per-host pidfile already guarantees one daemon. Deferred from PR #1.
The account-wide autoreview singleton uses a GitHub ref (
crq-leader) claimed via atomiccreate-if-not-exists, with a heartbeat + TTL-steal. Two residual concurrency gaps remain, both
inherent to GitHub refs lacking compare-and-swap:
_leader_beatre-confirms ownership thenforce-PATCHes, but a heartbeat delayed past
CRQ_LEADER_TTLcould still clobber a host thatlegitimately stole the stale ref in the gap between the re-read and the PATCH. The window is now
small, but non-zero.
huge scope a single pass can exceed
CRQ_LEADER_TTL, letting a standby steal mid-pass → briefdouble-leadership.
Impact is low: the state lock serializes all mutations (no corruption) and dedup/fired-markers
catch duplicate review requests; worst case is brief, self-correcting duplicate scanning.
Proposed options: heartbeat periodically within a pass (not just at the top); cap pass duration;
or move leader election to a primitive that has CAS if cross-host failover at scale matters. For
single-daemon deployments the per-host pidfile already guarantees one daemon. Deferred from PR #1.