Auto-subdivide batches on target body-size rejection

main

Commit

Soph5mo ago

When a batched bootstrap push is rejected by the target for exceeding its body-size limit, instead of failing immediately, subdivide the remaining checkpoints by inserting midpoints from the stored commit chain and retry. Each failing batch gets split in half, halving the commit range (and roughly halving the pack size) per retry. This converges to batches small enough for the target without requiring the user to manually lower --batch-max-pack-bytes and re-run.

The commit chain is already in memory from the planning phase (~1.5 MiB for linux's 75k commits). subdivideCheckpoints walks the remaining checkpoint list, computes chain-index gaps, and inserts a midpoint for each gap > 1 commit. Adjacent commits (gap=1) cannot be split further; if even a single-commit batch is too large, the push fails as before.

Example for the linux kernel at 200 MiB batch estimate:

  • Estimate plans 3 batches (25k commits each)
  • Batch 3 contains 6.5M objects (~2.3 GiB), target limit is 2 GiB
  • Push rejected → subdivide inserts midpoint → 4 checkpoints
  • Retry batch 3a (~12.5k commits, ~1.2 GiB) → succeeds
  • Continue batch 3b (~12.5k commits, ~1.1 GiB) → succeeds
  • No user intervention needed

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com Entire-Checkpoint: 516fe4e51170

Checkpoints

can you review the changes in this branch

Claude CodeOpus 4.6[1m]
View session
Checkpoint 1