Skip to content

Cleanup plan/apply contract misses safe rows found by worktree cleanup preview #844

Description

@chubes4

Problem

During a large workspace cleanup, this command reported fresh_safe_removable_count: 9 and concrete safe candidates from local-merged, remote-tracking-clean, and upstream-gone signals:

studio wp datamachine-code workspace worktree cleanup --dry-run --limit=100 --offset=0 --until-budget=180s --format=json

Trying to apply the same reviewed page through lower-level cleanup failed with:

Error: Paginated cleanup is review-only. Use --dry-run with --limit/--offset, then apply a reviewed cleanup path.

Following the recommended high-level path produced a DB-backed plan containing only resolver rows and no destructive worktree_removal rows to apply:

studio wp datamachine-code workspace cleanup plan --mode=retention --limit=100 --offset=0 --format=json

Why this is confusing

The preview says there are safe removable worktrees, but the documented reviewed apply path does not preserve or apply those exact reviewed rows. The operator has to switch to unrelated drain commands and hope they rediscover the same candidates.

Desired behavior

A reviewed cleanup preview page that reports safe removable rows should provide an apply command/run ID that applies exactly those rows after fresh revalidation, or the preview should not report them as apply-ready.

Acceptance criteria

  • Paginated dry-run output includes a valid apply path for the reviewed candidate set.
  • workspace cleanup plan --mode=retention captures safe local-merged, remote-tracking-clean, and upstream-gone worktree removals as destructive rows when those same rows are reported by worktree cleanup preview.
  • Error messages point to a command that can actually apply the reviewed rows.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenAI gpt-5.5 via OpenCode
  • Used for: Capturing cleanup operator friction from an interactive cleanup session.

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