Skip to content

Make worktree remove timeout configurable or resumable during cleanup #699

Description

@chubes4

Problem

bounded-cleanup-eligible-apply can fail safe removals with a fixed 5 second timeout:

reason_code: remove_failed
reason: remove failed: Process command timed out after 5 second(s).

Observed examples during a large cleanup:

  • wpcom-codebox@fix-issue-117-editor-auth-redirect-loop
  • wpcom-codebox@fix-issue-118-local-runtime-fixtures
  • wpcom-codebox@fix-issue-120-editor-proof-workflow
  • wpcom-codebox@fix-selected-page-seed-boot-timeout
  • wpcom-codebox@issue-116-local-auth-preflight
  • studio@fix-auto-mount-wp-config-paths
  • woocommerce@fix-layered-nav-count-cache-bound

These rows had already passed cleanup eligibility checks, but removal could not complete within the fixed command timeout. Re-running sometimes helped, sometimes did not.

Desired behavior

Cleanup removal should be robust for large/slow worktrees:

  • Make the remove timeout configurable for cleanup operations, or use a larger default for bulk cleanup.
  • Preserve per-row revalidation before removal.
  • Emit a continuation command for timeout rows.
  • Distinguish timeout from unsafe state changes.

Safety expectation

A longer timeout must not weaken dirty/unpushed/primary protections. It should only give git worktree remove enough time to complete once the row has passed safety checks.

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