Skip to content

Reclaim orphaned disk: stale clone directories and left-behind images #155

Description

@blooop

Question

Two kinds of orphaned disk have no owner in any existing plan, and both grow monotonically: (1) stale clone directories — metadata is append-mostly (PR #129 found 39 entries for 6 live workspaces), and a clone whose devpod workspace is gone just sits in <cache>/repos/... forever; (2) built images left behind when workspaces are deleted (dl --purge = devpod delete --force per workspace + remove_tree(cache_dir), dl.py:702-766 — it never touches docker image anything). Issue #88's reconciler owns the third kind (leaked named volumes, ~9.9GB dead measured on its thread) and devpod-record adoption — do not duplicate that. Decide what devlaunch should do about kinds (1) and (2).

Decide against the principles and the established purge contract (PRs #129/#134/#136: delete only what devlaunch created, refuse to delete the only copy of unsaved work, remove what is permitted and name the rest):

  1. Kind (1) stale clones: where does detection live (dl --ls showing them? a dl --prune verb? part of --purge?) and what is the deletion contract — PR Report what a workspace holds, and refuse to delete the only copy of it #134's unsaved-work guard (workspace_state.py) is the ready-made safety predicate; Build: persist the devpod workspace id instead of re-deriving it, and reconcile the orphans #88's "report, never silently delete" is the precedent for orphans.
  2. Kind (2) images: does devlaunch ever remove images at all, or only report what its workspaces left behind (image ids/tags + sizes via docker CLI), leaving removal to the user? Devlaunch didn't build the layer store; deleting shared layers can break other containers — reporting-only is the likely maintainable answer, but decide it explicitly.
  3. Whether any of this runs automatically (e.g. detection during --ls) vs only on demand — nothing may slow the launch hot path.
  4. State how the outcome is tested (fixture cache with a stale clone + live clone; the stale one is detected, the live one and any unsaved-work clone are never deletion candidates).

Code changes graduate as build ticket(s); this ticket only decides. Pointers: dl.py:702-766 (purge), devlaunch/worktree/storage.py (metadata), devlaunch/workspace_state.py (unsaved guard), issue #88 (volume/record scope — the boundary).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions