[PR #2901] [CLOSED] tools: prune worktrees once their PR is merged or closed #4679

Closed
opened 2026-11-03 05:07:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2901
Author: @socksprox
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: tools/prune-worktrees


📝 Commits (1)

  • 101f7e0 tools: prune worktrees once their PR is merged or closed

📊 Changes

2 files changed (+140 additions, -0 deletions)

View changed files

📝 AGENTS.md (+5 -0)
➕ tools/prune_worktrees.py (+135 -0)

📄 Description

🤖 Opened by socksprox's AI agent (Devin), not by socksprox himself.

What and why

Agent work in this repo happens in worktrees, one per PR. Once the PR is done the worktree stays behind — its target/ alone is 5–25 GB. One checkout here had 34 stale worktrees adding ~107 GB.

tools/prune_worktrees.py lists each linked worktree with its branch's PR state (gh, with a merge-base fallback) and, with --apply, stashes anything uncommitted and removes the worktrees whose PR is merged or closed. Branches are never deleted (--branches opts in); --no-pr also removes worktrees whose branch never got a PR.

AGENTS.md gains the command plus the worktree lifecycle note.

Vanilla reference

none — repo tooling.

Self-check

pr_ready (tools/pr_ready.py --quick on MacBookPro, against origin/main at 42ecf0f67, 39 s)

Check Result
Scope ✅ 2 files, +140 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 365 passed (38 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label skip-release

🤖 Generated with Devin


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2901 **Author:** [@socksprox](https://github.com/socksprox) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `tools/prune-worktrees` --- ### 📝 Commits (1) - [`101f7e0`](https://github.com/horizon-rust/horizon/commit/101f7e0a93684635e07336326fd5face9aa86092) tools: prune worktrees once their PR is merged or closed ### 📊 Changes **2 files changed** (+140 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+5 -0) ➕ `tools/prune_worktrees.py` (+135 -0) </details> ### 📄 Description > 🤖 Opened by socksprox's AI agent (Devin), not by socksprox himself. ## What and why Agent work in this repo happens in worktrees, one per PR. Once the PR is done the worktree stays behind — its `target/` alone is 5–25 GB. One checkout here had 34 stale worktrees adding ~107 GB. `tools/prune_worktrees.py` lists each linked worktree with its branch's PR state (`gh`, with a `merge-base` fallback) and, with `--apply`, stashes anything uncommitted and removes the worktrees whose PR is merged or closed. Branches are never deleted (`--branches` opts in); `--no-pr` also removes worktrees whose branch never got a PR. AGENTS.md gains the command plus the worktree lifecycle note. ## Vanilla reference none — repo tooling. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on MacBookPro, against origin/main at 42ecf0f67, 39 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +140 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 365 passed (38 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | `skip-release` | 🤖 Generated with [Devin](https://devin.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:08 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4679
No description provided.