From f0bf537be1255c5dacca30076599a70326586814 Mon Sep 17 00:00:00 2001 From: Phoebus Date: Sat, 3 Oct 2026 13:11:59 -0700 Subject: [PATCH] fix(assistant): show plan evidence in details --- docs/CHANGELOG.md | 11 +++ docs/HANDOFF.md | 16 ++++ docs/STATUS.md | 15 +++ .../phoebus-installer/src/assistant_bridge.rs | 5 + .../phoebus-installer/src/service/mod.rs | 2 +- .../live/desktop/phoebus-assistant/shell.qml | 95 +++++++++++++++---- 6 files changed, 122 insertions(+), 22 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 022eef0..4e89fcb 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,17 @@ this file is the curated, human-readable summary. ## Unreleased — Fast defaults with user-controlled source builds +- **Assistant plan details (2026-10-03).** Expanding a prepared plan now shows + the selected package, reported version, source health evidence and limits, + exact planned actions, expected package effects, rationale, alternatives, + and the post-execution check. It no longer repeats the summary text. The + bridge supplies readable action and alternative descriptions plus the + candidate health report. Plan text no longer calls an uninstalled artifact + cryptographically verified. Rust format, strict clippy, workspace tests, + `make check`, and dynamic/static release builds pass. In the running VM, a + staged Firefox Flatpak plan displayed the expanded details and scrolled to + its digest; no install was approved or executed. + - **Source review coverage correction (2026-10-03).** Candidate inspection is now required for every AI package recommendation, including Portage source and binary packages; a vendor binary ebuild need not appear in the separate diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index dbf7cbc..457f8d3 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -3,6 +3,22 @@ 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. +- **Assistant plan details (2026-10-03):** The Details button previously + repeated the recommendation already shown at the top of the card. It now + shows the selected package, source health evidence and limits, planned + actions, effects, rationale, alternatives, post-execution check, and digest. + The bridge exposes readable action and alternative descriptions and the + candidate health report; plan text no longer implies a pending artifact has + already passed cryptographic verification. Rust format, strict clippy, + workspace tests, `make check`, and dynamic/static release builds pass. In + the running VM, a staged `org.mozilla.firefox` Flatpak plan displayed the + new details and scrolled to its digest + (`/var/tmp/phoebus-vm/details-scrolled.png`). The user-local `sys` SHA-256 + is `1d356c8e2b8c1bcdbaf6b59bb329ce2df283e32d07c8d2393b88f699b3581df8`; + the user-local QML is updated and Assistant reconnected. No installation + was approved. A fresh ISO remains gated by 8 GiB free versus 20 GiB + required by `make doctor`. + - **Source review coverage correction (2026-10-03):** The prior note's claim that vendor Portage packages were covered by a separate lane was incomplete: vendor binary ebuilds can resolve as Portage source. AI install proposals now diff --git a/docs/STATUS.md b/docs/STATUS.md index 7768fe9..44fdb26 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -48,6 +48,21 @@ disposable VM; `serial-driver.py recovery` now automates the same check. ## Matrix +Assistant plan details (2026-10-03): the GUI review panel displays candidate +identity and reported version, source-health status and evidence, planned +actions, effects, rationale, alternatives, post-execution verification, and +digest instead of repeating the summary. The bridge supplies structured +health and readable action/alternative descriptions. A prepared plan now +describes artifact verification as an installation-time check, not as already +complete. Rust format, strict clippy, workspace tests, `make check`, and +dynamic/static release builds pass. The running VM staged a Firefox Flatpak +plan and scrolled the expanded card to its digest +(`/var/tmp/phoebus-vm/details-scrolled.png`); no package was installed. The +VM user's `~/.local/bin/sys` is SHA-256 +`1d356c8e2b8c1bcdbaf6b59bb329ce2df283e32d07c8d2393b88f699b3581df8`. +The root-owned binary and fresh ISO remain older until a new image is built; +`make doctor` reports 8 GiB free against the 20 GiB VM gate. + Package source review coverage correction (2026-10-03): AI install proposals from every lane now require `inspect_candidate`, including Portage source and binary candidates that may encapsulate vendor software. The broker uses fresh diff --git a/installer-rs/crates/phoebus-installer/src/assistant_bridge.rs b/installer-rs/crates/phoebus-installer/src/assistant_bridge.rs index ebba93b..f15cf7e 100644 --- a/installer-rs/crates/phoebus-installer/src/assistant_bridge.rs +++ b/installer-rs/crates/phoebus-installer/src/assistant_bridge.rs @@ -254,10 +254,15 @@ fn plan_response(id: u64, kind: &str, plan: &PreparedPlan) -> BridgeResponse { "backend": plan.candidate.as_ref().map(|c| c.backend.as_str()), "source": plan.source, "chosen": plan.candidate, + "health": plan.candidate.as_ref().map(chooser::candidate_health), "alternatives": plan.alternatives, + "alternative_descriptions": plan.alternatives.iter().map(|other| { + format!("{} ({}): {}", other.id, other.backend.as_str(), other.reason.explain()) + }).collect::>(), "rationale": plan.rationale, "action": plan.actions.first(), "actions": plan.actions, + "action_descriptions": plan.actions.iter().map(SystemAction::describe).collect::>(), "digest": plan.digest, "effects": plan.effects.effects, "warnings": plan.warnings, diff --git a/installer-rs/crates/phoebus-installer/src/service/mod.rs b/installer-rs/crates/phoebus-installer/src/service/mod.rs index 60677da..f6f1eb3 100644 --- a/installer-rs/crates/phoebus-installer/src/service/mod.rs +++ b/installer-rs/crates/phoebus-installer/src/service/mod.rs @@ -148,7 +148,7 @@ impl PreparedPlan { out.push_str(&format!( " integrity: {}\n", if c.verified { - "verified (signature/hash)" + "backend reports candidate; artifact not yet verified" } else { "UNVERIFIED — provenance not cryptographic" } diff --git a/installer/live/desktop/phoebus-assistant/shell.qml b/installer/live/desktop/phoebus-assistant/shell.qml index cddabc3..5e3d892 100644 --- a/installer/live/desktop/phoebus-assistant/shell.qml +++ b/installer/live/desktop/phoebus-assistant/shell.qml @@ -284,6 +284,75 @@ ShellRoot { }); } + function reviewDetails(data) { + const d = data || {}; + const lines = []; + const chosen = d.chosen; + if (chosen) { + lines.push("PACKAGE"); + lines.push(" ID: " + chosen.id); + lines.push(" Backend: " + chosen.backend); + lines.push(" Reported version: " + (chosen.version || "unknown")); + if (!d.health) + lines.push(" Source: " + (chosen.provenance || d.source || "unknown")); + if (chosen.download_mib !== null && chosen.download_mib !== undefined) + lines.push(" Download: about " + chosen.download_mib + " MiB"); + if (chosen.install_mib !== null && chosen.install_mib !== undefined) + lines.push(" On disk: about " + chosen.install_mib + " MiB"); + if (chosen.permissions && chosen.permissions.length > 0) + lines.push(" Requested permissions: " + chosen.permissions.join(", ")); + } + if (d.health) { + const h = d.health; + lines.push("SOURCE CHECK"); + lines.push(" Status: " + (h.status || "unknown").replace(/_/g, " ")); + lines.push(" " + h.source); + lines.push(" Integrity: " + h.integrity); + lines.push(" Freshness: " + h.freshness); + lines.push(" Isolation: " + h.isolation); + lines.push(" Limit: " + h.limitation); + } else if (d.source) { + lines.push("SOURCE"); + lines.push(" " + d.source); + } + const actions = d.action_descriptions || []; + if (actions.length > 0) { + lines.push("PLANNED ACTIONS"); + for (let i = 0; i < actions.length; i++) + lines.push(" • " + actions[i]); + } + const effects = d.effects || []; + if (effects.length > 0) { + lines.push("PACKAGE EFFECTS"); + for (let i = 0; i < effects.length; i++) + lines.push(" • " + (effects[i].kind || "change") + " " + effects[i].target); + } + const reasons = d.rationale || []; + if (reasons.length > 0) { + lines.push("WHY THIS PLAN"); + for (let i = 0; i < reasons.length; i++) + lines.push(" • " + reasons[i]); + } + const alternatives = d.alternative_descriptions || []; + if (alternatives.length > 0) { + lines.push("ALTERNATIVES"); + for (let i = 0; i < alternatives.length; i++) + lines.push(" • " + alternatives[i]); + } + if (d.verification) { + lines.push("AFTER EXECUTION"); + lines.push(" " + d.verification); + } + return lines.join("\n"); + } + + function reviewWarnings(data) { + const d = data || {}; + const warnings = (d.warnings || []).filter(w => + !d.health || (!w.startsWith("Source health:") && w !== d.health.limitation)); + return warnings.join("\n"); + } + function showPanel() { shell.panelOpen = true; focusTimer.start(); @@ -672,33 +741,17 @@ ShellRoot { Label { Layout.fillWidth: true wrapMode: Text.Wrap - visible: modelData.data ? !!modelData.data.recommendation : false - text: modelData.data ? modelData.data.recommendation : "" + textFormat: Text.PlainText + text: shell.reviewDetails(modelData.data) color: Theme.text font.pixelSize: 12 } - Label { - text: "Source: " + (modelData.data ? (modelData.data.source || "-") : "-") - color: Theme.muted - font.pixelSize: 12 - } Label { Layout.fillWidth: true wrapMode: Text.Wrap - visible: modelData.data && modelData.data.effects && modelData.data.effects.length > 0 - text: { - if (!modelData.data || !modelData.data.effects) - return ""; - return "Effects: " + modelData.data.effects.map(e => (e.kind || "?") + " " + e.target).join(", "); - } - color: Theme.muted - font.pixelSize: 12 - } - Label { - Layout.fillWidth: true - wrapMode: Text.Wrap - visible: modelData.data && modelData.data.warnings && modelData.data.warnings.length > 0 - text: modelData.data ? "Warnings: " + (modelData.data.warnings || []).join("; ") : "" + textFormat: Text.PlainText + visible: shell.reviewWarnings(modelData.data).length > 0 + text: "Warnings:\n" + shell.reviewWarnings(modelData.data) color: Theme.warning font.pixelSize: 12 }