phoebus_os/installer/tests/vm/live-sys-install-check.sh
Phoebus f9e39925b4 feat(install): AI-first sys install workflow
Implement the shared installation workflow (ADR 0013). sys install, sys ask
install and the explicit backend flags all use one path: identify -> evidence
-> AI investigation -> deterministic validation/effects -> review -> approval
-> execute -> verify -> history.

- phoebus-ai::install: bounded, multi-turn investigation. The model may request
  typed read-only evidence (discover_candidates, inspect_candidate,
  check_backend, inspect_installation), ask one bounded question about intent,
  and must return a structured InstallProposal. Turn/request/size limits and
  repeated-request detection bound it; a rejected proposal is revised.
- phoebus-core: add the four read-only investigation actions and strict
  validators; add a transaction id; backend/kind wire names now match as_str.
- phoebus-executor::install: resolve_explicit (no model, no fallback),
  resolve_deterministic and resolve_with_ai; validate_proposal re-resolves the
  candidate against real metadata, rejects fabrication/ambiguity/staleness/
  duplicates, maps it to the existing broker action, and binds approval to a
  digest; revalidate + verify_installed. chooser gains per-lane friendly-name
  resolution and structured evidence.
- transaction::begin/finish record an in-progress transaction before mutation.
- sys: --portage/--flatpak/--nix/--snap/--appimage/--ebuild (mutually
  exclusive) bypass the model; an unqualified install consults the model and,
  with none, prints the deterministic selection and installs nothing.
- The installer persists /etc/phoebus/install.toml; sys loads it and adds free
  space, Wayland, usable lanes, saved preferences and recovery capability to
  the bounded facts.
- Docs: ADR 0013, docs/SYS.md install sections and cases 23-31, CHANGELOG,
  STATUS, HANDOFF, ROADMAP. New live-VM workflow check script.

Host gates pass: fmt, clippy (no new warnings), workspace tests, make test.
VM: verified the workflow CLI and read-only investigation on the reference
LiveGUI ISO; a full target install journey is running (see HANDOFF).
2026-09-23 20:30:13 -07:00

70 lines
2.2 KiB
Bash

#!/bin/bash
# Guest-side VM verification for the AI-first installation workflow.
#
# Boots the reference Gentoo LiveGUI ISO and exercises `sys install` through
# the deterministic CLI and the read-only investigation surface. The live medium
# ships no Portage tree (it syncs during install), so the explicit install step
# runs only when a tree is already present; otherwise it is skipped and the
# read-only workflow checks are the evidence. A real install journey runs on an
# *installed* target (see docs/HANDOFF.md).
set -u
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
BASE="${PHOEBUS_BASE_URL:-http://10.0.2.2:8000}"
PKG="${SYS_CHECK_PACKAGE:-app-misc/hello}"
echo "===LIVE-SYS-START==="
cd /tmp || exit 1
if ! curl -fsSL "$BASE/sys" -o /tmp/sys; then
echo "===SYS-FETCH-FAIL==="; poweroff -f; exit 1
fi
chmod 0755 /tmp/sys
echo "--- version ---"
/tmp/sys --version
echo "--- sync the Portage tree (the live medium ships none) ---"
if timeout 1500 emerge --sync --quiet >/tmp/sync.log 2>&1; then
echo "sync-ok"
else
echo "sync-failed rc=$?; tail:"; tail -5 /tmp/sync.log
fi
echo "--- conflicting flags must be rejected ---"
/tmp/sys install firefox --flatpak --nix
echo "conflict-rc=$?"
echo "--- unqualified install with no model must not install ---"
PHOEBUS_AI_PROVIDER= PHOEBUS_AI_BACKEND=direct /tmp/sys install "$PKG"
echo "no-model-rc=$?"
echo "--- check_backend ---"
/tmp/sys --action '{"action":"check_backend","backend":"portage-source"}'
echo "--- discover_candidates ---"
/tmp/sys --action "{\"action\":\"discover_candidates\",\"query\":\"$PKG\"}"
echo "--- explicit Portage install (deterministic, no model) ---"
if [ -d /var/db/repos/gentoo/profiles ]; then
/tmp/sys -y install "$PKG" --portage
echo "portage-install-rc=$?"
echo "--- verify in the package database ---"
ls -d /var/db/pkg/app-misc/hello-* 2>&1
else
echo "skip: the live medium ships no Portage tree (sync took too long)"
echo "portage-install-rc=skipped"
fi
echo "--- history ---"
/tmp/sys history
if [ -d /var/db/pkg/app-misc ]; then
echo "--- remove to leave the live medium clean ---"
/tmp/sys -y remove "$PKG"
echo "remove-rc=$?"
fi
echo "===LIVE-SYS-DONE==="
sync
echo "===INSTALL-RC=0==="
poweroff -f
echo "===POWEROFF==="