Stale task directories never cleaned up
Apra Fleet is an open-source MCP server
Brought to you by:
apralabs
Originally created by: kumaakh
Originally owned by: joiskash
Long-running tasks create directories at ~/.fleet-tasks/<taskId>/ containing output logs, activity markers, and PID files. These directories are never cleaned up after the task completes. Over time they accumulate and consume disk space on cloud VMs.
fleet task cleanup --older-than 7dDisk space issue on long-lived VMs. Not urgent but will become a problem over months of use.
Code review Round 3, new finding.
Originally posted by: kumaakh
Fixed in main: PR [#175] (fix: send_files collision detection + stale task cleanup) introduced
src/services/task-cleanup.tswhich implements automatic cleanup of~/.fleet-tasks/<taskId>/directories. Completed tasks are retained for 1 hour (configurable viaFLEET_TASK_RETENTION_HOURS_SUCCESS), failed tasks for 7 days (configurable viaFLEET_TASK_RETENTION_HOURS). Live PID detection prevents deletion of running tasks.scheduleTaskCleanup()is called on task completion/failure, andcleanupStaleTasks()runs on startup.Related
Tickets:
#175Ticket changed by: kumaakh