Skip to content

fix(worktrees): prevent session-aware GC regressions - #107989

Merged
steipete merged 1 commit into
mainfrom
codex/pr-104146-regression-tests
Jul 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/pr-104146-regression-tests

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #104108
Supersedes #104146 because GitHub rejected maintainer writes to its fork branch.

What Problem This Solves

Fixes an issue where manual managed-worktree cleanup could delete an idle-expired worktree while its owning session was still active. The production correction now exists on main through #106224, but the invariant was not pinned at every cleanup entry point, and the original contributor PR could no longer be updated by maintainers.

Why This Change Was Made

This test-only replacement preserves current main's cleanup-limit implementation and adds focused regression coverage. Scheduled maintenance, the worktrees.gc RPC, and the CLI command must all pass the same Gateway-owned session activity predicate. The predicate tests cover recent, stale, unsupported-owner, missing-session, and unreadable-session state.

The commit preserves RickLin's contribution with a co-author trailer.

User Impact

No new runtime behavior. The existing session-worktree data-loss fix now has durable coverage across every production GC caller.

Evidence

  • Blacksmith Testbox through Crabbox: tbx_01kxhxzkkpfhgda1tx0qfrky74 (run 29387245149).
  • Targeted formatting: four files clean.
  • Focused tests: 35/35 passed across CLI and Gateway suites.
  • check:changed: green, including core-test tsgo and changed-file lint.
  • Autoreview: clean on the final patch after each main rebase; no accepted or actionable findings.
  • Patch identity remained unchanged across the final rebases.

AI-assisted maintainer rewrite. The original PR, current main implementation, callers, service contract, sibling worktree protections, and tests were reviewed directly.

@steipete steipete self-assigned this Jul 15, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: S maintainer Maintainer-authored PR labels Jul 15, 2026
@steipete
steipete force-pushed the codex/pr-104146-regression-tests branch 2 times, most recently from 3dbef04 to 86f6efa Compare July 15, 2026 04:26
@steipete
steipete force-pushed the codex/pr-104146-regression-tests branch from 86f6efa to 04233d6 Compare July 15, 2026 04:53
@steipete
steipete merged commit 56ff612 into main Jul 15, 2026
91 checks passed
@steipete
steipete deleted the codex/pr-104146-regression-tests branch July 15, 2026 04:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

worktrees.gc RPC handler omits the isOwnerActive liveness callback, so a manual gc removes a live session's worktree

1 participant