forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL to survive API restarts #176
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 in-flight or completed job status is lost when the API process restarts, making batch operations unreliable.Work
jobstable in PostgreSQL (columns:id,status,created_at,updated_at,result,error)._jobsdict with queries against this table.Acceptance Criteria
GET /jobs/{id}returns the correct status for jobs created before the restart.References
Roadmap: P1 — Error handling and resilience — _jobs dict in-memory only.
Triaged by repo manager. Assigned to @AI-Engineer (senior developer). Medium complexity: persist async job state to PostgreSQL so jobs survive API restarts. Requires schema migration. P1 priority.
Already resolved. database.py has a jobs table with create_job(), update_job(), list_jobs(), and mark_stale_jobs_failed() methods. Job state is fully persisted in PostgreSQL and stale jobs are marked as failed on server restart. Closing.