optio icon indicating copy to clipboard operation
optio copied to clipboard

Run-home cleanup fails on non-UUID directory names

Open matteslip opened this issue 2 weeks ago • 0 comments

Description

A non-UUID directory under /home/agent/optio/runs aborts the run-home cleanup sweep with a PostgreSQL error:

Failed to sweep run homes
invalid input syntax for type uuid: "09a2b5653567"

parseRunHomeList() accepts filesystem-safe names such as 09a2b5653567 and turn-7. finishedRuns() then passes those names to UUID-column queries without validating them. The first query fails, leaving valid finished run homes on the same pod and later pods unprocessed. The warning repeated on subsequent sweeps in the observed deployment.

runHome() can itself create 12-character hexadecimal fallback names when called without a run ID, so such a directory does not require a malformed path.

Steps to Reproduce

  1. Have a ready agent pod with a non-UUID run-home directory, for example /home/agent/optio/runs/09a2b5653567.
  2. Leave a completed run's UUID-named home on that pod as well.
  3. Run sweepFinishedRunHomes() against PostgreSQL.
  4. Observe the UUID conversion error instead of cleanup of the completed run.

Expected Behavior

Unknown directories remain untouched. The sweep looks up UUID run IDs and removes eligible finished run homes even when other directory names are present.

Environment

  • Optio: v0.25.2; also present on main at f5f5b86d.
  • OS: Linux agent containers, gVisor runtime.
  • Node.js version: 26.12.1 in the API image.
  • K8s cluster: Kubernetes 1.35.1; PostgreSQL backend.

matteslip avatar Nov 16 '26 15:11 matteslip