Skip to content

Harden branch recovery and cleanup retention#344

Merged
aaltshuler merged 2 commits into
mainfrom
codex/rfc-022-branch-control-recovery
Jul 11, 2026
Merged

Harden branch recovery and cleanup retention#344
aaltshuler merged 2 commits into
mainfrom
codex/rfc-022-branch-control-recovery

Conversation

@aaltshuler

@aaltshuler aaltshuler commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • centralize Lance native branch create/delete classification around authoritative BranchContents and exact BranchIdentifier observations
  • reclaim clone-only create residue, classify lost acknowledgements, fence delete/recreate ABA, and enforce path-prefix-disjoint live branch names at the lower control chokepoint
  • preserve a leaf-first recovery path for legacy ancestor/child overlaps without deleting descendant storage
  • make version cleanup preserve exact main-table versions inherited by live lazy graph branches, derive --keep cutoffs from available versions, and fail closed before GC on unresolved recovery, unopenable pins, or uncovered main HEAD drift
  • align RFC-022, RFC-025, architecture, testing, and user/operator documentation with the shipped behavior

Why

Lance branch creation first materializes a shallow clone and then publishes the authoritative ref; deletion removes the ref before reclaiming the tree. An interrupted or ambiguously acknowledged native operation therefore needs classification from fresh authority rather than blind retry or cleanup.

Separately, a lazy OmniGraph branch can inherit an exact main-table version without owning a native Lance table branch. Cleanup previously had no native ref from which to discover that live pin and could prune it.

Impact

Branch controls remain native Lance operations and do not manufacture graph commits or a second branch authority. Same-process operations are serialized through the existing schema → branch → table gate envelope.

Cleanup can retain additional versions required by live branches and now refuses unsafe graph-wide preflight states before deleting any version. Per-table GC remains fault-isolated after that preflight.

Validation

  • cargo test --workspace --locked
  • cargo test -p omnigraph-engine --features failpoints --test failpoints --locked — 82 passed
  • branching suite — 34 passed
  • maintenance suite — 30 passed
  • branch-control unit truth cells — 8 passed
  • scripts/check-agents-md.sh
  • git diff --check

Open in Devin Review

Greptile Summary

This PR hardens branch recovery and cleanup retention across OmniGraph. The main changes are:

  • Native Lance branch create/delete classification through BranchContents authority.
  • Prefix-disjoint branch names and safer path-child cleanup handling.
  • Recovery updates for clone-only branch residue and rollback cleanup ordering.
  • Cleanup retention for live lazy branch pins and unsafe preflight states.
  • Updated tests and docs for the new recovery and maintenance behavior.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
crates/omnigraph/src/db/manifest/recovery.rs Recovery now defers legacy path-child cleanup explicitly and blocks rollback when owned effects cannot be cleaned safely.
crates/omnigraph/src/branch_control.rs New branch-control helpers classify native create/delete outcomes from authoritative Lance branch metadata.
crates/omnigraph/src/db/omnigraph/optimize.rs Cleanup now accounts for live lazy branch pins and fails before GC when protected versions cannot be classified.

Reviews (2): Last reviewed commit: "Fail closed on blocked partial rollback" | Re-trigger Greptile

Context used:

  • Context used - AGENTS.md (source)
  • Context used - CLAUDE.md (source)

Comment thread crates/omnigraph/src/db/manifest/recovery.rs Outdated

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@aaltshuler aaltshuler merged commit bd4c614 into main Jul 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant