Skip to content

Cleanup commands should stream progress and identify the current worktree #186

Description

@chubes4

Problem

During a disk-fill incident on intelligence-chubes4, these commands appeared to hang without output and had to be aborted:

  • studio wp datamachine-code workspace worktree cleanup --format=table
  • studio wp datamachine-code workspace worktree cleanup --skip-github --format=table
  • studio wp datamachine-code workspace worktree cleanup-artifacts --dry-run --format=table

The workspace had hundreds of DMC worktrees. Because cleanup produced no heartbeat, current handle, elapsed time, or partial counts, the operator could not tell whether it was making progress, stuck on one pathological repo, or waiting on an external call.

Expected behavior

Long-running cleanup operations should stream progress in human formats and expose machine-readable progress in JSON modes.

Minimum requirements:

  • Print a heartbeat every N worktrees or seconds in table/text mode.
  • Include current handle/path, checked count, candidate count, skipped count, removed count, elapsed time, and estimated remaining count where possible.
  • Log slow per-worktree probes with duration and operation name.
  • Add a --quiet flag if fully silent output is needed.
  • Ensure one stuck worktree does not hide which handle is responsible.

Acceptance criteria

  • On a workspace with hundreds of worktrees, cleanup emits progress before the first expensive full scan completes.
  • If a single worktree probe exceeds a timeout/slow threshold, the output names that worktree.
  • Tests or fixtures cover progress output for multi-worktree cleanup runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions