Nightly workspace cleanup
A direct housekeeping timer that removes idle Symphony per-issue workspaces after their TTL while preserving unrelated state and reusable caches.
Operating model
timed jobSymphony can preserve workspaces for retries and continuations, but old dehydrated directories become disk overhead. This timer prunes only issue-shaped directories under the configured workspaces root after the TTL.
The regex protects the root from broad deletion. Anything that is not shaped like an issue key is left alone, even if it is old.
System shape
click the nodesThis job is direct host maintenance. Its safety comes from a narrow root, an issue-key directory regex, and an mtime cutoff.
Cadence design
compare modesEach timed job has a small set of modes that decide whether the run is healthy, degraded, or ready to create follow-up work. Use the controls to compare the operating contract.
Verify the cleanup root
The script should operate only under the Symphony workspaces root.
- WORKSPACES_ROOT defaults correctly
- missing root exits 0
- only first-level dirs considered
- operator-owned side paths ignored
Run manually with a temporary root or inspect candidates before enabling deletion.
Execution tracks
interactiveThe tracks make each run inspectable. They separate inputs, outputs, and failure modes so reports do not collapse into vague status updates.
Workspace scope
Operate only on Symphony issue workspaces, not arbitrary files under the host.
- WORKSPACES_ROOT
- directory names
- mtime
- candidate list
- no-op message
- skipped paths
Cleanup risk map
priority mapWorkspace cleanup is valuable only when the deletion boundary is obvious and auditable.
969286807262Output rubric
ticket rulesThe run should create follow-up work only when the output is concrete. Use the rubric to keep reports, bug tickets, and operational follow-ups separated.
Removed
Expired issue-shaped workspace directories were removed and logged with approximate size.
- ENG-123 idle over 7d
- MT-456 removed
Run contract
evidence rowsThe job contract is a bounded deletion set plus journal evidence for every removed workspace.
Direct timer
symphony-workspace-cleanup.timer starts workspace_ttl_cleanup.sh as the symphony user.
Issue-shaped dirs only
Candidates must be first-level directories under WORKSPACES_ROOT, match the issue-key regex, and be older than the TTL.
WORKSPACES_ROOTWORKSPACE_TTL_DAYSRoot exists or no-op messageIssue-key regex usedCandidate countRemoved path and sizeNo candidates older than TTL messageTimer statusCommand plan
operator pathUse a manual run to inspect behavior, then enable the nightly timer.
sudo -u symphony WORKSPACE_TTL_DAYS=7 /opt/symphony/elixir/scripts/workspace_ttl_cleanup.shsudo systemctl enable --now symphony-workspace-cleanup.timersystemctl list-timers | grep symphony-workspace-cleanupjournalctl -u symphony-workspace-cleanup.service -n 80 --no-pagerDo not broaden the find expression unless the workspace naming contract changes in Symphony itself.
Rollout path
ship safelyInspect the root scope
Confirm /var/lib/symphony/workspaces contains only per-issue workspace directories and expected support files.
Run manually candidate check
Use the default TTL and read the deletion or no-op output before enabling the timer.
Enable nightly cleanup systemd
Install the unit files, daemon-reload, and enable the timer.
Tune TTL under load capacity
Adjust WORKSPACE_TTL_DAYS only when retry and rework behavior proves the current window is too long or too short.