Skip to content

Session Handoff [agent-cleanup]: Cleanup Script Landed in #3186 and Hub Clone Swept, Skill Wiring Next #3187

Closed

Description

@ptr727

Next steps, in priority order

  1. PR 2 for Script the Local Half of Post-Merge Cleanup in pr_review.py cleanup #3184: point every skill that creates or finishes a worktree at the new commands. cleanup <n> --repo O/R --checkout <primary> replaces the raw local git steps. cleanup --sweep --repo O/R --checkout <primary> [--apply] covers what crashed or abandoned sessions leave behind. The surfaces:

    • repo-worktree "Listing and Cleanup";
    • drive-pr "The Drive Loop" step 4;
    • merge-and-release step 8;
    • backlog-burndown "Cleanup Is the Orchestrator's";
    • pr-review-conduct's post-merge line;
    • unattended-handoff, whose worker has no cleanup step at all;
    • resync-a-repo and audit-a-repo, whose hub-reach worktrees are never removed.

    Done means every surface names the command instead of raw git worktree remove / git branch -D / git push --delete, the generated skill trees are rebuilt with scripts/build_dist.py, and the PR is merged to develop. Edit under skill-lifecycle, and read scripts/README.md's cleanup paragraph for the exact contract.

  2. Re-measure the related issues against the tree once PR 2 lands, and close or narrow each with evidence:

  3. Promote develop to main with both PRs, where the "Closes Script the Local Half of Post-Merge Cleanup in pr_review.py cleanup #3184" line belongs, since closing refs register only on default-branch PRs.

  4. Optionally sweep the other fleet primaries (for example Financial-Modeling) with cleanup --sweep --repo <owner/name> --checkout <its primary>: a dry run first, --apply on the maintainer's go-ahead.

External blockers

None.

Internal dependencies

  • Step 2 follows step 1, since several of those issues are closed by the skill text, not the script.
  • Step 3 follows step 1, so one promotion carries both PRs.

State

  • #3186 merged to develop as 2f047fa. No release was dispatched.
  • Its worktree, local branch and remote branch were removed by the new cleanup 3186 --checkout, the first real use of the local half.
  • The hub primary is clean on develop at origin/develop.
  • cleanup --sweep --apply ran on the hub primary:
    • removed 39 worktrees, 19 local branches with their 18 merged remote branches, and 4 stale entries;
    • left 4 detached Financial-Modeling hub copies that live sessions were using, kept by the 24h rule;
    • re-derive the current state with git worktree list and git branch.
  • Script the Local Half of Post-Merge Cleanup in pr_review.py cleanup #3184 is open, with a comment correcting its premise.

The parked decision queue

0 issues carry decision in this repository.

What the last round did

  • Landed #3186: pr_review.py cleanup --checkout, the local half, and cleanup --sweep, with the scripts/README.md contract.
  • Corrected Script the Local Half of Post-Merge Cleanup in pr_review.py cleanup #3184's premise in a comment. gh-write-guard allows git branch -D and an unforced git worktree remove against a primary. The real blocker is that only python3 scripts/pr_review.py:* is on the permission allowlist.

What not to repeat

  • Script the Local Half of Post-Merge Cleanup in pr_review.py cleanup #3184's helper-worktree route is unnecessary. The script runs git itself, so the guard never sees those calls.
  • The local strict-review passes on this new code took nine passes to reach zero findings. Each round's fixes produced the next round's edge cases.
    • The per-push edit budget, with remaining findings listed in the PR body, is what let the PR keep moving.
    • Copilot's single round raised the same findings the body already listed.

New learnings

  • git worktree prune --expire ages a prunable entry by its index file's mtime, not its gitdir file. This is recorded in CleanupSweep.entry_hours.
  • scripts/pr_review.py already fails to import on Python 3.11, because of PEP 695 syntax that predates this round. A 3.11-only finding against it is moot.

Activity

  1. added
    handoffA link in the session handoff chain, one open issue per track
    on Oct 17, 2026
  2. ptr727 commented on Oct 17, 2026

    @ptr727
    OwnerAuthor

    Lane closed out: scripted cleanup shipped in 2.0.1083

    Every next step this link named is done. What remains is tracked in its own issues, so the agent-cleanup track closes with no successor.

    What landed

    Still open, each in its own issue

    What not to repeat

    • Promotion review of Script the Local Half of Post-Merge Cleanup and Sweep Finished Worktrees in pr_review.py #3186's code found three more items after nine local passes. Two were declined with evidence: an absent-ref race that GitHub's own branch-deletion behavior rules out, and a non-finite --min-age-hours, which is trusted input. One was real and fixed in Sweep a Pruned Worktree Entry's Branch in the Same Run in pr_review.py #3190. Expect the promotion round to keep finding edges in new cleanup code, and judge each against "Trust Boundaries and Hardening Effort" rather than hardening by reflex.
    • In skill text describing cleanup, every qualifier about its outcome ("returns the base clone", "every refusal before anything is deleted", "leaves its worktree standing") drew a finding. Stating the bare instruction and pointing at repo-worktree "Listing and Cleanup" is what converged.
    • git branch -d falls back to judging against HEAD when the upstream ref is gone, so it refuses a promotion branch that was merged only into main. Such a branch is left for --sweep, which reads origin/main containment.

    Parked decision queue

    0 issues carry decision in this repository.

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

    handoffA link in the session handoff chain, one open issue per track

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions