-
Notifications
You must be signed in to change notification settings - Fork 5
feat: extend GC reclone to support ledger repos (replace temporary LFS repair) #242
Copy link
Copy link
Open
Description
Summary
TriggerGC currently only handles team context repos. Ledger repos need the same blue-green GC reclone support to recover from corrupted state (missing LFS objects, diverged history, etc.).
Current state
- Team context GC:
TriggerGC()insync.godoes blue-green reclone — works well - Ledger LFS repair:
RepairMissingLFSObjects()ingitutil/lfs_repair.gois a temporary mechanism that replaces orphaned LFS pointers with empty stubs + setsallowincompletepush. This is a workaround, not a proper fix. - The real fix: A ledger GC that does fresh clone from remote + carries over unpushed local commits (session data). This is exactly what was done manually to fix the sageox/ox ledger today.
Why ledger GC is needed
After daemon GC reclone of team contexts, locally-committed LFS objects in the ledger that were never pushed are lost. The remote's pre-receive hook then rejects all future pushes because historical commits reference missing LFS OIDs. The temporary repair (lfs_repair.go) mitigates this but:
- Requires
lfs.allowincompletepushwhich only bypasses the local check - Server-side GitLab pre-receive hook still rejects if old OIDs are in push range
- History rewriting requires force push, which is blocked on protected branches
- The clean approach (fresh clone + replay local data) is what GC already does for team contexts
Implementation plan
- Extend
TriggerGC(or addTriggerLedgerGC) to support ledger repos - Blue-green reclone: fresh clone → identify unpushed local commits → cherry-pick/replay session data → swap
- The temporary
RepairMissingLFSObjectscan remain as a fallback for non-GC scenarios - Add
ox doctor --gc-ledgeror extend existing--gcflag
Related
- PR fix(lfs): auto-repair missing LFS pointers that block ledger push #241 — temporary LFS repair mechanism
- beads bd-7m3 — original issue for missing LFS pointers
Co-Authored-By: SageOx ox@sageox.ai
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels