Repository navigation
Conversation
refresh_tagged.py shallow-fetches leanprover-community/mathlib4 master into the poller's --filter=blob:none clone of the fork, then git-greps FETCH_HEAD. Negotiation leaves out every blob the server assumes the clone has from its own commits, which a blob:none clone does not, so the grep fetched each missing blob from the fork one at a time. In 2026-08 that refresh took 18 to 30+ minutes per batch open, and 200 of 221 opens hit the old 30-minute job limit inside it. --refetch skips negotiation, so the one shallow pack carries every blob in master's tree and the grep reads only local objects. Reproduced on leanprover-community/batteries with a blob:none clone checked out at a 2026-03 commit: the grep made 179 lazy fetches in 101 s before, none in under a second after, with byte-identical output. bot/test_refresh_tagged.py pins the fetch arguments and the written lists; scripts/ci-python.sh runs it.
After --refetch, git fetch sets gc.autoPackLimit=1 for its post-fetch maintenance, so every refresh repacked the entire repository: in the background on the poller's throwaway clone, next to the batch open, and on a long-lived local checkout every time open_batch.py or daily_bot.py runs. --no-auto-maintenance skips that pass; ordinary gc --auto at its default thresholds still consolidates the extra pack later. On the batteries reproduction the refetch run repacked into 2 packs in the background, and the --no-auto-maintenance run kept its 3 packs, with the same grep result and no lazy fetches. The comment now also names where the missing blobs come from: the fork's batch branches sit on recent upstream commits, so negotiation reports those commits as present while their blobs never reached the clone.
Deicyde
force-pushed
the
claude/refresh-tagged-refetch
branch
from
October 17, 2026 23:36
d9df2f9 to
459e880
Compare
Owner
Author
|
Recommendation: close. Closing it now; reopen if the next batch open is still slow. An independent adversarial review of
If the next batch open after mathlib4#42608 merges still spends long in |
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.
bot/refresh_tagged.pymade every batch open slow. It is the step #65 found running 18 to 30+ minutes, and in 2026-08 200 of 221 batch-open ticks were cancelled inside it at the old 30-minute job limit.Cause
The poller clones the fork with
git clone --filter=blob:none(wikidata-poll.yml).refresh_tagged.pythen runsgit fetch --depth=1 <upstream> masterandgit grep … FETCH_HEAD -- Mathlib/.masterit checked out, and the fork'smasterlags upstream (today it dates from 2026-09-11 and is 882 commits behind).git grepthen reaches those blobs through the promisor remote, which is the fork, one blob per fetch.Fix
Add
--refetch(Git 2.36+): it skips negotiation, so the single shallow pack carries every blob in master's tree. Also add--no-auto-maintenance. After a refetch,git fetchsetsgc.autoPackLimit=1for its post-fetch maintenance, which repacks the whole repository on every run. On CI's throwaway clone that happens in the background next to the batch open, and on a long-lived local checkout it happens every time. Ordinarygc --autoat its default thresholds still consolidates the extra pack later. The log linefetching … master (shallow)…is unchanged, so the README guidance from #65 still applies. An older git fails the fetch, and the refresh already fails closed on a fetch error.Evidence
Reproduced on
leanprover-community/batterieswith the bot's sequence: a blob:none clone checked out at a 2026-03 commit (standing in for the stale fork), then a shallow fetch ofmainandgit grep FETCH_HEAD -- Batteries/, withGIT_TRACE2_EVENTcounting child fetches.--refetch--refetch --no-auto-maintenanceAt Mathlib scale the refetch downloads one shallow snapshot of master instead of thousands of single-blob fetches. I haven't measured it on Mathlib; the next batch open after mathlib4#42608 merges will show the real time. A local run against a long-lived full checkout (
bot/daily_bot.py:101,bot/open_batch.py:228) also downloads the snapshot instead of an incremental fetch, and leaves one extra pack per run until ordinarygc --autoconsolidates them.Tests
bot/test_refresh_tagged.py(new, wired intoscripts/ci-python.shnext to the other bot tests) stubssubprocess.run. It pins the fetch arguments (--depth=1 --refetch --no-auto-maintenance <upstream> master), checks that the grep runs onFETCH_HEAD, and checks both written lists. I didn't run it locally because machine load was above the agreed limit; CI runs it.#65's timeouts (job 60 minutes,
Poll tick50) stay as headroom.Not changed here:
open_batch.pyignoresrefresh_tagged.py's exit code. A failed refresh doesn't overwrite the lists, but the open still proceeds with the previous ones.