Repository navigation
fix(runtime): keep APM truststore bootstrap out of ensurepip on llm re-setup - #3262
Open
Daniel Meppiel (danielmeppiel) wants to merge 1 commit into
Open
Daniel Meppiel (danielmeppiel) wants to merge 1 commit into
Daniel Meppiel (danielmeppiel) wants to merge 1 commit into
Conversation
…e-setup
Re-running `apm runtime setup llm` over an existing venv recreates it while
APM's `_apm_tls.pth` bootstrap is installed. ensurepip launches its bundled
pip via `python -c runpy...`, which the bootstrap's pip detection misses, so
truststore is injected into ssl; pip's vendored truststore then probes
`create_default_context().wrap_bio(...)` and truststore 0.10.5 rejects it
("check_hostname requires server_hostname"). Run the pip bootstrap with
APM_DISABLE_TRUSTSTORE=1 (honored by every shipped bootstrap); pip still
verifies against the OS store through its own vendored truststore.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 761bf207-57da-41d0-bd3f-ffecbb97b83a
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
October 17, 2026 02:55
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped changes preserve normal runtime TLS behavior, with no identified blocking issues.
No open issues 🎉
What changed in this PR
Prevents APM's truststore bootstrap from interfering with pip when re-running LLM runtime setup, addressing the release-gate failure exposed by #3253.
Changes:
- Disables APM truststore injection during pip bootstrapping on Bash and PowerShell.
- Adds script-contract assertions for both setup paths.
| File | Description |
|---|---|
| tests/integration/test_tls_r3_verify.py | Checks both scripts include the bootstrap opt-out. |
| scripts/runtime/setup-llm.sh | Scopes the opt-out to ensurepip. |
| scripts/runtime/setup-llm.ps1 | Temporarily sets the opt-out and restores its previous value. |
Review effort: Balanced
This branch has not been deployed
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.
Description
Root cause of the last release-gate failure (
test_dual_runtime_installation,apm runtime setup llm), surfaced by #3253's diagnostic in dispatch run 38905430799:Re-running
apm runtime setup llmover an existing llm venv (the e2e module reuses its HOME; real users re-run setup too) recreates it while APM's_apm_tls.pthbootstrap is present.ensurepiplaunches its bundled pip viapython -c "runpy...", which the bootstrap's pip-process check misses, so truststore is injected intossl. pip's vendored truststore then probeswrap_biowithout a hostname, which truststore 0.10.5 rejects.Fix: run the pip bootstrap with
APM_DISABLE_TRUSTSTORE=1(bash and PowerShell). Every shipped bootstrap honors this, so existing venvs are covered; pip still verifies against the OS store through its own vendored truststore.Issue and approved scope
Issue: N/A -- maintainer-directed CI repair blocking the v0.34.0 release (#3250); follow-up to #3251, #3253.
Human scope-approval comment: Daniel Meppiel (@danielmeppiel) directed in-session: "loop and bypass merge PRs until they're fixed and we know that the release workflow would pass".
Does this PR complete the issue, or what remains? Completes the known release-gate failures; a post-merge
manual-build-releasedispatch verifies.Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
uv run --extra dev pytest tests/integration/test_tls_r3_verify.py-- 11 passed, 1 skipped (new script-contract assertion).Re-ran
setup-llm.shover an existing venv with_apm_tls.pthinstalled -- succeeds.In that venv,
ssl.create_default_context()istruststore._apiby default and stdlibsslwithAPM_DISABLE_TRUSTSTORE=1, confirming the bootstrap is bypassed for ensurepip.truststore 0.10.5 is not available on the local package mirror, so the exact ValueError was observed only in CI.
Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.