Lock the bootstrapped Python environment - #965
Draft
fettpl wants to merge 2 commits into
Draft
Conversation
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.
Summary
uv.lockwith an exact CPython patch, uv release, and seven-day dependency cutoffSolution design
The bundled base runtime is a dedicated non-package uv project.
toolchain.jsonpins CPython 3.11.15, uv 0.11.33, the release-age cutoff, and the reviewed Termux toolchain.constraints.txtis generated fromuv.lockand is used only as a constraint for separately installed skills.Bootstrap validates lock consistency before reusing a warm environment. A stale environment is rebuilt in a sibling directory, validated, and then swapped into place. The prior environment is restored if staging, activation, or post-activation validation fails. The bootstrap marker records the complete artifact digest, target platform, interpreter identity, and uv version.
Linux detects glibc versus musl before selecting wheel tags. Windows receives a native install lane. Termux uses its system Python because uv-managed CPython is unavailable for Android/Bionic. The exact uv release is built from a checksum-pinned source archive. Exact official Termux builds of lxml, NumPy, psutil, and SciPy are version-checked and copied into the staged venv with PEP 738 Android wheel tags; the remaining locked dependencies are built or installed by uv. Termux CI performs both an online install and a new cached-offline install.
Verification
npm run refresh-python-locknpm run check:python-lock(macOS ARM64/x64, glibc Linux ARM64/x64, musl Linux ARM64/x64, Windows x64)npx tsx ../../node_modules/vitest/dist/cli.js --run test/kernel-bootstrap.test.ts(28 tests)npm run checkuv pip checkUV_OFFLINE=trueRisks and rollout
PRIME_AGENT_KERNEL_PYTHONenvironments remain an explicit, non-mutating override.Fixes #932