You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Central bookkeeper between event ingestion and container execution. Owns the registry layer only — not webhook receipt, not lease acquisition, not container spawn.
Owns:
Track active containers: worker ID, target identity (repo+PR), start time, last heartbeat, status
Idempotency: prevent duplicate spawns for same target+event
Assignment: assign(target) → worker slot or capacity-rejected signal
Stale detection: heartbeat-based liveness; dead worker → release assignments, mark target unassigned
Visibility: status() snapshot of all active workers without polling individual containers
Graceful shutdown: drain mode — worker marked draining, no new assignments, exits after current loop completes
AC1 Registry holds per-worker record: worker ID, target identity, start time, last heartbeat timestamp, status (active | draining | dead)
AC2claim(target, eventId) returns already_claimed when same target+eventId already active — no second worker spawned
AC3assign(target) returns available worker slot; same target maps to same worker while that worker is active; returns capacity-rejected signal when at limit
AC4 Worker missing N consecutive heartbeat intervals is marked dead; all its assignments released; target set to unassigned
AC5 Worker can be set to draining: no new assignments accepted, current loop allowed to complete, transitions to dead on clean exit
AC6status() returns consistent snapshot of all tracked workers with current state; no container-by-container queries needed
Definition of Done
DoD1 Unit tests cover: idempotency (duplicate claim rejected), assignment consistency, heartbeat expiry → dead transition, drain → exit transition
DoD2 In-memory implementation sufficient for MVP; no external DB dependency introduced
DoD3 Registry exposed via injectable interface (not a global singleton); tests use fakes/test doubles
DoD4 Heartbeat interval and stale threshold are named configurable constants (not magic numbers)
DoD5 All AC items verified by automated tests
DoD6 Code reviewed and merged to feature branch; CI green
Scope
Central bookkeeper between event ingestion and container execution. Owns the registry layer only — not webhook receipt, not lease acquisition, not container spawn.
Owns:
assign(target)→ worker slot or capacity-rejected signalstatus()snapshot of all active workers without polling individual containersFlow
Acceptance Criteria
active|draining|dead)claim(target, eventId)returnsalready_claimedwhen same target+eventId already active — no second worker spawnedassign(target)returns available worker slot; same target maps to same worker while that worker is active; returns capacity-rejected signal when at limitdead; all its assignments released; target set to unassigneddraining: no new assignments accepted, current loop allowed to complete, transitions todeadon clean exitstatus()returns consistent snapshot of all tracked workers with current state; no container-by-container queries neededDefinition of Done
AC / DoD Matrix
Non-Goals