Make worker claims and provider attempts crash-safe #5

Open
opened 2026-03-10 14:40:54 +03:00 by sirily · 0 comments
Owner

Problem
packages/db/src/worker-store.ts marks requests as running before execution, but does not persist an attempt record before the external call and has no recovery path for requests left stuck in running after crashes or exceptions.

Why this matters
A worker crash or mid-flight exception can permanently strand a request, and the system also fails the auditability requirement to persist every provider-key attempt.

Acceptance criteria

  • Persist a started GenerationAttempt before the provider call.
  • Finalize attempt status after success/failure.
  • Add recovery or lease-based reclaim logic for stale running requests.
  • Cover crash/retry behavior with tests.
Problem `packages/db/src/worker-store.ts` marks requests as `running` before execution, but does not persist an attempt record before the external call and has no recovery path for requests left stuck in `running` after crashes or exceptions. Why this matters A worker crash or mid-flight exception can permanently strand a request, and the system also fails the auditability requirement to persist every provider-key attempt. Acceptance criteria - Persist a started `GenerationAttempt` before the provider call. - Finalize attempt status after success/failure. - Add recovery or lease-based reclaim logic for stale `running` requests. - Cover crash/retry behavior with tests.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sirily/nroxy#5