Skip to content

feat(preflight): detect and surface Podman machine hypervisor provider - #438

Merged
aviadshiber merged 5 commits into
mainfrom
feat/409-provider-detection
Jul 8, 2026
Merged

feat(preflight): detect and surface Podman machine hypervisor provider#438
aviadshiber merged 5 commits into
mainfrom
feat/409-provider-detection

Conversation

@aviadshiber

Copy link
Copy Markdown
Owner

Summary

Follow-up to #409 (and PR #433's process-matching fix). Adds the provider-detection primitive that was deferred out of PR #433's scope because it wasn't behavioral there:

  • get_podman_machine_provider() in scripts/lib/compat.sh — detects applehv vs libkrun via podman machine inspect --format '{{.VMType}}', empty/no-op on Linux, never fails the caller.
  • Logged at launch (scripts/launch-agent.sh, macOS + Podman backend only) and at ./scripts/preflight-check.sh.
  • Recorded as a new informational status.json field, machine_provider (per the Dashboard Sync Rule): scripts/lib/status.sh (setter + JSON field), dashboard/shared/src/index.ts (AgentStatus interface — the actual source of truth dashboard/server/src/types.ts re-exports), and a small display line in dashboard/ui/src/views/AgentDetail.tsx.
  • New docs/KRUNKIT-PROVIDER.md — the opt-in adoption guide referenced from docs/STATUS-TRACKING.md and added to CLAUDE.md's Documentation Map. Covers requirements, install (brew tap libkrun/krun && brew install krunkit), migration cost (new machine required, caches/images not shared), and which existing mitigations remain active either way.

Deliberately out of scope (still tracked on #409)

Per the issue's own research: benchmarking libkrun vs applehv on a representative Kapsis workload, and sleep/wake burn-in validation, both require a real macOS 14+/Apple Silicon host running a libkrun machine — not available in this environment. #409 is left open; this PR does not close it.

Nothing here changes Kapsis's default behavior or gates any existing mitigation on the detected provider — it's purely observability, consistent with PR #433's guardrail that provider detection should never become a behavioral branch without field evidence.

Test plan

  • New tests in already-QUICK_TESTS-registered files (no run-all-tests.sh registration changes needed): tests/test-compat.sh (4 cases: libkrun/applehv/Linux-noop/podman-failure, using a fake executable podman on PATH since detection shells out via timeout), tests/test-status-reporting.sh (2 cases: setter round-trips into JSON, defaults to null), tests/test-preflight-check.sh (1 case: check_podman surfaces the detected provider).
  • shellcheck --severity=warning clean on all changed shell files.
  • All three extended suites pass standalone (46/46, 29/29, 24/24).
  • No bun/tsc available in this environment to typecheck the dashboard TS changes directly; verified by inspection that AgentStatus fixtures in dashboard/server/tests/*.test.ts are untyped JSON.stringify({...}) literals (not : AgentStatus), so the new required-but-nullable field can't break existing tests, and no CI workflow currently runs tsc --noEmit.

🤖 Generated with Claude Code

aviadsTaboola and others added 5 commits July 6, 2026 22:35
Adds get_podman_machine_provider() (compat.sh) to detect whether a macOS
Podman machine is running on "applehv" (vfkit/AVF) or "libkrun" (krunkit),
following up on PR #433's process-matching fix. Informational only, no
behavioral branch: logged at launch and preflight, and recorded as a new
status.json field (machine_provider) per the Dashboard Sync Rule.

Adds docs/KRUNKIT-PROVIDER.md as the opt-in adoption guide referenced from
Issue #409's research comment (install, migration cost, mitigation status
under libkrun). Leaves #409 open — benchmarking and sleep/wake burn-in
still need a real libkrun machine, which wasn't available for this change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI's dashboard-build "Typecheck server" step (bunx tsc --noEmit) failed on
the 3 test files that build a typed AgentStatus fixture via a
Partial<AgentStatus>-override helper (gist-history, health-rules, health):
without a base value, the merged type inferred machine_provider as
`string | null | undefined`, and `undefined` isn't assignable to the
interface's `string | null`. Other status.test.ts-style fixtures using
untyped JSON.stringify({...}) were unaffected — grepped for AgentStatus
usage across dashboard/{server,ui} tests to confirm these were the only 3.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ht provider report

Ensemble review (noncritical): the preflight provider line passed the
literal "podman-machine-default" as an explicit argument, overriding
get_podman_machine_provider's own KAPSIS_PODMAN_MACHINE fallback chain —
inconsistent with the launch-agent.sh call site and with how
podman-health.sh / kapsis-cleanup.sh / vfkit-watchdog.sh resolve the
machine name. Drop the argument so a custom KAPSIS_PODMAN_MACHINE gets
the right provider line. (check_podman's pre-existing inspect/state
checks also hardcode the literal — out of scope for this PR.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- test-compat.sh: cover the no-timeout-cmd fallback branch of
  get_podman_machine_provider (_KAPSIS_TIMEOUT_CMD empty)
- test-compat.sh: assert KAPSIS_PODMAN_MACHINE is resolved as the
  default machine name via an argv-capturing fake podman
- test-status-reporting.sh: validate full status-file JSON with
  python3 inside both machine_provider tests
- test-preflight-check.sh: assert provider line absent on Linux, and
  add macOS test that check_podman passes without a provider line
  when the VMType query fails

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ection

# Conflicts:
#	dashboard/server/src/types.ts
#	dashboard/shared/src/index.ts
#	scripts/lib/status.sh
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