Managed runtime env for registry/app-installed extensions (exposure #2) #65

Merged
kahliburke merged 1 commit from fix/extension-managed-env into main 2026-07-17 17:28:47 -07:00
kahliburke commented 2026-07-17 17:17:49 -07:00 (Migrated from github.com)

Context

Stacks on top of #61. Together these fix a fresh pkg> app add Kaimon + app add <extension> install so the extension boots end-to-end. The two failures are independent:

  1. using Kaimon fails — the extension's JULIA_LOAD_PATH carries the manifest-less pkgdir(Kaimon). Fixed by #61 (put Kaimon's active, manifest-bearing env on the load path).
  2. using <ExtensionModule> failsthis PR. The extension is launched with --project=<pkgdir(extension)>, which for a registry/app install is a manifest-less, write-protected depot dir. Its deps can't resolve, and the boot script's Pkg.resolve dies with Permission denied.

This is the "Related" caveat #61 flagged, and it's really a Kaimon-side responsibility (Kaimon owns how the extension subprocess is launched), so it's fixed for all extensions with no changes required in the extension package.

Fix

Kaimon maintains a writable, instantiated environment per extension at ~/.julia/environments/kaimon-ext/<namespace>: it Pkg.develops the package from its source dir and installs its deps, then launches --project there.

  • Built once, cached, rebuilt when the source changes (path + Project.toml mtime).
  • A dev checkout that already has its own manifest is launched as-is — unchanged behavior.
  • The build runs in an isolated subprocess (never Pkg.activate in the running Kaimon process) with auto-precompile disabled (precompiling a package developed from a read-only depot dir is flaky; the extension precompiles on its own using).
  • macOS orphan reaping now keys on the boot-script namespace markers instead of project_path (a managed env means --project != the registered path).

Testing

  • New unit tests for _project_has_manifest, _extension_env_dir, _extension_env_fingerprint, and the _ensure_extension_runtime_project dev-checkout short-circuit. Extension suite: 53/53.
  • Verified live on a clean Linux box with app add Kaimon + app add KaimonSlate:
    • registered Kaimon → crash-loop on using Kaimon (the #61 bug)
    • #61 + manifest-less extension pkgdir → Kaimon loads, crashes on using KaimonSlate (exposure #2)
    • #61 + this fix → extension boots and serves, single start, clean build log
## Context Stacks on top of #61. Together these fix a fresh `pkg> app add Kaimon` + `app add <extension>` install so the extension boots end-to-end. The two failures are independent: 1. **`using Kaimon` fails** — the extension's `JULIA_LOAD_PATH` carries the manifest-less `pkgdir(Kaimon)`. Fixed by **#61** (put Kaimon's active, manifest-bearing env on the load path). 2. **`using <ExtensionModule>` fails** — *this PR*. The extension is launched with `--project=<pkgdir(extension)>`, which for a registry/app install is a **manifest-less, write-protected depot dir**. Its deps can't resolve, and the boot script's `Pkg.resolve` dies with `Permission denied`. This is the "Related" caveat #61 flagged, and it's really a Kaimon-side responsibility (Kaimon owns how the extension subprocess is launched), so it's fixed for **all** extensions with no changes required in the extension package. ## Fix Kaimon maintains a writable, instantiated environment per extension at `~/.julia/environments/kaimon-ext/<namespace>`: it `Pkg.develop`s the package from its source dir and installs its deps, then launches `--project` there. - Built once, cached, rebuilt when the source changes (path + `Project.toml` mtime). - A **dev checkout** that already has its own manifest is launched as-is — unchanged behavior. - The build runs in an **isolated subprocess** (never `Pkg.activate` in the running Kaimon process) with auto-precompile disabled (precompiling a package `develop`ed from a read-only depot dir is flaky; the extension precompiles on its own `using`). - macOS orphan reaping now keys on the boot-script namespace markers instead of `project_path` (a managed env means `--project` != the registered path). ## Testing - New unit tests for `_project_has_manifest`, `_extension_env_dir`, `_extension_env_fingerprint`, and the `_ensure_extension_runtime_project` dev-checkout short-circuit. Extension suite: 53/53. - **Verified live** on a clean Linux box with `app add Kaimon` + `app add KaimonSlate`: - registered Kaimon → crash-loop on `using Kaimon` (the #61 bug) - #61 + manifest-less extension pkgdir → Kaimon loads, crashes on `using KaimonSlate` (exposure #2) - **#61 + this fix → extension boots and serves, single start, clean build log**
Sign in to join this conversation.
No description provided.