Repository navigation
replicate: create missing refs in batches when the target refuses the pack - #132
Merged
Merged
Conversation
TestBootstrap_GitHTTPBackendBatchedBranch and TestBootstrap_GitHTTPBackendBatchedBranchResume assumed a run executes exactly the batches it planned. The plan sizes checkpoints from an estimate per commit. These tests commit blobs bigger than it, so pushes split further against the budget as they go: planned 2, ran 6. The bootstrap succeeds; only the assertions were wrong. The fresh run now checks that it ran at least the planned batches. The resume test compares against a full run to a second target, not the plan's checkpoint count. The test:git-http-backend task matched neither test, so nothing ran them. It now runs every TestBootstrap_GitHTTPBackend test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M617CJPZ8BW66V7GZNWYTFRH
… pack Replicate routes to batched bootstrap only when every desired ref is missing on the target. A bootstrap cut short after the trunk landed leaves the next run on plain replicate, which sends every missing branch in one pack. A target with a request body limit refuses it, and every retry sends the same pack again, so the repository never finishes mirroring. Since ENT-3617 lands the trunk first, a timeout leads here. When the target refuses replicate's pack for its size or a push deadline, replicate re-reads the target's refs and creates the missing ones with batched bootstrap. Updates and deletes then go out as their own replicate push. The run reports relay reason replicate-pack-rejected. Bootstrap supports this in two ways: - Params.RejectedPush starts it in batched mode, so it does not re-send the pack the target just refused. - With no trunk among the refs to create, it plans every branch in one commit-graph fetch against the refs already on the target. A branch whose history the target holds is created without a pack. Resume markers stay out of the haves, so an interrupted branch still resumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M617CW1E88HRSS3TXE1WT2EW
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e04187d. Configure here.
- With no trunk among the refs to create, the commit-graph fetch stops where the target's haves begin, and planning had no stop set. The first-parent walk ends at a missing parent, but the topological walk fails on one, so --bootstrap-strategy=topo could not plan. The parents the fetch named but did not send are now the stop set. - The push of updates and deletes after the batched creates offered only the target refs from the start of the run as haves. An update onto a branch bootstrap just created re-sent that branch's history and could hit the same body limit. It now re-reads the target's refs first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M618HAN7QH02SVEA33TMQYGQ
nodo
approved these changes
Oct 28, 2026
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.

https://entire.com/gh/entireio/-/trails/2659/changes/git-sync/2
Follow-up to #130 (ENT-3617). After a bootstrap is cut short, replicate now creates the missing refs in batches instead of re-sending one oversized pack on every retry.
Problem
Replicate routes to batched bootstrap only when every desired ref is missing on the target (
replicateBootstrapRoute). Once any ref exists, the run goes down plain replicate, which fetches one pack for everything missing and pushes it in one request. Plain replicate has no recovery from a target body limit: it fails with the 413, and the next run sends the same pack again.#130 pushes the trunk first, so a bootstrap that times out leaves the trunk on the target. The next run then takes plain replicate with every other branch in one pack. On a large repo that pack is over the target's body limit, so the repository never finishes mirroring.
Reproduced with real
git http-backendand a 1 MB body limit on the target, using the mirror-pipeline worker's policy (replicate, prune, tags): an empty target bootstraps fine, while a target holding only the trunk fails on every run withhttp 413 … request body too large.Change
bootstrap-batchwith the new reasonreplicate-pack-rejected.bootstrap.Params.RejectedPushstarts bootstrap in batched mode, so it does not re-send the pack the target just refused. The one-shot path and this one sharebatchAfterPushError.Separate commit: stale gated tests
TestBootstrap_GitHTTPBackendBatchedBranchand…BatchedBranchResumefail onmain. They assumed a run executes exactly the batches it planned, but the plan's per-commit estimate is below these tests' blob sizes, so pushes split at runtime (planned 2, ran 6) and the bootstrap still succeeds. Thetest:git-http-backendtask matched neither test, so nobody noticed. The assertions now check what the tests were after, and the task runs everyTestBootstrap_GitHTTPBackend*andTestReplicate_GitHTTPBackend*test.Not covered
syncpath has no such fallback; the mirror-pipeline uses replicate.Tests
TestRun_IntegrationReplicateBatchesMissingRefsAfterTargetBodyLimit(runs in CI, in-process target with a 300 KB body limit) fails without the fallback.TestReplicate_GitHTTPBackendResumeAfterTrunkLanded(gated) covers an empty target, a target holding the trunk, and one whose trunk is a commit behind.mise run test:ci,mise run test:git-http-backendandmise run lintpass.🤖 Generated with Claude Code
Note
Medium Risk
Changes core replicate and bootstrap relay paths for large mirrors and partial targets; behavior is heavily tested but affects production sync completion after interrupted bootstraps.
Overview
Fixes replicate getting stuck after a bootstrap times out once the trunk is on the target: plain replicate kept retrying one oversized pack on every run when the target hit a body limit or push deadline.
When that push fails with a batchable size/deadline error and the run still has ref creates, replicate re-reads the target, creates only still-missing refs via batched bootstrap, then runs a separate replicate push for remaining updates/deletes. The run reports relay reason
replicate-pack-rejected.Bootstrap changes support that path:
RejectedPushskips resending the refused pack and enters batched mode via sharedbatchAfterPushError. If the trunk is already on the target, planning usestargetHaves(excluding resume markers) for one commit-graph fetch for all remaining branches; tips already reachable on the target are created without a pack.Also tightens git-http-backend test expectations (runtime batch splits vs planned count) and extends the
test:git-http-backendmise task to cover replicate resume scenarios.Reviewed by Cursor Bugbot for commit e04187d. Configure here.