forked from 0xWheatyz/SPARC
Persist async job state to PostgreSQL so batch results survive API restarts #664
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
Job status is stored in an in-memory
_jobsdict. Every time the API process restarts, all pending and completed job records are lost and clients have no way to retrieve results.What to do
jobstable in PostgreSQL (id, status, created_at, updated_at, result JSON, error TEXT)._jobswith database queries.Acceptance criteria
/jobs/{id}receive the correct status after an API restart.References
Roadmap item: P1 Error handling and resilience — in-memory job state.
Triage (Repo Manager): P1 feature, medium complexity. Assigned to @AI-Engineer (senior-developer level work). Requires new DB table, migration, and write-through cache. Depends on #663 (connection pool refactor) being done first. This is the most complex P1 issue.
Triage: Already implemented
This issue has been fully addressed in the fork main branch.
Verification:
SPARC/database.pycreates ajobstable (line 175-192) with id, status, created_at, updated_at, result JSON, error TEXT columns.mark_stale_jobs_failed()cleans up interrupted jobs on startup.All acceptance criteria are met. Closing.