fix(server): clean up failed checkpoint writes - #9809
Open
im-kvijay wants to merge 3 commits into
Open
Conversation
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR rewrites the production checkpoint-capture path to isolate and manually publish Git objects, with new interruption, concurrency, permission, cleanup, and error-propagation behavior. Despite strong fault-injection and integration coverage, this is a substantial runtime refactor affecting shared repository state and merits human review. You can add or adjust custom eligibility rules. Learn more. |
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.
Why
Checkpoint capture writes new objects into the shared repository store. Failure, timeout, or interruption during staging can leave temporary packs that accumulate across attempts, as reported in #3646.
Proposal: #9808
Closes discussions
What Changed
Capture now owns a scoped directory for its index and new objects, reads existing objects through Git alternates, and publishes completed objects before updating the checkpoint ref. Failed staging cleans only its own storage. Snapshot contents and the user's index are preserved.
Git's temporary-object directory prefix allows normal pruning to reclaim stale crash leftovers.
Validation
Limits
The 30-second deadline remains: this addresses temporary-pack accumulation, not long captures timing out. Filesystem failure between pack and index publication can leave an unindexed pack requiring cleanup. Private storage adds one alternates level, so repositories near Git's nesting limit can fail capture.
Created with GPT-6 in Codex.
Note
Medium Risk
Changes how checkpoint objects are written and published in the live Git object store, but scoped temp dirs, index isolation, and broad regression tests reduce the risk of corrupting user repos or leaving stale packs.
Overview
Checkpoint capture no longer stages new Git objects directly into the shared
.git/objectsstore.GitVcsDriver.captureCheckpointwrites to a scoped temp object database (under the repo objects path, with alternates for existing objects), then publishes loose objects and packs into the real store and updates the checkpoint ref in an uninterruptible block so interruption mid-flight does not leave partial refs or orphan temp packs.Filesystem failures during publication surface as new
VcsCheckpointStorageError(contracts + GitLab CLI error mapping). The old git-common-dir random temp-index approach is removed.Tests add fault-injection coverage (failure, timeout, interruption, rename collisions, shared-repo permissions) plus integration cases for control characters in paths, large packed files without touching the user index, and linked worktrees.
Reviewed by Cursor Bugbot for commit 0a14f55. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Rework
GitVcsDriver.captureCheckpointto clean up failed checkpoint writesVcsCheckpointStorageErrorto vcs.ts and maps it in GitLabCli.tsGitVcsDriver.captureCheckpointremoves the old random temporary-index path generation andgit-common-dirhelper; filesystem publication failures now throwVcsCheckpointStorageErrorMacroscope summarized 0a14f55.