HYGIENE: delete merged branches/worktrees, close done issues, gc (no history rewrite) #548

Open
opened 2026-09-30 17:46:00 +00:00 by kayg · 3 comments
Owner

Owner request (2026-09-30): "Close stale/completed issues, close and delete done branches."

State:

  • .git is about 793 MB.
  • There are 92 worktrees under ~/Developer/calternal-wt/.
  • There are 154 local and 173 remote branches whose tips are already in origin/dev, plus about 30 idle job branches older than 24 h whose content may be merged through conflict-resolved merges (so --merged does not show them).
    Job (hygiene, careful, reversible where possible):
  1. Remote and local branches whose tip is an ancestor of origin/dev: delete them (git push origin --delete, git branch -d). Exclude dev, main, and any branch checked out in a worktree whose job is running (systemctl --user list-units 'codex-cal-*') or queued (~/.local/state/codex-jobs/calternal/pending/, paused-queue.txt).
  2. Idle worktrees (no running or queued job, not named in paused-queue.txt, not merge-*, deploy, release-build), for each one:
    • Decide "content merged" when git merge-tree --write-tree origin/dev <branch> equals the origin/dev tree, or when every non-merge commit's patch-id is in dev (git cherry origin/dev <branch> shows no +), or when its issue is closed and a diff review shows the remaining delta is only merge noise.
    • Content merged → git worktree remove (it must be clean; never --force on a dirty one) + delete the branch (local and remote).
    • Not merged → list it in the report with: its issue, what is unmerged (diffstat), its age, and a recommendation (merge, rebuild, or abandon). Do not delete unmerged work; the orchestrator decides.
    • Detached scratch worktrees older than 24 h (verify-mac*, gates, *-before-src, *-client-build, bg-422-prefx, mac-verify-pre356): remove them if clean.
  3. Issues: for each open issue, if the issue's fix is in origin/dev (its job branch merged, or its final report says done and the commits are in dev) and nothing in the issue body remains open, close it with a one-line comment naming the merge commit. If only part is done, comment on what remains; do not close. Never close issues that are grills or are marked OPEN/decision, and never close the ones in paused-queue.txt.
  4. Run git gc --prune=now at the end and report the .git size before and after. Do not rewrite history (the screenshot purge needs the owner's approval).
    Final report: counts (branches deleted, worktrees removed, issues closed) with lists, and the unmerged table.
## Owner request (2026-09-30): "Close stale/completed issues, close and delete done branches." **State:** - `.git` is about 793 MB. - There are 92 worktrees under `~/Developer/calternal-wt/`. - There are 154 local and 173 remote branches whose tips are already in `origin/dev`, plus about 30 idle job branches older than 24 h whose content may be merged through conflict-resolved merges (so `--merged` does not show them). **Job (hygiene, careful, reversible where possible):** 1. **Remote and local branches whose tip is an ancestor of `origin/dev`:** delete them (`git push origin --delete`, `git branch -d`). Exclude `dev`, `main`, and any branch checked out in a worktree whose job is running (`systemctl --user list-units 'codex-cal-*'`) or queued (`~/.local/state/codex-jobs/calternal/pending/`, `paused-queue.txt`). 2. **Idle worktrees** (no running or queued job, not named in paused-queue.txt, not `merge-*`, `deploy`, `release-build`), for each one: - Decide "content merged" when `git merge-tree --write-tree origin/dev <branch>` equals the `origin/dev` tree, or when every non-merge commit's patch-id is in dev (`git cherry origin/dev <branch>` shows no `+`), or when its issue is closed and a diff review shows the remaining delta is only merge noise. - Content merged → `git worktree remove` (it must be clean; never `--force` on a dirty one) + delete the branch (local and remote). - Not merged → list it in the report with: its issue, what is unmerged (diffstat), its age, and a recommendation (merge, rebuild, or abandon). **Do not delete unmerged work**; the orchestrator decides. - Detached scratch worktrees older than 24 h (verify-mac*, gates, *-before-src, *-client-build, bg-422-prefx, mac-verify-pre356): remove them if clean. 3. **Issues:** for each open issue, if the issue's fix is in `origin/dev` (its job branch merged, or its final report says done and the commits are in dev) and nothing in the issue body remains open, close it with a one-line comment naming the merge commit. If only part is done, comment on what remains; do not close. Never close issues that are grills or are marked OPEN/decision, and never close the ones in `paused-queue.txt`. 4. Run `git gc --prune=now` at the end and report the `.git` size before and after. **Do not rewrite history** (the screenshot purge needs the owner's approval). Final report: counts (branches deleted, worktrees removed, issues closed) with lists, and the unmerged table.
Author
Owner

Started hygiene-548 on branch job/hygiene-548. Base: origin/dev cc25c441b7. Initial inventory found active jobs and a populated pending/paused queue; those branches will be excluded while I audit idle worktrees and issue completion evidence.

Started hygiene-548 on branch job/hygiene-548. Base: origin/dev cc25c441b7a974185622a1dee853cf38686d2b67. Initial inventory found active jobs and a populated pending/paused queue; those branches will be excluded while I audit idle worktrees and issue completion evidence.
Author
Owner

Forgejo #548 final report

Head: cc25c441b7a974185622a1dee853cf38686d2b67 (job/hygiene-548, clean; no commit made).

Cleanup counts

  • Deleted 122 local branches and 115 remote branches (237 refs total).
  • Removed 12 clean worktrees.
  • Closed 41 completed issues.
  • Added partial-progress comments to 35 open issues.
  • Preserved active, queued, paused, reserved, and non-ancestor branches/worktrees. The remote job/merge-round-2 ref reappeared during cleanup; after rechecking that it was an ancestor of origin/dev and no active/queued job matched it, it was deleted again. The local branch remains because the reserved /merge-web worktree checks it out.
  • Worktree inventory started at 100. Four job worktrees appeared while this sweep ran, and one nested scratch worktree disappeared during its own cleanup. The final observed inventory was 91.

Local branches deleted

calendar-r3, calendar-r4, job/a11y, job/ab-384-luna, job/ab-394-luna, job/admin-deny-483, job/agenda, job/ai-ui, job/analytics, job/app-pw-setup, job/ask-page, job/attach-427, job/authz-review, job/auto-scheme, job/backend-misc, job/bounce-425, job/break-editor, job/breakit-fixes, job/cal-followups, job/cal-grid, job/cal-switcher, job/caldav-apple, job/calendar-grid, job/change-feed, job/chips-416, job/cli-agent, job/collab-redo, job/composer-align, job/crossday-469, job/cursors, job/date-formats, job/docs-site, job/drag-end-418, job/dup-task, job/e2e-fix, job/e2e-green, job/editor-385, job/editor-modes, job/editor-undo, job/embed-bench, job/file-protocols, job/files-sel-keys, job/flaky-426, job/gestures, job/grid-resize, job/heif-hardening, job/hidden-420, job/hidden-activity, job/hunt-20260928, job/hunt-20260929, job/journal-dup, job/mac-verify, job/mail-m2, job/mail-threads, job/maple-mono, job/merge-batch, job/merge-round-0930, job/micro-motion, job/minical, job/money-format, job/money-numbers, job/money-research, job/money-review2, job/multiget-500, job/note-rewrite, job/notes-actions-research, job/notifications-ui, job/paste-467, job/per-user-index, job/photos-ui, job/popovers, job/purge-dos, job/push-hosts, job/quota, job/search-d, job/search-pad, job/search-palette, job/search-perf, job/search-perf-c, job/search-pill, job/search-rebuild, job/search-ui, job/select-align, job/selection-pills, job/send-fast, job/settings-card, job/settings-sections, job/share-edit, job/shortcuts, job/sidebar-headers, job/small-bugs-2, job/sweep-478, job/sync-root-guard, job/tabbar, job/tags, job/temp-index, job/touch-369, job/tz-days, job/ui-batch, job/ui-polish-354, job/ui-small-2, job/upload-scale, job/vault-health, job/voice-models, job/webmcp, job/xuser-472, job/xuser-audit, job/xuser-matrix, merge-batch, ui-polish-73, worktree-agent-a33eab04d814ffa19, worktree-agent-a415b6827d38a322a, worktree-agent-a442f0a0b4ebf09f7, worktree-agent-a4e148450fb2df7af, worktree-agent-a562917f09108097d, worktree-agent-a583f2e7e94a7555c, worktree-agent-a640c7af7e64db4be, worktree-agent-aa9937068caa8875e, worktree-agent-aaab58e5ba9b15ba9, worktree-agent-ac5763a033ac4a951, worktree-agent-acb013d7153e7920d, worktree-agent-acf3396274d93f045

Remote branches deleted

job/a11y, job/ab-384-luna, job/ab-394-luna, job/admin-deny-483, job/analytics, job/app-pw-setup, job/ask-page, job/asr-ab-489, job/attach-427, job/authz-review, job/auto-scheme, job/backend-misc, job/bg-422, job/bounce-425, job/break-editor, job/breakit-fixes, job/cal-followups, job/cal-grid, job/cal-switcher, job/caldav-apple, job/calendar-grid, job/change-feed, job/chips-416, job/cli-agent, job/collab-redo, job/composer-align, job/crossday-469, job/cursors, job/date-formats, job/docs-site, job/drag-end-418, job/dup-task, job/e2e-fix, job/e2e-green, job/editor-385, job/editor-modes, job/editor-undo, job/file-protocols, job/files-sel-keys, job/flaky-426, job/gestures, job/grid-resize, job/heif-hardening, job/hidden-420, job/hidden-activity, job/hunt-20260928, job/hunt-20260929, job/journal-dup, job/mac-verify, job/mail-m2, job/mail-threads, job/maple-mono, job/mcp-fast-492, job/merge-batch, job/merge-round-0930, job/merge-round-2, job/micro-motion, job/minical, job/money-format, job/money-numbers, job/money-research, job/money-review2, job/motion-477, job/multiget-500, job/note-rewrite, job/notes-actions-research, job/overflow-511, job/overflow-mid, job/overlay-title-487, job/paste-467, job/per-user-index, job/photos-470, job/popovers, job/purge-dos, job/push-hosts, job/quota, job/search-d, job/search-pad, job/search-palette, job/search-perf, job/search-perf-c, job/search-pill, job/search-rebuild, job/select-align, job/selection-pills, job/send-fast, job/settings-card, job/settings-hdr-482, job/settings-sections, job/share-edit, job/shortcuts, job/sidebar-headers, job/small-bugs-2, job/small-bugs-4, job/sweep-478, job/sync-root-guard, job/tabbar, job/tags, job/temp-index, job/theme-variants-506, job/touch-369, job/tz-days, job/ui-batch, job/ui-polish-354, job/ui-small-2, job/upload-scale, job/vault-health, job/voice-models, job/webcal-431, job/webmcp, job/week-header-508, job/xuser-472, job/xuser-audit, job/xuser-matrix, merge-scratch

Worktrees removed

admin-deny-483, attach-427, files-sel-keys, hidden-420, multiget-500, per-user-index, sweep-478, align-253/target/tmp/align-253-before-src, bg-422-prefx, mac-verify-pre356, modes-424/target/tmp/modes-424-client-build, verify-mac2

Issues closed

#1, #2, #3, #6, #7, #9, #10, #11, #12, #13, #15, #16, #17, #18, #19, #20, #21, #23, #27, #28, #29, #30, #33, #36, #40, #44, #47, #51, #52, #53, #60, #61, #62, #68, #72, #75, #77, #82, #431, #551, #553

Open issues with progress comments

#8, #14, #22, #32, #35, #37, #38, #39, #41, #42, #43, #48, #54, #56, #57, #58, #59, #63, #64, #65, #66, #69, #70, #71, #73, #76, #78, #204, #258, #265, #319, #331, #413, #490, #523

Paused issues and grills were left open. #54 remains open because the requested template creation UI is not present. #343 was in the paused queue and received no comment.

Unmerged idle work

Issue Worktree Age Remaining diff from origin/dev Recommendation
#413 agenda-413 34.9 h 16 files changed, 1340 insertions(+), 457 deletions(-) rebuild from current dev
#204 agent-conventions 108.9 h 1 file changed, 126 insertions(+) merge after research review
#253 align-253 19.9 h 52 files changed, 2045 insertions(+), 314 deletions(-) rebuild from current dev after the paused queue
#343 atomic-race 57.0 h 13 files changed, 938 insertions(+), 76 deletions(-) rebuild from current dev and rerun the regression after the paused queue
#457 caldav-stress 0.4 h 17 files changed, 3174 insertions(+), 6 deletions(-) rebuild from current dev and cherry-pick the useful stress/bench work
#341 documents-research 45.1 h 1 file changed, 335 insertions(+) abandon unless the grill is approved
#152 import-calternaljs 81.5 h 19 files changed, 2246 insertions(+), 460 deletions(-) rebuild from current dev if the importer is still wanted
#428 notes-imap-428 40.1 h 1 file changed, 344 insertions(+) merge after Phase 2 review
#342 paperless-import 59.3 h 1 file changed, 62 insertions(+) abandon because the issue is closed
#319 single-pills 62.8 h 26 files changed, 334 insertions(+), 338 deletions(-) rebuild from current dev and finish the scan
#490 siwc-490 19.9 h 1 file changed, 87 insertions(+) merge after research review
#523 upload-pill-523 12.5 h 10 files changed, 962 insertions(+), 70 deletions(-) merge after review

All 12 worktrees above were clean and were retained because their content is not merged. #457 is already closed; its sizeable stress/bench delta is still preserved for review. Paused #253 and #343 remain untouched. #341 is a grill. Closed-issue branches #152 and #342 remain because their deltas are unmerged.

Repository size and gates

.git measured 800M at the beginning of the sweep, 797M immediately before garbage collection, and 781M after git gc --prune=now.

Cargo cleanup output:

     Removed 1 file, 356B total

Rust/web gates: Not run: hygiene-only task; no source files changed. Web build output directories were absent. No source files changed and no commit was made.

# Forgejo #548 final report **Head:** `cc25c441b7a974185622a1dee853cf38686d2b67` (`job/hygiene-548`, clean; no commit made). ## Cleanup counts - Deleted 122 local branches and 115 remote branches (237 refs total). - Removed 12 clean worktrees. - Closed 41 completed issues. - Added partial-progress comments to 35 open issues. - Preserved active, queued, paused, reserved, and non-ancestor branches/worktrees. The remote `job/merge-round-2` ref reappeared during cleanup; after rechecking that it was an ancestor of `origin/dev` and no active/queued job matched it, it was deleted again. The local branch remains because the reserved `/merge-web` worktree checks it out. - Worktree inventory started at 100. Four job worktrees appeared while this sweep ran, and one nested scratch worktree disappeared during its own cleanup. The final observed inventory was 91. ### Local branches deleted `calendar-r3, calendar-r4, job/a11y, job/ab-384-luna, job/ab-394-luna, job/admin-deny-483, job/agenda, job/ai-ui, job/analytics, job/app-pw-setup, job/ask-page, job/attach-427, job/authz-review, job/auto-scheme, job/backend-misc, job/bounce-425, job/break-editor, job/breakit-fixes, job/cal-followups, job/cal-grid, job/cal-switcher, job/caldav-apple, job/calendar-grid, job/change-feed, job/chips-416, job/cli-agent, job/collab-redo, job/composer-align, job/crossday-469, job/cursors, job/date-formats, job/docs-site, job/drag-end-418, job/dup-task, job/e2e-fix, job/e2e-green, job/editor-385, job/editor-modes, job/editor-undo, job/embed-bench, job/file-protocols, job/files-sel-keys, job/flaky-426, job/gestures, job/grid-resize, job/heif-hardening, job/hidden-420, job/hidden-activity, job/hunt-20260928, job/hunt-20260929, job/journal-dup, job/mac-verify, job/mail-m2, job/mail-threads, job/maple-mono, job/merge-batch, job/merge-round-0930, job/micro-motion, job/minical, job/money-format, job/money-numbers, job/money-research, job/money-review2, job/multiget-500, job/note-rewrite, job/notes-actions-research, job/notifications-ui, job/paste-467, job/per-user-index, job/photos-ui, job/popovers, job/purge-dos, job/push-hosts, job/quota, job/search-d, job/search-pad, job/search-palette, job/search-perf, job/search-perf-c, job/search-pill, job/search-rebuild, job/search-ui, job/select-align, job/selection-pills, job/send-fast, job/settings-card, job/settings-sections, job/share-edit, job/shortcuts, job/sidebar-headers, job/small-bugs-2, job/sweep-478, job/sync-root-guard, job/tabbar, job/tags, job/temp-index, job/touch-369, job/tz-days, job/ui-batch, job/ui-polish-354, job/ui-small-2, job/upload-scale, job/vault-health, job/voice-models, job/webmcp, job/xuser-472, job/xuser-audit, job/xuser-matrix, merge-batch, ui-polish-73, worktree-agent-a33eab04d814ffa19, worktree-agent-a415b6827d38a322a, worktree-agent-a442f0a0b4ebf09f7, worktree-agent-a4e148450fb2df7af, worktree-agent-a562917f09108097d, worktree-agent-a583f2e7e94a7555c, worktree-agent-a640c7af7e64db4be, worktree-agent-aa9937068caa8875e, worktree-agent-aaab58e5ba9b15ba9, worktree-agent-ac5763a033ac4a951, worktree-agent-acb013d7153e7920d, worktree-agent-acf3396274d93f045` ### Remote branches deleted `job/a11y, job/ab-384-luna, job/ab-394-luna, job/admin-deny-483, job/analytics, job/app-pw-setup, job/ask-page, job/asr-ab-489, job/attach-427, job/authz-review, job/auto-scheme, job/backend-misc, job/bg-422, job/bounce-425, job/break-editor, job/breakit-fixes, job/cal-followups, job/cal-grid, job/cal-switcher, job/caldav-apple, job/calendar-grid, job/change-feed, job/chips-416, job/cli-agent, job/collab-redo, job/composer-align, job/crossday-469, job/cursors, job/date-formats, job/docs-site, job/drag-end-418, job/dup-task, job/e2e-fix, job/e2e-green, job/editor-385, job/editor-modes, job/editor-undo, job/file-protocols, job/files-sel-keys, job/flaky-426, job/gestures, job/grid-resize, job/heif-hardening, job/hidden-420, job/hidden-activity, job/hunt-20260928, job/hunt-20260929, job/journal-dup, job/mac-verify, job/mail-m2, job/mail-threads, job/maple-mono, job/mcp-fast-492, job/merge-batch, job/merge-round-0930, job/merge-round-2, job/micro-motion, job/minical, job/money-format, job/money-numbers, job/money-research, job/money-review2, job/motion-477, job/multiget-500, job/note-rewrite, job/notes-actions-research, job/overflow-511, job/overflow-mid, job/overlay-title-487, job/paste-467, job/per-user-index, job/photos-470, job/popovers, job/purge-dos, job/push-hosts, job/quota, job/search-d, job/search-pad, job/search-palette, job/search-perf, job/search-perf-c, job/search-pill, job/search-rebuild, job/select-align, job/selection-pills, job/send-fast, job/settings-card, job/settings-hdr-482, job/settings-sections, job/share-edit, job/shortcuts, job/sidebar-headers, job/small-bugs-2, job/small-bugs-4, job/sweep-478, job/sync-root-guard, job/tabbar, job/tags, job/temp-index, job/theme-variants-506, job/touch-369, job/tz-days, job/ui-batch, job/ui-polish-354, job/ui-small-2, job/upload-scale, job/vault-health, job/voice-models, job/webcal-431, job/webmcp, job/week-header-508, job/xuser-472, job/xuser-audit, job/xuser-matrix, merge-scratch` ### Worktrees removed `admin-deny-483`, `attach-427`, `files-sel-keys`, `hidden-420`, `multiget-500`, `per-user-index`, `sweep-478`, `align-253/target/tmp/align-253-before-src`, `bg-422-prefx`, `mac-verify-pre356`, `modes-424/target/tmp/modes-424-client-build`, `verify-mac2` ### Issues closed `#1, #2, #3, #6, #7, #9, #10, #11, #12, #13, #15, #16, #17, #18, #19, #20, #21, #23, #27, #28, #29, #30, #33, #36, #40, #44, #47, #51, #52, #53, #60, #61, #62, #68, #72, #75, #77, #82, #431, #551, #553` ### Open issues with progress comments `#8, #14, #22, #32, #35, #37, #38, #39, #41, #42, #43, #48, #54, #56, #57, #58, #59, #63, #64, #65, #66, #69, #70, #71, #73, #76, #78, #204, #258, #265, #319, #331, #413, #490, #523` Paused issues and grills were left open. #54 remains open because the requested template creation UI is not present. #343 was in the paused queue and received no comment. ## Unmerged idle work | Issue | Worktree | Age | Remaining diff from `origin/dev` | Recommendation | |---|---|---:|---|---| | #413 | `agenda-413` | 34.9 h | 16 files changed, 1340 insertions(+), 457 deletions(-) | rebuild from current dev | | #204 | `agent-conventions` | 108.9 h | 1 file changed, 126 insertions(+) | merge after research review | | #253 | `align-253` | 19.9 h | 52 files changed, 2045 insertions(+), 314 deletions(-) | rebuild from current dev after the paused queue | | #343 | `atomic-race` | 57.0 h | 13 files changed, 938 insertions(+), 76 deletions(-) | rebuild from current dev and rerun the regression after the paused queue | | #457 | `caldav-stress` | 0.4 h | 17 files changed, 3174 insertions(+), 6 deletions(-) | rebuild from current dev and cherry-pick the useful stress/bench work | | #341 | `documents-research` | 45.1 h | 1 file changed, 335 insertions(+) | abandon unless the grill is approved | | #152 | `import-calternaljs` | 81.5 h | 19 files changed, 2246 insertions(+), 460 deletions(-) | rebuild from current dev if the importer is still wanted | | #428 | `notes-imap-428` | 40.1 h | 1 file changed, 344 insertions(+) | merge after Phase 2 review | | #342 | `paperless-import` | 59.3 h | 1 file changed, 62 insertions(+) | abandon because the issue is closed | | #319 | `single-pills` | 62.8 h | 26 files changed, 334 insertions(+), 338 deletions(-) | rebuild from current dev and finish the scan | | #490 | `siwc-490` | 19.9 h | 1 file changed, 87 insertions(+) | merge after research review | | #523 | `upload-pill-523` | 12.5 h | 10 files changed, 962 insertions(+), 70 deletions(-) | merge after review | All 12 worktrees above were clean and were retained because their content is not merged. #457 is already closed; its sizeable stress/bench delta is still preserved for review. Paused #253 and #343 remain untouched. #341 is a grill. Closed-issue branches #152 and #342 remain because their deltas are unmerged. ## Repository size and gates `.git` measured 800M at the beginning of the sweep, 797M immediately before garbage collection, and 781M after `git gc --prune=now`. Cargo cleanup output: ```text Removed 1 file, 356B total ``` Rust/web gates: `Not run: hygiene-only task; no source files changed.` Web build output directories were absent. No source files changed and no commit was made.
Author
Owner

Final-state correction to the report above:

  • job/merge-round-2 reappeared remotely after its first deletion. It was absent from active services, pending jobs, and the paused queue. /merge-web was clean, so I kept that reserved worktree and detached it at its existing HEAD (aa372eef6c9312403f59a65d5b90cb3648ff52ed), then deleted the local and remote branch refs and pruned the stale remote-tracking ref.
  • Correct totals: 123 local branches and 115 unique remote branches deleted. The remote list above already includes job/merge-round-2; add it to the local list. /merge-web remains clean and detached.
  • I reran git gc --prune=now after the final ref cleanup. .git was 781M before and 781M after. The hygiene worktree remains clean at cc25c441b7a974185622a1dee853cf38686d2b67; the inventory still has 91 worktrees.
Final-state correction to the report above: - `job/merge-round-2` reappeared remotely after its first deletion. It was absent from active services, pending jobs, and the paused queue. `/merge-web` was clean, so I kept that reserved worktree and detached it at its existing HEAD (`aa372eef6c9312403f59a65d5b90cb3648ff52ed`), then deleted the local and remote branch refs and pruned the stale remote-tracking ref. - Correct totals: 123 local branches and 115 unique remote branches deleted. The remote list above already includes `job/merge-round-2`; add it to the local list. `/merge-web` remains clean and detached. - I reran `git gc --prune=now` after the final ref cleanup. `.git` was 781M before and 781M after. The hygiene worktree remains clean at `cc25c441b7a974185622a1dee853cf38686d2b67`; the inventory still has 91 worktrees.
Sign in to join this conversation.
No labels
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
kayg/calternal#548
No description provided.