Skip to content

feat(cli): self-provision pinned uv and defer MCP Python runtime install#297

Merged
andreybavt merged 1 commit into
mainfrom
docker-relevance-question
Jun 12, 2026
Merged

feat(cli): self-provision pinned uv and defer MCP Python runtime install#297
andreybavt merged 1 commit into
mainfrom
docker-relevance-question

Conversation

@andreybavt

Copy link
Copy Markdown
Contributor

Fixes a production crash-loop (PostHog issue 019eb68e) where ktx mcp start --foreground on a uv-less container eagerly installed the managed Python runtime at boot, failed, and was supervisor-restarted every ~62s — 122 exceptions from one install.

The MCP server factory now wires a lazy semantic-layer compute port that defers the runtime install to the first call (mirroring the already-lazy SQL-analysis port), so the server boots and serves non-Python tools regardless. ktx no longer requires uv on PATH at all: it downloads its own pinned, sha256-verified uv build under the runtime root (KTX_RUNTIME_ROOT-aware, musl-static on Linux, never consulting PATH), acquired before the version dir is wiped so a failed download cannot destroy an existing runtime. Acquisition failures (offline host, intercepted download, unsupported platform) throw KtxExpectedError and stay out of Error Tracking, while a missing binary inside a checksum-verified archive remains a plain Error so release faults still surface. scripts/refresh-uv-manifest.mjs regenerates the pinned manifest on uv bumps, the setup consent prompt now discloses the uv download, and the ktx mcp/ktx admin docs reflect the zero-prerequisite install.

Fixes a production crash-loop (PostHog issue 019eb68e): ktx mcp start
--foreground on a uv-less container eagerly installed the managed Python
runtime at boot, failed, and was restarted by its supervisor every ~62s
(122 exceptions from one install).

- MCP server factory now wires a lazy semantic-layer compute port that
  defers the runtime install to the first call, mirroring the already-lazy
  SQL-analysis port; the server boots and serves non-Python tools without
  the runtime.
- ktx no longer requires uv on PATH: it downloads its own pinned,
  sha256-verified uv build under the runtime root (KTX_RUNTIME_ROOT aware),
  always musl-static on Linux. PATH uv is never consulted.
- uv is acquired before the version dir is wiped, so a failed download
  cannot destroy an existing runtime.
- Acquisition failures (offline, intercepted download, unsupported
  platform) throw KtxExpectedError and stay out of Error Tracking; a
  missing binary inside a checksum-verified archive remains a plain Error.
- scripts/refresh-uv-manifest.mjs regenerates the pinned manifest
  (packages/cli/src/managed-uv-release.ts) on uv bumps.
- Setup consent prompt now discloses the uv download; docs updated.
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ktx-docs-site Ready Ready Preview, Comment Jun 12, 2026 4:29pm

Request Review

@andreybavt andreybavt enabled auto-merge (squash) June 12, 2026 16:29
@andreybavt andreybavt merged commit feb0818 into main Jun 12, 2026
9 checks passed
@andreybavt andreybavt deleted the docker-relevance-question branch June 12, 2026 16:31
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.25000% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/managed-python-runtime.ts 73.52% 11 Missing and 7 partials ⚠️
packages/cli/src/managed-python-command.ts 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants