Description
Each scan creates a temporary workspace under WORKSPACE_ROOT to store uploaded files, extracted archives, and scan artifacts. Currently, these workspaces are only removed when a client explicitly calls DELETE /jobs/{job_id}. If jobs are not manually deleted, temporary directories and their corresponding database records accumulate over time, consuming disk space and leaving stale metadata behind.
Implement an automatic cleanup mechanism that periodically removes expired job workspaces and their associated database records based on a configurable time-to-live (TTL).
Acceptance Criteria
Why This Matters
Automatically cleaning up expired workspaces prevents unnecessary disk usage, keeps the database free of stale records, and improves the stability of long-running PatchPilot deployments without requiring manual maintenance.
Difficulty: Medium
Description
Each scan creates a temporary workspace under
WORKSPACE_ROOTto store uploaded files, extracted archives, and scan artifacts. Currently, these workspaces are only removed when a client explicitly callsDELETE /jobs/{job_id}. If jobs are not manually deleted, temporary directories and their corresponding database records accumulate over time, consuming disk space and leaving stale metadata behind.Implement an automatic cleanup mechanism that periodically removes expired job workspaces and their associated database records based on a configurable time-to-live (TTL).
Acceptance Criteria
JOB_TTL_HOURS(default: 24 hours).JOB_TTL_HOURSenvironment variable.jobsfindingsJOB_TTL_HOURSenvironment variable in the README.md under a new Configuration section.Why This Matters
Automatically cleaning up expired workspaces prevents unnecessary disk usage, keeps the database free of stale records, and improves the stability of long-running PatchPilot deployments without requiring manual maintenance.
Difficulty: Medium