Skip to content

fix(repos): keep unmanaged and ignored-data worktrees in add reclaim - #4106

Merged
dan-petty merged 4 commits into
mainfrom
fix/4092-worktree-cleanup-scope
Nov 8, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/4092-worktree-cleanup-scope

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops repos worktrees add first runs reclaim_merged_worktrees, and that function removes any clean worktree of the repository whose tip heads a merged pull request, wherever its folder is (#4092). On 2026-11-07 it removed worktrees of other agents five times: folders outside agent/worktrees and stale folders inside it. A worktree with ignored files counts as clean, because git status hides them, so the removal also deleted ignored data (1.1 GB in one case). A worktree whose directory is missing is removed with no merge check.

Closes #4092

Change: openspec/changes/archive/2026-11-08-4092-worktree-cleanup-scope/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/repos The devops repos commands and worktrees labels Nov 8, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test record for this change.

Fail-to-pass run (uv run devops ci fail-to-pass --base origin/main, on the test commit): 4 tests fail on the base for the right reason, and 15 pass on both.

  • test_worktree_outside_managed_folder_is_kept: failed on base. The base removes a worktree outside the managed folder.
  • test_ignored_file_keeps_worktree: failed on base. The base removes a worktree that holds an ignored file.
  • test_missing_directory_outside_folder_is_kept: failed on base. The base removes a worktree with a missing directory, with no merge check.
  • test_the_dry_run_lists_a_read_only_for_a_worktree_inside_the_folder: failed on base. The base reads GitHub for worktrees outside the folder.

All tests use real git in tmp repos. No test touches a worktree outside the tmp folder.

Full devops ci (one run under the shared lock, on tree 51b7629): exit 0, 52 rows pass, 20 min 18 s. The later commit changes only OpenSpec text (archive).

Log of the run: .data/agent/scratch/4092-ci.txt (local file, not in the repository).

@dan-petty
dan-petty marked this pull request as ready for review November 8, 2026 01:52
@dan-petty
dan-petty merged commit 8978d56 into main Nov 8, 2026
25 checks passed
@dan-petty
dan-petty deleted the fix/4092-worktree-cleanup-scope branch November 8, 2026 01:54
dan-petty pushed a commit that referenced this pull request Nov 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.87.0](v0.86.0...v0.87.0)
(2026-11-08)


### Features

* **k8s:** add k8s crawl4ai-check command
([#4108](#4108))
([32e247f](32e247f))


### Bug Fixes

* **repos:** keep unmanaged and ignored-data worktrees in add reclaim
([#4106](#4106))
([8978d56](8978d56))
* **roadmap:** check a split plan of the stage with every gate
([#4109](#4109))
([768dbd3](768dbd3))
* **roadmap:** count only answered searches in alternatives
([#4101](#4101))
([b34fe0e](b34fe0e))
* **roadmap:** keep a round alive on item-changed; fail on bad schedule
([#4102](#4102))
([9231dc3](9231dc3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/repos The devops repos commands and worktrees type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(repos): worktree cleanup keeps other worktrees

1 participant