Repository navigation
source: memoize remote ref existence probes - #2700
Merged
Merged
Conversation
ref_exists() asked GitHub the same question once per caller. Nothing memoized it, and osism_files() (playbooks.py) re-probes the playbooks_version pin on every call: runtime_interface() is memoized per release, but osism_interface() is release-independent and so gets re-walked. One --group all run therefore spent 70 of its 86 requests re-asking whether a single tag exists in osism/ansible-playbooks. Those probes are the only part of a run that draws on GitHub's core API budget. Archive reads -- the default -- serve every file, listing and tree from one tarball per (repo, ref), and the tarball endpoint is accounted in a separate bucket, so the thousands of reads a run reports cost nothing here. 86 requests is over the 60/hr unauthenticated limit; the periodic-daily release-tox-drift job crossed it on 2026-09-09 and aborted with a source error before reporting any drift, which makes a red gate that says nothing about the state of the repositories it was asked to check. Memoize the remote answer per (repo, ref) on Config, alongside the existing per-run caches. Absence is cached too, so release_to_ref()'s walk through its four candidates does not pay for its misses again on a later resolve -- only its hit is memoized there. Local checkouts stay unmemoized: they answer from the clone at no request cost and stay live for a caller reading a working tree. A full run now issues 17 requests instead of 86, each ref probed once, and completes unauthenticated with a report identical to an authenticated one. Assisted-by: Claude:claude-opus-5 Signed-off-by: Roger Luethi <luethi@osism.tech>
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.
release-tox-drift(periodic-daily) has been aborting with rc=2 — a sourceerror, not a drift finding — since the 2026-09-08 drift expansion landed. The
run exhausts GitHub's unauthenticated core API budget (60/hr) and dies before it
reports anything, so the job's red says nothing about the state of the
repositories it was asked to check.
The cause is not request volume.
source.ref_exists()had no memo, unlike everyneighbouring per-run cache on
Config, and callers re-ask the same question:ref? ansible_playbooks @ v0.20260721.0ref?probes (kolla,kolla_ansible× release refs)86 requests per run, 17 distinct.
osism_files()probes theplaybooks_versionpin on every call — the guard at
playbooks.py:224-229that closes the404-ambiguity hole — and
runtime_interface()is memoized per release whileosism_interface()/osism_files()are release-independent, so everyper-release miss re-walks them.
Verification
Full
--group allrun on this branch, unauthenticated, the way the job runsit:
own counter reads
used 17 of 60afterwardsmainTwo findings behind the diagnosis, both verified rather than assumed, since they
are what rule the file reads out:
driver.py:289,archive=not args.use_raw_get),so a run's ~3600
raw/list/treeprogress lines are local reads out of oneextracted tarball per (repo, ref) — not requests.
api.github.com/repos/<o>/<r>/tarball/<ref>is accounted in a separatebucket: its 302 returns
x-ratelimit-used: 0and leavesremaininguntouched, while a plain
/repos/<o>/<r>GET decrements it.So the ref probes are the only consumers of the 60/hr budget, and no token or
Zuul secret is needed — 17/60 leaves ample headroom as the release range grows.
The expansion that crossed the limit
Neither is at fault: they multiplied how many callers ask an already-answered
question.
Side effect worth knowing
The run this unmasks confirms the 2026.1 mirror re-sync is closed — the 230
kolla_mirror_verbatimfindings are gone:The two stale allowlist entries (
neutron_ovn_vpn_agent_image/_tag, upstreamat master ahead of the supported range) are the pair predicted once the round
landed. They are a separate cleanup, not part of this PR — so expect the job to
go green on source errors and stay red on those two until they are removed.
Not addressed here
A future budget crossing would again abort rather than degrade the report.
Failing soft on a source error — the
ProbeInconclusivepatternkolla_source_ref_phasealready establishes, lifted to the driver — is left toits own change.
🤖 Generated with Claude Code