Skip to content

extensions/control: garbage-collect stale session-control sockets and aliases #117

@benvinegar

Description

@benvinegar

Problem

pi/extensions/control.ts has an explicit TODO for stale socket/alias cleanup. Over long-lived runtimes, .pi/session-control can accumulate stale files from crashes or interrupted shutdowns.

Proposed solution

  • Implement periodic GC in control extension startup (and/or heartbeat interval):
    • delete orphaned .alias symlinks
    • delete stale .sock entries not owned by a live process
    • optionally age-gate cleanup (e.g., older than 7 days)
  • Add safety checks to avoid deleting active sockets.
  • Add tests for stale/orphaned file handling.

Helpful context

  • TODO marker in code: pi/extensions/control.ts around removeAliasesForSocket.
  • Existing cleanup behavior is mainly in start.sh (best-effort on startup), but extension-level GC would keep state healthy during long uptimes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions