Skip to content

cleanup-feature Step 8.5: surface untracked file list on dirty-tree teardown failure #153

@jankneumann

Description

@jankneumann

Problem

/cleanup-feature Step 8.5 invokes worktree.py teardown. When the worktree has uncommitted or untracked files, teardown aborts safely — good — but the error message currently only says "worktree is dirty, refusing to remove" without listing which files are dirty.

The operator then has to cd into the worktree and run git status themselves to decide whether the leftover files matter.

Proposed fix

In the dirty-tree abort path of worktree.py teardown, run git status --porcelain (or equivalent) in the worktree and include the output in the abort message, formatted as:

```
Worktree .git-worktrees// has uncommitted changes:
?? scratch.txt
M skills/foo/SKILL.md

Re-run with --force to discard, or commit/clean the worktree first.
```

Cap the list at ~20 entries with a "... and N more" tail if it overflows, so a runaway untracked dir doesn't dump pages of output.

Acceptance

  • Teardown of a dirty worktree shows the file list inline.
  • Same in cleanup-feature's stdout (i.e. the wrapper passes it through).
  • Existing teardown unit tests extended to assert the listing appears.

Source

Follow-up from wire-autopilot-phase-subagents change run (2026-05-10).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions