fix(desktop): launch assistant and ready Snap on desktops
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-10-01 09:08:49 -07:00
parent ba78284747
commit fd23aa4890
10 changed files with 104 additions and 69 deletions

View file

@ -5,6 +5,20 @@ this file is the curated, human-readable summary.
## Unreleased — Fast defaults with user-controlled source builds ## Unreleased — Fast defaults with user-controlled source builds
- **Assistant startup and Snap availability (2026-10-01).** Fixed the installed
assistant's Quickshell window: `FloatingWindow` rejected `palette` and
`minimumHeight`, so the configuration never loaded. The palette now belongs
to a Controls ancestor, window size uses implicit dimensions, and model
status follows the bridge's asynchronous handshake and shows a connecting
message while it is pending. New Mango desktops install `snapd` and enable
its socket so `sys find` can query the Snap Store
after boot. Existing desktops can use the reviewed first-use commands in
`docs/SYS.md`. The final assistant QML opened in the disposable graphical
VM and reached `Connected (opencode)` after its handshake. In that older VM,
reviewed `sys` actions installed `snapd` 2.63 and activated `snapd.socket`;
`snap find` and `sys find glances` returned Store results with the Snap lane
ready. The new desktop default awaits a fresh installed VM check.
- **Readable `sys` progress (2026-10-01).** The terminal now names the active - **Readable `sys` progress (2026-10-01).** The terminal now names the active
planning, evidence, effect-checking, execution and verification steps, shows planning, evidence, effect-checking, execution and verification steps, shows
a slow command's operation, and repeats the current step every ten seconds. a slow command's operation, and repeats the current step every ten seconds.

View file

@ -3,6 +3,24 @@
Rolling note between work sessions. **Update this file before you finish**, then 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. commit it. It should be short and current; use `git log` for detail.
- **Assistant launch and Snap desktop default (2026-10-01):** The visible
playground exposed a Quickshell configuration error at `shell.qml:223`:
`FloatingWindow` has no `palette`; after removing that error, it rejected
`minimumHeight`. The corrected QML loaded and showed the assistant window
in the disposable VM. A second issue was a startup race: the shell asked
the bridge before its process started and retained a false offline state.
The shell now applies the completed handshake and loads user state then;
the final QML opened in the disposable VM and showed `Connected (opencode)`.
New Mango installs include `app-containers/snapd` and enable
`snapd.socket`. The existing playground predates this; reviewed `sys`
actions installed `snapd` 2.63 and enabled/started its socket there.
`snap find glances` returned Store results, and `sys find glances` completed
with a Snap match and all three package lanes ready. Rust format, Clippy,
tests, release build and `make test` pass. The playground was restarted
from its validated disposable overlay. A fresh ISO/install remains required
for release evidence; host free space was 11 GiB versus the 20 GiB VM
threshold in `make doctor`.
- **`sys` terminal presentation (2026-10-01, overlay VM VERIFIED):** - **`sys` terminal presentation (2026-10-01, overlay VM VERIFIED):**
Human CLI runs now show the current planning, evidence, effects, execution Human CLI runs now show the current planning, evidence, effects, execution
and verification phase; slow commands identify their operation and long and verification phase; slow commands identify their operation and long

View file

@ -134,7 +134,7 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
| Transaction log (outcomes, protective snapshots) | yes | yes | read-only in installed VM; write path needs root | no | | Transaction log (outcomes, protective snapshots) | yes | yes | read-only in installed VM; write path needs root | no |
| Flatpak/Nix bounded typed actions | yes | yes | no | no | | Flatpak/Nix bounded typed actions | yes | yes | no | no |
| Shared hardware-aware source selection (all lanes) | yes | yes | no | no | | Shared hardware-aware source selection (all lanes) | yes | yes | no | no |
| Snap lane (detect/install/list/remove/refresh/connections) | yes (reviewed first-use setup) | yes (incl. exact revisions and confinement) | partial (VM: Portage snapd, active socket, `hello-world` install/list/refresh/remove; partial confinement; refresh had no newer revision; connections not exercised. **Re-checked 2026-09-26 against the live Store**: `hello-world` still 6.4 rev 29 on every channel, refresh reports no updates; guest has no `aa-status`, confinement still `partial`. A revision-changing refresh and strict confinement stay blocked on a Store revision + AppArmor-ready guest) | no | | Snap lane (detect/install/list/remove/refresh/connections) | yes (snapd and socket enabled by default on new Mango desktops; reviewed first-use setup for older/minimal installs) | yes (incl. exact revisions and confinement; default package/service assertions) | partial (VM: Portage snapd, active socket, `hello-world` install/list/refresh/remove; partial confinement; refresh had no newer revision; connections not exercised. **Re-checked 2026-09-26 against the live Store**: `hello-world` still 6.4 rev 29 on every channel, refresh reports no updates; guest has no `aa-status`, confinement still `partial`. **2026-10-01 existing playground overlay:** reviewed `sys` actions installed `snapd` 2.63 and activated its socket; `snap find glances` and `sys find glances` returned Store results. The new default has no fresh-install VM run yet. A revision-changing refresh and strict confinement stay blocked on a Store revision + AppArmor-ready guest) | no |
| AppImage lane (import/acquire/integrity/desktop/remove) | yes | yes | yes (VM: acquire with pinned SHA, list, launch fixture, remove; tampered SHA refused) | no | | AppImage lane (import/acquire/integrity/desktop/remove) | yes | yes | yes (VM: acquire with pinned SHA, list, launch fixture, remove; tampered SHA refused) | no |
| Custom ebuild overlay (stage/approve/build/remove) | yes | yes | yes (VM: stage → build/install → VDB+file present → remove) | no | | Custom ebuild overlay (stage/approve/build/remove) | yes | yes | yes (VM: stage → build/install → VDB+file present → remove) | no |
| `sys` installed into the target + verified in chroot | yes | yes (unit) | yes (detached boot verified) | no | | `sys` installed into the target + verified in chroot | yes | yes (unit) | yes (detached boot verified) | no |
@ -187,7 +187,7 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
| NVIDIA live GPU decision + real nouveau fallback | yes | yes (fixtures + CLI) | no | no | | NVIDIA live GPU decision + real nouveau fallback | yes | yes (fixtures + CLI) | no | no |
| Live GUI broker scoped sudoers (no `NOPASSWD: ALL`) | yes | yes (`visudo`) | no | n/a | | Live GUI broker scoped sudoers (no `NOPASSWD: ALL`) | yes | yes (`visudo`) | no | n/a |
| Rollback acceptance harness mode | yes | yes (bash -n/unit + vacuous-pass guards) | yes (destructive gate `serial-rollback-20260926T030237Z-912f6386` PASS=11 FAIL=0; root-marker creation is mandatory and asserted present before undo, absent after the detached reboot) | no | | Rollback acceptance harness mode | yes | yes (bash -n/unit + vacuous-pass guards) | yes (destructive gate `serial-rollback-20260926T030237Z-912f6386` PASS=11 FAIL=0; root-marker creation is mandatory and asserted present before undo, absent after the detached reboot) | no |
| Desktop assistant GUI (`phoebus-assistant`) | yes | yes | yes (live VM layout) | no | | Desktop assistant GUI (`phoebus-assistant`) | yes | yes (asset/sizing checks) | partial (2026-10-01 disposable installed VM: final QML window loaded and showed `Connected (opencode)` after bridge handshake; prompt execution not exercised; earlier live VM layout) | no |
| Desktop assistant JSON-RPC bridge (`sys --assistant-bridge`) | yes | yes | yes (acceptance matrix) | n/a | | Desktop assistant JSON-RPC bridge (`sys --assistant-bridge`) | yes | yes | yes (acceptance matrix) | n/a |
| AI-first administration contract (`sys install`, `please`, `ask`) | yes | yes | yes (acceptance matrix) | no | | AI-first administration contract (`sys install`, `please`, `ask`) | yes | yes | yes (acceptance matrix) | no |
| Deterministic `--legacy` administration (fail-closed source choice) | yes | yes | yes (acceptance matrix) | n/a | | Deterministic `--legacy` administration (fail-closed source choice) | yes | yes | yes (acceptance matrix) | n/a |

View file

@ -205,7 +205,7 @@ installs anything and never fabricates a candidate.
| --- | --- | --- | | --- | --- | --- |
| `nix prepare nodejs python312` | `nix_prepare` | mutate | | `nix prepare nodejs python312` | `nix_prepare` | mutate |
### Snap (opt-in; `app-containers/snapd` through Portage) ### Snap (`app-containers/snapd` through Portage)
| Phrase | Typed action | Kind | | Phrase | Typed action | Kind |
| --- | --- | --- | | --- | --- | --- |
@ -217,11 +217,10 @@ installs anything and never fabricates a candidate.
| `snap refresh [name]` | `snap_refresh` | mutate | | `snap refresh [name]` | `snap_refresh` | mutate |
| `snap connections thunderbird` | `snap_connections` | read | | `snap connections thunderbird` | `snap_connections` | read |
Snap requires a ready `snapd` daemon. A Snap install does not silently install New Phoebus desktop installs include `snapd` and enable `snapd.socket`; systemd
the Portage dependency; that dependency receives its own review and approval. starts the socket on boot. Snap application installs still receive their own
The normal `sys install <app> --legacy --snap` workflow must confirm the app review and approval. Systems installed before this change, and minimal
against the Snap Store before approval, so its first use requires a separate, installations, need a separate reviewed setup step:
reviewed setup step:
```sh ```sh
sys install app-containers/snapd --legacy --portage sys install app-containers/snapd --legacy --portage

View file

@ -63,7 +63,7 @@ used by both the deterministic `sys` front-end and the assistant.
| **Portage vendor (`-bin`/`-launcher`)** | vendor blobs (`google-chrome`, `steam-launcher`, `discord-bin`, …) | vendor ebuild present | | **Portage vendor (`-bin`/`-launcher`)** | vendor blobs (`google-chrome`, `steam-launcher`, `discord-bin`, …) | vendor ebuild present |
| **Flatpak** | sandboxed graphical applications; multi-distro binaries | always (default desktop) | | **Flatpak** | sandboxed graphical applications; multi-distro binaries | always (default desktop) |
| **Nix** | developer tools, alternate versions, reproducible per-project environments | always, user-level use | | **Nix** | developer tools, alternate versions, reproducible per-project environments | always, user-level use |
| **Snap** | applications distributed as snaps, when the user wants the Snap Store and its channel/refresh model | opt-in; `app-containers/snapd` through Portage | | **Snap** | applications distributed as snaps, when the user wants the Snap Store and its channel/refresh model | ready on the default desktop; `app-containers/snapd` through Portage, with socket activation |
| **AppImage** | a single-file application with no maintained package, adopted with pinned integrity | opt-in, managed inventory | | **AppImage** | a single-file application with no maintained package, adopted with pinned integrity | opt-in, managed inventory |
| **Custom ebuild** | a maintained package that is unsuitable or absent and cannot be met otherwise | Phoebus overlay, approval-gated | | **Custom ebuild** | a maintained package that is unsuitable or absent and cannot be met otherwise | Phoebus overlay, approval-gated |

View file

@ -60,6 +60,8 @@ pub fn mango_desktop_packages() -> Vec<&'static str> {
"gui-apps/dankmaterialshell", "gui-apps/dankmaterialshell",
"gui-apps/danksearch", "gui-apps/danksearch",
"gui-apps/quickshell", "gui-apps/quickshell",
// Keep the Snap application lane ready on installed desktops.
"app-containers/snapd",
"dev-vcs/git", "dev-vcs/git",
"sys-apps/accountsservice", "sys-apps/accountsservice",
"sys-power/upower", "sys-power/upower",
@ -2608,6 +2610,7 @@ mod tests {
#[test] #[test]
fn desktop_includes_portals_for_flatpak_and_wayland() { fn desktop_includes_portals_for_flatpak_and_wayland() {
let pkgs = desktop_packages(DesktopProfile::Mango); let pkgs = desktop_packages(DesktopProfile::Mango);
assert!(pkgs.contains(&"app-containers/snapd"));
assert!(pkgs.contains(&"sys-apps/xdg-desktop-portal")); assert!(pkgs.contains(&"sys-apps/xdg-desktop-portal"));
assert!(pkgs.contains(&"sys-apps/xdg-desktop-portal-gtk")); assert!(pkgs.contains(&"sys-apps/xdg-desktop-portal-gtk"));
assert!(pkgs.contains(&"gui-libs/xdg-desktop-portal-wlr")); assert!(pkgs.contains(&"gui-libs/xdg-desktop-portal-wlr"));

View file

@ -210,6 +210,10 @@ pub fn configure_login(exec: &Exec, config: &InstallConfig) -> Result<()> {
) )
})?; })?;
} }
// snapd is part of the desktop package set. Socket activation keeps the
// daemon idle until needed while making `sys find` and installs available.
portage::chroot(exec, root, "systemctl", &["enable", "snapd.socket"])
.map_err(|e| ExecError::operation("desktop", "enable snapd socket", e.to_string()))?;
// Gentoo ships these user units disabled. A graphical login must start // Gentoo ships these user units disabled. A graphical login must start
// PipeWire and WirePlumber without requiring a per-user manual setup. // PipeWire and WirePlumber without requiring a per-user manual setup.
for unit in [ for unit in [
@ -621,6 +625,7 @@ mod tests {
// greetd is enabled and the greeter account is created. // greetd is enabled and the greeter account is created.
let commands: Vec<String> = runner.recorded().iter().map(|s| s.args.join(" ")).collect(); let commands: Vec<String> = runner.recorded().iter().map(|s| s.args.join(" ")).collect();
assert!(commands.iter().any(|a| a.contains("enable greetd"))); assert!(commands.iter().any(|a| a.contains("enable greetd")));
assert!(commands.iter().any(|a| a.contains("enable snapd.socket")));
assert!(commands.iter().any(|a| a.contains("useradd"))); assert!(commands.iter().any(|a| a.contains("useradd")));
for unit in [ for unit in [
"pipewire.socket", "pipewire.socket",

View file

@ -1,8 +1,8 @@
//! Snap as an optional sandboxed application lane. //! Snap as a sandboxed application lane on installed desktops.
//! //!
//! Snap is not part of a default Phoebus install. The user first reviews and //! New desktop installs include `app-containers/snapd` and enable its socket.
//! installs `app-containers/snapd` through Portage, then enables and starts //! Existing installs can add it through a reviewed Portage action, then enable
//! `snapd.socket`. Snaps are managed through the `snap` client. //! and start `snapd.socket`. Snaps are managed through the `snap` client.
//! //!
//! The lane is honest about its capabilities: the daemon must actually be ready, //! The lane is honest about its capabilities: the daemon must actually be ready,
//! application confinement is detected rather than assumed, and the classic //! application confinement is detected rather than assumed, and the classic

View file

@ -344,17 +344,12 @@ fn assistant_theme_tokens_never_drift() {
#[test] #[test]
fn assistant_layout_fits_small_vm_windows() { fn assistant_layout_fits_small_vm_windows() {
let shell = read("installer/live/desktop/phoebus-assistant/shell.qml"); let shell = read("installer/live/desktop/phoebus-assistant/shell.qml");
// No fixed 820x640-only behavior: a minimum size plus a scrollable tab // Quickshell FloatingWindow accepts implicit sizing, not minimumWidth or
// row so Send/Cancel/Details stay visible at 1024x768, 1280x720 and // minimumHeight. The content and tab row scroll at smaller sizes.
// increased UI scale. assert!(shell.contains("implicitWidth: 820"));
assert!( assert!(shell.contains("implicitHeight: 640"));
shell.contains("minimumWidth"), assert!(!shell.contains("minimumWidth:"));
"assistant has no minimumWidth" assert!(!shell.contains("minimumHeight:"));
);
assert!(
shell.contains("minimumHeight"),
"assistant has no minimumHeight"
);
assert!( assert!(
shell.contains("Flickable") || shell.contains("Flow") || shell.contains("ScrollView"), shell.contains("Flickable") || shell.contains("Flow") || shell.contains("ScrollView"),
"tab row never wraps or scrolls" "tab row never wraps or scrolls"

View file

@ -21,6 +21,7 @@ ShellRoot {
property string aiBackend: "direct" property string aiBackend: "direct"
property string aiError: "" property string aiError: ""
readonly property bool assistantConnected: AssistantBridge.ready && shell.aiConfigured readonly property bool assistantConnected: AssistantBridge.ready && shell.aiConfigured
readonly property bool bridgeConnecting: AssistantBridge.handshake === null && !AssistantBridge.crashed
// Theme: dark by default (charcoal/warm-white/amber), light available, // Theme: dark by default (charcoal/warm-white/amber), light available,
// selection persists through preferences when the backend keeps it. // selection persists through preferences when the backend keeps it.
property string themeMode: "dark" property string themeMode: "dark"
@ -30,15 +31,31 @@ ShellRoot {
Component.onCompleted: { Component.onCompleted: {
Theme.themeMode = shell.themeMode; Theme.themeMode = shell.themeMode;
AssistantBridge.start(); AssistantBridge.start();
refreshStatus(); }
// Apply a persisted theme selection when the backend kept it.
// The process starts asynchronously. Apply its handshake only when it
// arrives, then load the user's state; startup calls otherwise report a
// false offline error and leave the assistant disabled for the session.
Connections {
target: AssistantBridge
function onHandshakeReady() {
const result = AssistantBridge.handshake || {};
shell.aiConfigured = !!result.ai_configured;
shell.aiBackend = result.ai_backend || "direct";
shell.aiError = "";
AssistantBridge.getProactiveAlerts(reply => {
if (reply.ok && reply.result)
shell.activeAlerts = reply.result.alerts || [];
});
AssistantBridge.getPreferences(reply => { AssistantBridge.getPreferences(reply => {
if (reply.ok && reply.result && reply.result.theme) { if (reply.ok && reply.result) {
shell.preferences = reply.result;
if (reply.result.theme)
shell.themeMode = reply.result.theme === "light" ? "light" : "dark"; shell.themeMode = reply.result.theme === "light" ? "light" : "dark";
Theme.themeMode = shell.themeMode;
} }
}); });
} }
}
onCurrentTabChanged: { onCurrentTabChanged: {
if (currentTab === "updates" && !shell.updateOverview && !shell.busy) { if (currentTab === "updates" && !shell.updateOverview && !shell.busy) {
@ -48,29 +65,11 @@ ShellRoot {
function refreshStatus() { function refreshStatus() {
AssistantBridge.refreshHandshake(reply => { AssistantBridge.refreshHandshake(reply => {
if (reply.ok && reply.result) { if (!reply.ok) {
shell.aiConfigured = !!reply.result.ai_configured;
shell.aiBackend = reply.result.ai_backend || "direct";
shell.aiError = "";
} else {
shell.aiConfigured = false; shell.aiConfigured = false;
shell.aiError = reply.error || "The assistant broker did not answer."; shell.aiError = reply.error || "The assistant broker did not answer.";
} }
}); });
AssistantBridge.getProactiveAlerts(reply => {
if (reply.ok && reply.result) {
shell.activeAlerts = reply.result.alerts || [];
}
});
AssistantBridge.getPreferences(reply => {
if (reply.ok && reply.result) {
shell.preferences = reply.result;
if (reply.result.theme) {
shell.themeMode = reply.result.theme === "light" ? "light" : "dark";
Theme.themeMode = shell.themeMode;
}
}
});
} }
function toggleTheme() { function toggleTheme() {
@ -212,14 +211,15 @@ ShellRoot {
id: window id: window
title: "Phoebus Assistant" title: "Phoebus Assistant"
color: "transparent" color: "transparent"
// Responsive: a sensible default that fits 1024x768 and 1280x720, // Default fits 1024x768 and 1280x720. Content areas scroll at
// resizable down to a usable minimum at increased UI scale. The // smaller window sizes and increased UI scale.
// content areas scroll, so nothing essential clips. implicitWidth: 820
width: 820 implicitHeight: 640
height: 640 // FloatingWindow has no palette property. A Control provides an
minimumWidth: 600 // inherited palette for the Qt Quick Controls inside this window.
minimumHeight: 450 Control {
// Qt Quick Controls follow the Phoebus palette (dark default). anchors.fill: parent
padding: 0
palette.window: Theme.background palette.window: Theme.background
palette.windowText: Theme.text palette.windowText: Theme.text
palette.base: Theme.card palette.base: Theme.card
@ -261,7 +261,7 @@ ShellRoot {
} }
Label { Label {
text: shell.assistantConnected ? "Connected (" + shell.aiBackend + ")" : (AssistantBridge.ready ? "Setup required" : "Offline") text: shell.assistantConnected ? "Connected (" + shell.aiBackend + ")" : (shell.bridgeConnecting ? "Connecting…" : (AssistantBridge.ready ? "Setup required" : "Offline"))
color: Theme.muted color: Theme.muted
font.pixelSize: 12 font.pixelSize: 12
} }
@ -353,7 +353,7 @@ ShellRoot {
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: AssistantBridge.ready ? ("No AI model is connected" + (shell.aiError ? ": " + shell.aiError : ". Connect a provider or use Legacy Admin.") ) : "The assistant broker is not running." text: shell.bridgeConnecting ? "Connecting to the assistant broker…" : (AssistantBridge.ready ? ("No AI model is connected" + (shell.aiError ? ": " + shell.aiError : ". Connect a provider or use Legacy Admin.")) : "The assistant broker is not running.")
color: Theme.text color: Theme.text
font.pixelSize: 12 font.pixelSize: 12
} }
@ -1026,4 +1026,5 @@ ShellRoot {
} }
} }
} }
}
} }