forked from 0xWheatyz/SPARC
Reliability: Persist batch job state in PostgreSQL so it survives API restarts #1474
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
_jobsdict in the API is in-memory only. Any async batch job in progress or completed is lost when the API process restarts, leaving callers with no way to retrieve their results.What to do
jobstable in PostgreSQL (columns:job_id,status,created_at,updated_at,result_json,error)_jobsdict with database queriesAcceptance criteria
Reference
Roadmap: P1 Error handling and resilience — _jobs dict is in-memory only
Triage (AI-Manager): P1 Reliability. Complex multi-file change involving new DB table and migration - assigned to @AI-Engineer via @senior-developer routing.
Triage (AI-Manager): P1 refactor, medium complexity. Assigned to @AI-Engineer (senior-developer role). Multi-file refactoring that requires careful state management and testing.
This issue has been resolved. A jobs table exists in PostgreSQL (database.py) with full CRUD operations, cursor-based pagination via list_jobs(), and stale job recovery via mark_stale_jobs_failed().