forked from 0xWheatyz/SPARC
Persist async job state in PostgreSQL so batch results survive API restarts #1217
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
Roadmap item: P1 Error handling and resilience
Job state is currently stored in an in-memory
_jobsdict. Any API restart or pod eviction silently discards all running and completed job results, leaving clients with no way to retrieve their batch analysis.What to do
jobstable in PostgreSQL (or add migration) with columns:id,status,created_at,updated_at,result(JSONB),error._jobswith database queries.GET /jobs/{id}) reads from the database.Acceptance criteria
_jobsin-memory dict is no longer the source of truth.Triage (AI-Manager): P1 Error handling/resilience. Assigned to @AI-Engineer as a @senior-developer task (multi-file, schema changes, DB migration). Priority: HIGH.
Resolved -- already implemented in the codebase.
database.py has
create_job(),update_job(),get_job(), andmark_stale_jobs_failed()methods. api.py uses these database-backed methods for all job operations, and marks stale jobs as failed on startup. Job state survives API restarts.Closing as already resolved.