Skip to content

LANG-790: Select deployment mirrors by measured speed - #78

Merged
RockChinQ merged 3 commits into
mainfrom
agent/sg-codex/ced1b2a3cdfd
Dec 2, 2026
Merged

RockChinQ merged 3 commits into
mainfrom
agent/sg-codex/ced1b2a3cdfd

Conversation

@RockChinQ

Copy link
Copy Markdown
Member

Install and upgrade select download sources without a country or locale lookup. PyPI probes require the target wheel and sample its first MiB before ranking indexes. Native installs try up to three, preserving same-index file-lock retries. Native plugins and managed Compose deployments use the successful index. Explicit indexes bypass selection and fallback; old PyPI.org and Aliyun defaults are treated as automatic.

uv samples the current platform archive from both distributors. Managed Python samples the stripped Linux x86-64 CPython 3.12.12 archive under release 20251120 (the release used by uv 0.9.11); a Python mirror override bypasses probing. Docker Hub competes with public mirrors. Saved repositories, digest verification and the final canonical fallback are unchanged.

--region and LANGBOT_REGION remain accepted with a deprecation notice. CLI telemetry reports auto. Space stores only serialized CLIMetadata in the features column for cli_operation; arbitrary feature keys are not persisted. Probe results are reported locally, not submitted to Space.

Verification on the Singapore host, python:3.12-slim, native v4.11.8:

  • Real sources: Aliyun 88 ms, PyPI.org 913 ms; Tsinghua and Huawei returned 403, Tencent timed out. Installed from Aliyun, persisted pypi_index_source: auto, WebUI HTTP 200.
  • Added probe time: uv 1,801 ms + Python 1,800 ms + PyPI 4,001 ms = 7.602 s.
  • An isolated Go build overlay replaced the first two indexes with local redirects to the same real PyPI index. Delaying the first by 1.8 s gave 1,825 ms versus 116 ms; the other index was selected, persisted and used for installation. WebUI HTTP 200.
  • Stripped linux/amd64 build: 13,418,761 → 13,537,545 bytes (+0.89%).

RockChinQ and others added 3 commits December 2, 2026 14:04
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
…downloads

Co-authored-by: multica-agent <github@multica.ai>
@RockChinQ

Copy link
Copy Markdown
Member Author

Verified e925ccc on the Singapore host, python:3.12-slim, native v4.11.8. A fresh normal-speed install selected Aliyun (79 ms versus PyPI.org at 735 ms), downloaded the package and served WebUI HTTP 200. The uv, Python and PyPI probes together took 2.839 s.

In the same isolated container, repeated install with ingress limited by tc police rate 1500kbit burst 32k. No index completed a 1 MiB sample. The index with the most wheel bytes won; the official index was not used as fallback:

PyPI mirrors.aliyun.com               4000 ms  556277 B  deadline
PyPI pypi.tuna.tsinghua.edu.cn        4000 ms       0 B  deadline
PyPI pypi.org                         4000 ms       0 B  deadline
PyPI repo.huaweicloud.com             1160 ms       0 B  HTTP 403
PyPI mirrors.cloud.tencent.com         4000 ms       0 B  deadline
Selected PyPI index: https://mirrors.aliyun.com/pypi/simple
pypi_index_source: auto
WebUI HTTP 200

Automatic Python installation now retries the alternate source; cancellation and explicit mirrors do not retry. A source-only change on repeated install is saved without restarting the process. Upgrades honor LANGBOT_PYPI_INDEX over the saved index. Legacy region-selected npmmirror defaults are re-probed. Telemetry region remains auto, including when --region is passed. The revised linux/amd64 build is 13,545,737 bytes (+0.95% versus main).

@RockChinQ
RockChinQ merged commit d30d337 into main Dec 2, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant