phoebus_os/docs/HANDOFF.md
2026-09-24 20:43:33 -07:00

8.9 KiB

Handoff

Rolling note between work sessions. Update this file before you finish, then commit it. It should be short and current; use git log for detail.

  • Last updated: this session (2026-09-25), adversarial hardening of the privileged approval boundary: (1) the broker recomputes the canonical approval digest for every plan kind, (2) the ledger uses a stable approval identity instead of the editable integrity seal, (3) crash recovery is live-safe and terminal transitions are atomic/monotonic, and (4) personal writes are owned by the initiating user. See ADR 0014. Supersedes the 0be3010 approval design; that commit's UX/docs changes are preserved.
  • Current focus:
    1. Canonical digest at the privileged boundary (service::validate_prepared_plan):
      • Independently re-derives compute_plan_digest(actions, candidate, effects, step_effects) and requires it to equal both plan.digest and the supplied --approval-digest. Covers Install, LegacyInstall, Removal, General and Undo. The stored integrity seal is only a self-consistency check and is never treated as authentication.
      • Per-step effect binding: execution trusts step_effects, so the canonical digest now hashes every step (contents recomputed, not read from the stored digest); each stored step digest must match its contents, and the aggregate must be the concatenation of the steps. A multi-action plan without per-step effects is refused. Install/LegacyInstall keep the install-specific digest with the single step required to equal the aggregate. This closes the "retain the approved digest, change only step_effects, recompute the seal" gap; rejected before any command runs or approval is consumed. The earlier-step allowance in approval_holds is unchanged.
    2. Stable approval identity (phoebus_installer::approval, ADR 0014):
      • Ledger + .claim key = approval_key(plan_id, canonical_digest, initiator_uid, target_root). Presentation fields (summary, rationale, verification) are excluded, so editing them and resealing cannot mint a fresh record for a consumed approval; a newly reviewed identical operation with a new plan id is allowed.
      • Claims record the owning process (pid, /proc/<pid>/stat start ticks, boot id). Terminal status is published once via an atomic hard link into <key>.terminal and is immutable. reconcile_interrupted only marks a record interrupted when the owner is provably gone, so a live operation (or a second broker starting concurrently) is never mislabelled, and it cannot race a real finish.
    3. Personal write ownership (phoebus_executor::personal):
      • write_private creates the config/state path one component at a time under the resolved home, rejecting symlinks and non-directories.
      • Elevated writes (effective root on behalf of a non-root user) chown the created paths to the initiating user's uid/gid (via a standard-library chown behind an injectable OwnerFixer). A non-root process acting for a different user is refused. Proactive state now routes through the same path.
    4. Reviewed effects + terminal transactions (service::execute_prepared, unchanged this session): reviewed per-step effects are carried forward and freshly resolved effects are evidence compared with phoebus_core::effects::approval_holds; every path after transaction::begin reaches a terminal result.
  • Last verified (this session):
    • cargo fmt --all -- --check clean.
    • cargo test --workspace: 601 passed, 0 failed. New per-step binding adversarial tests: single-action and multi-action General plans with step_effects swapped (with and without a matching aggregate) while the approved digest is retained are rejected before any command, ledger claim or transaction; a legitimate bound multi-step plan still validates. The prior session's adversarial tests (swapped action resealed for every plan kind; replay after a summary/presentation edit or recreating an identical plan; live-vs-abandoned reconciliation; reconcile-vs-finish; personal ownership; cross-uid refusal) all still pass.
    • cargo clippy --workspace --all-targets exits 0 (only the pre-existing result_large_err, one arg-count and one DiskPhase lints remain).
    • cargo build --release -p phoebus-installer clean.
  • Not yet verified this session (BLOCKED):
    • Installed-VM journey and the 12-step acceptance list. The existing disposable installed disk (/var/tmp/phoebus-vm/disks/test-disk.qcow2) reaches the LUKS prompt but no passphrase in this environment opens it: the harness default (phoebus-luks-test, which is also the content of /home/dominic/vmlab/serve/luks.pw) is rejected, and no other credential is available. Do not guess or brute-force.
    • No AI provider credential is present; do not invent one.
    • A real privileged chown (running as root) could not be exercised in this unprivileged host; the ownership logic is verified through the injectable fixer seam and the cross-uid refusal test. A root-run confirmation is a follow-up.
  • Public repo: https://git.phoebus.club/phoebus/phoebus_os (remote origin, SSH port 2222).

Next actions (in order)

  1. Unlock or rebuild the installed VM (blocker). The installed disk reaches the LUKS prompt but its passphrase is unknown; the committed harness default is rejected. Either supply the real passphrase or perform a fresh disposable install (~2 h) to obtain an installed system, then run the full 12-step acceptance list below.
  2. Installed sys acceptance on the booted disk:
    # serve the static sys first:
    cp installer-rs/target/x86_64-unknown-linux-gnu/release/sys /home/dominic/vmlab/serve/
    env DISK=/var/tmp/phoebus-vm/disks/<clone>.qcow2 \
      OVMF_CODE=/usr/share/OVMF/OVMF_CODE_4M.fd \
      OVMF_VARS=/var/tmp/phoebus-vm/OVMF_VARS.fd \
      BOOT_CHECKS='... curl .../sys ...; SYS_BIN=/tmp/sys bash .../sys-acceptance.sh ...' \
      python3 installer/tests/vm/serial-driver.py boot
    
    The new broker behaviour (replacement during authentication, replay after deleting user plan state, cancellation) is already covered by phoebus-installer unit tests; the installed run confirms the sealed elevation path and the personal-preference acceptance case.
  3. AI-selected install journey (needs an authorised provider): boot the installed disk, serve the built sys and a 0600 key file, then:
    sudo sys --ai-provider deepseek --ai-api-key-file /run/phoebus/ai.key \
      install <application>
    # and the no-model control in the same run:
    PHOEBUS_AI_PROVIDER= sudo sys install <application>
    
    Confirm the model requests evidence, the resolver confirms the candidate, the plan is presented before approval, and the transaction is recorded. No credential is available here; do not invent one.
  4. Rollback VM acceptance (serial-driver.py rollback) on a cloned disposable image of the installed system.
  5. NVIDIA hardware acceptance (BLOCKED): needs an NVIDIA GPU.
  6. Interactive graphical user session login into Mango / DankMaterialShell under a physical seat or nested Wayland compositor.

Known blockers / risks

  • A full VM install still takes hours (base stage ~116 min). Use the already installed disposable disk (clone it) for sys install journeys rather than a fresh install.
  • No NVIDIA GPU (and no authorised passthrough).
  • Snap needs network and AppArmor for meaningful confinement; the lane detects confinement honestly.
  • AppImage provides no sandbox; do not describe it as one.
  • Custom ebuilds remain separately reviewed, untrusted artifacts; the install workflow never builds one during investigation.
  • OpenCode transport concatenates messages, so multi-turn investigation is best-effort there; the direct providers carry the full conversation.
  • Harness artifacts live under /var/tmp/phoebus-vm/ (outside git).

Environment notes

  • Dev host: Ubuntu 26.04. QEMU/OVMF/xorriso/rustfmt/clippy/ImageMagick/visudo present. flatpak and snap clients are present on the host (not proof of the VM lanes).
  • VM harnesses: installer/tests/vm/{gui-driver,serial-driver,appliance-driver,live-driver}.py and sys-acceptance.sh. DISK must be a disposable qcow2; never /dev/*.
  • Serve fixtures from /home/dominic/vmlab/serve with python3 -m http.server 8000 --bind 127.0.0.1 (reachable as 10.0.2.2:8000).
  • The static binaries for the VM: make static builds phoebus-installer and sys under installer-rs/target/x86_64-unknown-linux-gnu/release/.

Definition of a good stopping point

  • make test passes; docs/STATUS.md and docs/CHANGELOG.md updated; docs/HANDOFF.md updated; committed (via scripts/agent-commit.sh) and pushed (scripts/publish.sh).