fix: retry raced Lance branch enumeration - #514
Merged
aaltshuler merged 3 commits intoAug 18, 2026
Conversation
azimafroozeh
marked this pull request as ready for review
August 15, 2026 20:55
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
|
Closes #515. |
aaltshuler
force-pushed
the
branch-refs-toctou-typed-conflict
branch
from
August 17, 2026 20:52
496188b to
67dcfe4
Compare
aaltshuler
force-pushed
the
branch-refs-toctou-typed-conflict
branch
from
August 18, 2026 21:58
67dcfe4 to
1ffb2de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Lance enumerates named branches by listing
_refs/branches/and then reading every listed ref. If a branch is deleted between those reads, the otherwise read-only enumeration can fail withNotFound.This change retries only that read-only enumeration, with a fixed limit of three total attempts. It does not turn a storage error into permission to replay the enclosing operation, and it does not introduce a new HTTP or OpenAPI error contract. Every production
Dataset::list_branches()call now goes through the same helper.Backing issue / RFC
The retry boundary is aligned with RFC-038: the engine retries the known effect-free read locally instead of exposing a generic whole-operation retry signal.
Checklist
docs/dev/invariants.mdLocal verification
cargo fmt --all --check— passedscripts/check-agents-md.sh— passedcargo test -p omnigraph-engine --locked --lib branch_control::tests -- --nocapture— 10 passedcargo test -p omnigraph-engine --locked --test forbidden_apis— 18 passedcargo clippy -p omnigraph-engine --all-targets --locked -- -D warnings -W clippy::dbg_macro— passedNotes for reviewers
The regression test uses Lance's
file-object-store://provider and an object-store wrapper to physically delete a ref after it has been listed but before Lance reads it. It proves that the next attempt performs a fresh listing and succeeds. A second test holds the ref in a repeatedNotFoundstate and proves the exact three-attempt bound and final substrate error.There is intentionally no 409 mapping or instruction for callers to retry an effectful operation. Repeated churn escapes through the ordinary storage-error path for the owning operation to classify.
Greptile Summary
The PR centralizes Lance branch enumeration behind a bounded, read-only retry that handles refs deleted between listing and reading.
NotFoundenumeration failures up to three total attempts.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Dataset::list_branchesproduction call site.Sequence Diagram
sequenceDiagram participant Caller participant Helper as list_branch_contents participant Lance participant Store as Object store Caller->>Helper: enumerate branches loop At most three attempts Helper->>Lance: Dataset::list_branches() Lance->>Store: list _refs/branches/ Store-->>Lance: listed refs Lance->>Store: read each ref alt Ref disappears after listing Store-->>Lance: NotFound Lance-->>Helper: NotFound Helper->>Helper: yield and retry else Enumeration succeeds Store-->>Lance: branch contents Lance-->>Helper: branch map Helper-->>Caller: branch map else Other error or final NotFound Lance-->>Helper: substrate error Helper-->>Caller: OmniError::Lance end endReviews (3): Last reviewed commit: "test(branch): guard enumeration retry bo..." | Re-trigger Greptile
Context used: