kolibri
kolibri copied to clipboard
install_cexts.py fails the build on a brief piwheels outage: retries have no delay and hide their errors
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Observed behavior
make dist (and so make -C platforms/android stage-workspace-tar) dies in staticdeps-cext whenever piwheels' index page fails to load for a few seconds:
uv run --script build_tools/install_cexts.py --file "requirements/cext.txt"
Unable to find package cffi on https://www.piwheels.org/simple/.
make[1]: *** [Makefile:190: staticdeps-cext] Error 1
- It happened twice in three hours on 2026-11-10/11, first for
cryptography, then forcffi. Builds of the same tree between the two failures succeeded. - In the
cffirun,cffi's PyPI page loaded, so the network was up. Only piwheels failed.
Cause
parse_pypi_and_piwheels in build_tools/install_cexts.py:
for _ in range(5): r = session.get(url): five attempts back to back, with no sleep. A blip of a second or two uses up all of them.session.gethas notimeout.- Each failure is logged with
logger.info("Error retrieving %s: %s", url, e). No logging is configured, so the reason never prints and the build log shows onlyUnable to find package.
Expected behavior
- A piwheels or PyPI outage of up to about a minute does not fail the build.
- When retries are exhausted, the output names each attempt's error or status code.
Acceptance criteria
- [ ]
parse_pypi_and_piwheelswaits between attempts with exponential backoff (e.g. 2s, 4s, 8s, 16s), totalling at least about 30s before giving up. - [ ] Each
session.getpasses atimeout. - [ ] Each failed attempt's exception or status is logged at WARNING, or included in the
sys.exitmessage. - [ ] A unit test with a mocked session that fails twice and then returns 200 yields the package's tasks. With
time.sleeppatched, it asserts the backoff delays. - [ ] A unit test with a session that always fails exits with a message naming the last error.
Filed from learningequality/coding-agent#1431's diagnosis.
Plan: parse_pypi_and_piwheels survives an index outage of about a minute and names the error when it gives up.
- [ ] Back off, time out and report errors when fetching index pages
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- 6 attempts, so the sleeps are 2+4+8+16+32 = 62s. This covers the "about a minute" outage. If 5 attempts (30s) is wanted, drop one and the final sleep assertion.
- 4xx responses are retried like 5xx, as they are today. If 404 should fail fast, a missing package exits at once instead of after ~62s.
except requests.RequestExceptionreplacesexcept Exception. If a non-requests error fromsession.getshould be retried, widen the catch.
Written by rtibblesbot, an LLM-based coding agent.