Skip to content

kitlauncher: pin kit to a kai-embedded version so kai code stays current#19

Open
jschatz1 wants to merge 1 commit into
mainfrom
feat/kit-version-pin
Open

kitlauncher: pin kit to a kai-embedded version so kai code stays current#19
jschatz1 wants to merge 1 commit into
mainfrom
feat/kit-version-pin

Conversation

@jschatz1

Copy link
Copy Markdown
Member

Problem

kai code resolves kit once (managed ~/.kai/bin/kit, else PATH) and then execs that cached copy forever, with no version check. install() only runs when kit is absent. So after the first kai code, a user is frozen on whatever kit they first downloaded — there is no "always latest" path today.

Fix (Option A — pin kit to the kai release)

Make kit a versioned companion pinned to kai:

  • New Launcher.ExpectedVersion, wired from a package const PinnedKitVersion.
  • When set, kai code:
    • downloads the version-qualified asset kit-{os}-{arch}-{ver}.gz,
    • records the installed version in a kit.version sidecar,
    • on resolve, compares the sidecar to the pin and re-installs on drift (ErrKitStale → atomic overwrite). A managed kit with no sidecar (old install.sh) reads as stale → upgrades once.
  • A kit found on PATH is never version-checked (the user owns it).
  • Empty pin = current behavior, byte-for-byte (rolling-latest, no version check).

Why pinning over a per-launch "latest" check: kit always matches the kai you're running (compatibility guaranteed), no network on the hot path (only re-downloads right after a kai update), works offline, and "latest kit" follows "latest kai" — which users already get via kai update/the installer.

Ships dormant — safe to merge/release now

PinnedKitVersion defaults to "", so behavior is unchanged. A non-empty pin would request an asset the /dl proxy can't serve yet (→404), so it stays empty until the backend is ready.

Activation (separate, do together)

  1. /dl proxy (kailab-control): serve app.kaicontext.com/dl/kit-{os}-{arch}-{version}.gz by mapping {version} → that tag's kai-tui release asset. Today it proxies only the unversioned rolling-latest.
  2. kai-tui: ensure a versioned kit release exists for the pinned version (it cuts one on a v* tag).
  3. kai-cli: bump PinnedKitVersion (ideally in lockstep with each kai release).

Tests

7 new tests (versioned asset name, sidecar match/stale/missing, unpinned-ignores-version, pinned install writes sidecar + requests versioned asset, Run re-installs on stale). Full existing suite still green.

kai code resolved kit once and then ran the cached copy forever with no
version check, so users froze on whatever kit they first downloaded.

Add an opt-in pin: Launcher.ExpectedVersion (wired from PinnedKitVersion).
When set, kai code downloads the version-qualified asset
(kit-{os}-{arch}-{ver}.gz), records it in a kit.version sidecar, and
re-installs whenever the managed copy drifts — so it always runs the
pinned build. Empty (the default) preserves the exact rolling-latest
behavior, so this ships dormant until the /dl proxy serves versioned
assets and the constant is bumped.
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