CB-586: prune refs/wip/* whose tree is reachable from main and older than 24h #108

Closed
agent wants to merge 0 commits from worker/cb586-10500c-1 into main
Member

CB-586: nothing ever pruned refs/wip/*, so CB-578 stage C snapshots pin their whole trees forever.

This adds the decided retention rule (reachability + 24h age floor) to GitWorktrees and drives it from the existing SessionReaper loop:

  • A snapshot ref is deleted only when BOTH hold: its commit's tree content is already reachable from main, and the ref is older than 24h.
  • Reachability is the safety floor: a snapshot not reachable from main is the last copy of a worker's work and is never deleted automatically (proved by test).
  • Every deletion logs the ref name and commit sha so it is recoverable from the reflog.
  • The /members response now carries wipRefs{count,costBytes} — operator census without shelling into the repo (chosen surface for criterion 4).

Scope: session package + tests; the /members field and reaper wiring are the only touches outside.

Build: mvn -f bridged/pom.xml clean install -> Tests run: 813, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS (unpiped).

CB-586: nothing ever pruned refs/wip/*, so CB-578 stage C snapshots pin their whole trees forever. This adds the decided retention rule (reachability + 24h age floor) to GitWorktrees and drives it from the existing SessionReaper loop: - A snapshot ref is deleted only when BOTH hold: its commit's tree content is already reachable from main, and the ref is older than 24h. - Reachability is the safety floor: a snapshot not reachable from main is the last copy of a worker's work and is never deleted automatically (proved by test). - Every deletion logs the ref name and commit sha so it is recoverable from the reflog. - The /members response now carries wipRefs{count,costBytes} — operator census without shelling into the repo (chosen surface for criterion 4). Scope: session package + tests; the /members field and reaper wiring are the only touches outside. Build: mvn -f bridged/pom.xml clean install -> Tests run: 813, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS (unpiped).
agent added 1 commit 2026-08-16 19:06:54 +02:00
CB-586: prune refs/wip/* older than 24h whose tree is reachable from main
CI / build (pull_request) Successful in 1m13s
CI / contract (pull_request) Successful in 1m21s
0efe1567c0
Add the CB-586 retention rule to GitWorktrees and drive it from the reaper:
a snapshot is deleted only when its tree content is already reachable from
main AND the ref is older than 24h. Reachability keeps the last copy of a
worker's work; the age floor stops a fresh snapshot being swept while a
lead is still looking at it. Every deletion logs the ref name and commit
sha so it is recoverable from the reflog. The /members response gains a
wipRefs{count,costBytes} census the operator can read without shelling
into the repo.
Owner

Merged locally into main and pushed — merge commit 15ff6bc, plus a follow-up fix at b14b66a. Gitea cannot mark a locally merged PR as merged, so I am closing it by hand — merged, not rejected.

The review detail is on #67. The short version: the seam was right and I checked it against a real git repo, but the caller in SessionReaper never reached it. lastWipSweepNanos started at Long.MIN_VALUE, now - Long.MIN_VALUE overflowed, and the interval gate returned early on every iteration forever. Your tests all passed because they call SessionManager.sweepWipRefs directly, which walks around the gate. Fixed with a sweptOnce flag and a test that asserts through the loop.

860 tests, mvn clean install, BUILD SUCCESS. Good work — the safety rule itself held up under every case I threw at it.

Merged locally into `main` and pushed — merge commit `15ff6bc`, plus a follow-up fix at `b14b66a`. Gitea cannot mark a locally merged PR as merged, so I am closing it by hand — **merged, not rejected**. The review detail is on #67. The short version: the seam was right and I checked it against a real git repo, but the caller in `SessionReaper` never reached it. `lastWipSweepNanos` started at `Long.MIN_VALUE`, `now - Long.MIN_VALUE` overflowed, and the interval gate returned early on every iteration forever. Your tests all passed because they call `SessionManager.sweepWipRefs` directly, which walks around the gate. Fixed with a `sweptOnce` flag and a test that asserts through the loop. 860 tests, `mvn clean install`, BUILD SUCCESS. Good work — the safety rule itself held up under every case I threw at it.
ltms closed this pull request 2026-08-16 20:14:21 +02:00
Some checks are pending
CI / build (pull_request) Successful in 1m13s
CI / contract (pull_request) Successful in 1m21s

Pull request closed

Sign in to join this conversation.