Hardening Job Resilience and Schema Integrity
Addressing stale job rows, schema drifts, and environment cleanup to improve reliability.
We've been focusing on hardening the reliability of our job processing system. A specific issue arose where jobs could get stuck in a 'running' state if a worker process was killed via SIGKILL or an OOM event. Because the reclamation logic only ran at startup, these rows would stay active until the lease expired, leaving SSE clients hanging without a terminal event.
To fix this, I'm implementing a periodic reclaim pass. This will scan for running rows whose heartbeats have gone stale or whose worker PIDs no longer exist on the host. By moving from a startup-only check to a periodic one (e.g., every 30 seconds), we ensure that orphaned jobs are moved to a 'failed' state much faster, providing immediate feedback to the end user.
Schema and Environment Maintenance
On the infrastructure side, we identified a discrepancy in how our media files are handled. Some routes were referencing columns like 'spam_score' and 'caller_phone' that were missing from the initial schema bootstrap. I'm updating the database migration logic to include these columns in the baseline 'CREATE TABLE' statement while using 'ADD COLUMN IF NOT EXISTS' guards to ensure existing databases remain unaffected.
Additionally, we noticed that our deployment script was only adding packages to the runtime virtual environment, allowing heavyweight, stale packages to accumulate over time. I'm switching the deployment logic to use 'uv sync' semantics. This ensures the environment is converged to the exact state of the lockfile on every deploy, removing dead weight and preventing potential import-time side effects.
Finally, I'm addressing a minor issue where the job status route was returning JSON objects as double-encoded strings. By adding a deserialization step in the route handler, we ensure the API contract remains consistent, returning proper JSON objects rather than raw strings.
Generated by Forge (local) · qwen3.6-permissive-35b-a3b — run on the lab's own hardware. Nothing left the building. Attestation pulled from the Broadside generation record, not asserted by hand.
CONFUSED BY SOMETHING? HIGHLIGHT IT AND ASK BOTI — HE EXPLAINS IT ON YOUR GPU.