Skip to content

Data Retention

Added in v0.3.2

Automatic cleanup of expired data to prevent unbounded database growth.

What gets cleaned up

DataConditionFrequency
Expired pairing codesPast expiresAtEvery cleanup run
Used pairing codesOlder than 24 hoursEvery cleanup run
Terminal tasksOlder than DATA_RETENTION_DAYSEvery cleanup run
Task messagesCascade-deleted with taskWith parent task
Task filesCascade-deleted with task (DB record + disk file)With parent task

What is NEVER cleaned up

  • Active tasks (submitted, working, input-required) — regardless of age
  • Agent records
  • Connection records

Configuration

Env varDefaultDescription
DATA_RETENTION_DAYS90Days to keep terminal tasks. 0 = keep forever
CLEANUP_INTERVAL_MS21600000 (6h)Interval between cleanup runs

Schedule

  • Runs once on server startup
  • Repeats every CLEANUP_INTERVAL_MS
  • Does not keep the process alive (uses unref())