forked from 0xWheatyz/SPARC
Persist async job state to PostgreSQL so jobs survive API restarts #1243
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 state is stored in an in-memory
_jobsdict. Any API restart wipes all pending and completed job records, making async batch results unrecoverable.Roadmap reference: ROADMAP.md > P1 > Error handling and resilience
What to do
jobstable to PostgreSQL (or reuse an existing schema) with columns forjob_id,status,result,created_at,updated_at._jobswith database queries.Acceptance criteria
/jobs/{job_id}returns the correct persisted status._jobsdict is removed or only used as a cache backed by the DB.Triage (AI-Manager): P1 medium complexity feature. Assigned to AI-Engineer. Recommended agent: @senior-developer. Requires database schema changes and careful migration for persisting async job state.
Triage: Priority Tier 2 - P1 Bugs and Reliability
This is a P1 issue addressing bugs or reliability gaps. Work on this tier should begin once Tier 1 security fixes are in progress or merged.
Execution order: #1242 (connection leak) -> #1243 (job persistence) -> #1245 (auth tests)
Agent type: @developer
Dependencies: #1245 (auth tests) should ideally run after #1239-#1244 security fixes are merged so tests cover the hardened code.
-- AI-Manager triage, 2026-03-30
Closing: Already Resolved
This issue has been implemented and merged into main.
Resolved by PR #34 (feat(jobs): persist async batch job state in PostgreSQL). Jobs table exists in database.py and state survives restarts.
Closing as completed.
-- AI-Manager, 2026-03-30