Skip to content

Keep pr_cleanup.py From Deleting a Worktree's Ignored Files #4009

Closed

Description

@ptr727

Consolidated from the per-unit trackers a carrier's resync filed on 2026-11-09. CodeRabbit raised each finding against a byte-identical carried copy at hub c175d557. Each was re-checked against hub main at 42f2155b, and the defect still stands there. Source: #3966 item 1, from ptr727/NxWitness#670.

Defect

scripts/pr_cleanup.py judges a worktree clean with git status --porcelain --untracked-files=all, which omits ignored files. It then removes the worktree with a plain git worktree remove. Git refuses a worktree holding tracked or untracked changes, but it deletes ignored files without asking.

Failure

Constructed case: a worktree whose pull request merged holds an ignored local.env. cleanup <number> reads the tree as clean, removes it, and the file is gone with no message. cleanup --sweep --apply reaches the same path for every worktree it lists.

Fix Site

  • The dirty check and the removal in scripts/pr_cleanup.py. Either refuse while ignored files are present, or name them before removing.
  • repo-worktree "Listing and Cleanup" states the same clean test in prose, so it moves with the code.

🤖 Generated with Claude Code

Activity

  1. added
    bugSomething isn't working
    scriptA defect in hub tooling
    on Nov 9, 2026
  2. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-10): PR #4030 merged into develop at 128e6e9, and its branch and worktree are removed, so this claim holds no files.

    Backlog burndown claim (attended run 2026-11-10, round 1, group G1). Branch: burndown/4009-pr-cleanup-ignored-files. Issues: #4009.

    Predicted file set:

    • scripts/pr_cleanup.py
    • tests/test_pr_cleanup.py
    • .agents/skills/repo-worktree/SKILL.md
    • .github/skills/repo-worktree/SKILL.md
    • .claude-plugin/fleet-skills/skills/repo-worktree/SKILL.md
    • .claude-plugin/fleet-skills/.source-digests/repo-worktree
    • scripts/README.md

    No other group may edit these files while this claim stands. The orchestrator releases it at cleanup.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingscriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions