Skip to content

Clean orphaned runtime directories from configured TMPDIR #2086

Description

@chubes4

Problem

WP Codebox leaves large runtime and test directories under the configured shared TMPDIR, but wp-codebox doctor and wp-codebox cleanup do not inventory or remove them once no recipe-run process remains.

Observed on a production coding host:

  • /mnt/extrachill-workspace/tmp: approximately 35 GiB
  • wp-codebox doctor --json --archive-root /mnt/extrachill-workspace/tmp --stale-after-seconds 3600: reports zero recipe-run processes and zero stale processes
  • The same doctor pass checks 304 ZIPs and identifies only five invalid archives totaling roughly 5.7 MiB
  • The directory contains abandoned names such as wp-codebox-release-*, wp-codebox-release-coverage-*, wp-codebox-plugin-*, wp-codebox-readonly-mounts-*, node-playground-cli-site-*, and homeboy-wp-codebox-phpunit-*
  • Individual orphan directories range from hundreds of MiB to more than 2 GiB

The cleanup command therefore reports a nearly clean state while tens of GiB of WP Codebox-owned temporary runtime state remain.

Expected

wp-codebox doctor should inventory owned runtime directories under the effective temp root, classify active/leased/recent/orphaned state, and report their allocated bytes. wp-codebox cleanup should remove only safely stale orphan directories using the same ownership and liveness evidence.

Acceptance criteria

  • Discover WP Codebox-owned temp directories under the effective TMPDIR, not only known archive roots.
  • Protect live processes, held previews, active leases, and recently created runs.
  • Age-gate stale directories with an operator-configurable threshold.
  • Report candidate count, retained count/reasons, and estimated/reclaimed allocated bytes.
  • Remove nested Playground, release, plugin-overlay, read-only-mount, PHPUnit, and runtime directories only when ownership and liveness are proven.
  • Cleanup is idempotent and never requires operators to use raw rm or filename glob assumptions.

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