feat(desktop): seat management, thunderbird-bin fast default, AI timeout
Some checks failed
ci / test (push) Has been cancelled
Some checks failed
ci / test (push) Has been cancelled
P0 seat fix: sys-auth/seatd installed and enabled before greetd, gui-libs/libseat with systemd+builtin+server USE, seat in default user groups, greeter in video/input/render/seat, and a bounded 3 s seat wait in phoebus-session-mango (LIBSEAT_BACKEND deliberately unset so every compiled backend stays available). P1 fast install: mail-client/thunderbird-bin replaces the source build in workstation_packages; Thunderbird joins fast_default_deliveries and SOURCE_CONVERSIONS (source target mail-client/thunderbird, honest 45-90 min estimate), the preference-neutrality guard covers it, and the first-login welcome names it. All lanes and the mandatory-AI install requirement are unchanged. AI robustness: CurlTransport max-time 120 s -> 300 s default, overrideable via PHOEBUS_AI_TIMEOUT (fail-closed parsing; zero refused) for both direct and sandboxed sends. Verified: cargo fmt --check, clippy --workspace --all-targets -- -D warnings, cargo test --workspace 759/759 (was 757), bash -n on the session script. Seat-VM reverification, thunderbird VM journeys, and live CPU-inference proof are NotRun (no VM run this session).
This commit is contained in:
parent
5369a89b4b
commit
9573f2e37a
10 changed files with 252 additions and 25 deletions
|
|
@ -74,6 +74,33 @@ this file is the curated, human-readable summary.
|
|||
sessions and adds `~/.local/bin` to `PATH`. Verified: `zsh -n` clean on
|
||||
both files, interactive startup smoke test, 757 workspace tests green;
|
||||
installed-session behavior awaits the disposable VM.
|
||||
- **Seat management (P0 desktop blocker fix, unit-tested, seat VM pending).**
|
||||
`sys-auth/seatd` joins the Mango set and is enabled before `greetd`
|
||||
(`desktop_login_services`), `gui-libs/libseat` gets `systemd builtin
|
||||
server`, the default user groups gain `seat`, the greeter is created with
|
||||
`-G video,input,render,seat` (plus best-effort `seat` membership on
|
||||
re-runs), and `phoebus-session-mango` waits boundedly (3 s) for
|
||||
`/run/seatd.sock` or a logind session before starting Mango —
|
||||
`LIBSEAT_BACKEND` stays unset so every compiled backend remains available.
|
||||
Verified: workspace suite 759/759 (was 757), `bash -n` on the session
|
||||
script; the seat-VM reverification (tuigreet login → Mango socket, no
|
||||
libseat error) is NotRun.
|
||||
- **Thunderbird fast default + source conversion.** `workstation_packages`
|
||||
installs `mail-client/thunderbird-bin` (signed vendor binary, ~80 MiB
|
||||
download, no ~1 h compile); `fast_default_deliveries` and
|
||||
`SOURCE_CONVERSIONS` gain Thunderbird (source target
|
||||
`mail-client/thunderbird`, 45–90 min, ~18 GiB temp), the preference
|
||||
neutrality guard covers it, and the first-login welcome names it alongside
|
||||
Firefox/LibreOffice/Calibre/GIMP. `sys build thunderbird from source
|
||||
--legacy` flows through the existing reviewed approval/broker path.
|
||||
Installed-identity and conversion-journey VM checks are NotRun.
|
||||
- **AI transport timeout.** `CurlTransport` `max-time` is now 300 s by
|
||||
default (was 120 s, which aborted local CPU inference with `curl exit
|
||||
28`) and overrideable via `PHOEBUS_AI_TIMEOUT` (unparseable/zero values
|
||||
fall back to 300; zero is refused since curl reads it as "no timeout").
|
||||
Applies to both direct and sandboxed sends. The mandatory-AI install
|
||||
requirement is unchanged (fail-closed without a model or `--no-ai`); all
|
||||
six package lanes are untouched.
|
||||
- **Not VM-verified this session.** A fresh ISO was built from the
|
||||
fast-defaults commit and content-verified (`fastdefaults.iso`, 1.6 GiB,
|
||||
`ad9cddb2…`, build `20260926T145700Z` from `e747baf`; embedded
|
||||
|
|
|
|||
|
|
@ -3,6 +3,17 @@
|
|||
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.
|
||||
|
||||
- **Seat/thunderbird/AI-timeout session (IMPLEMENTED + UNIT-TESTED, VM NOT RUN):**
|
||||
P0 seat fix (seatd pkg + enabled before greetd, libseat systemd/builtin/
|
||||
server USE, `seat` in default groups, greeter `-G video,input,render,seat`,
|
||||
3 s bounded seat wait in the session script, `LIBSEAT_BACKEND` deliberately
|
||||
unset), thunderbird-bin fast default + `SOURCE_CONVERSIONS` entry + welcome
|
||||
text (all lanes untouched; mandatory-AI requirement unchanged), and
|
||||
`CurlTransport` timeout 120 s → 300 s default via `PHOEBUS_AI_TIMEOUT`
|
||||
(fail-closed parsing). Gates: fmt, clippy `--workspace --all-targets -- -D
|
||||
warnings`, 759/759 tests (was 757), `bash -n` session script. Seat-VM
|
||||
reverification, thunderbird installed-identity/conversion journey, and live
|
||||
CPU-inference timeout proof are NotRun (no VM run this session).
|
||||
- **Zsh modernization (2026-09-26, IMPLEMENTED + UNIT-TESTED, VM NOT RUN):**
|
||||
rewrote `ZSH_SKEL_RC` (color fix, cached compinit, Kitty keybindings,
|
||||
`INC_APPEND_HISTORY`, vcs_info git branch, exit-status prompt) and added
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ Booting that recovery entry offline remains a manual gate.
|
|||
| PipeWire/WirePlumber | yes | no | headless (`wpctl`) | no |
|
||||
| Flatpak + flathub | yes | no | installed + remote | no |
|
||||
| Fast-default Flatpaks (Calibre/GIMP/Flatseal, system-wide, target-only) | yes | yes (install/verify/provisioning; fail-closed on missing app) | no (launch, icons, MIME, updates after reboot not run) | no |
|
||||
| Fast `-bin` defaults (firefox-bin/libreoffice-bin, fail-closed) | yes | yes (atoms, policy, binary-capability refusal) | no (installed identity not verified in a VM) | no |
|
||||
| Fast `-bin` defaults (firefox-bin/libreoffice-bin/thunderbird-bin, fail-closed) | yes | yes (atoms, policy, binary-capability refusal) | no (installed identity not verified in a VM) | no |
|
||||
| Single generic kernel default (no second generic kernel) | yes | yes (guard + tuned path keeps the fallback) | yes (existing boot path unchanged) | no |
|
||||
| User-initiated source builds (`convert_to_source`) | yes | yes (table, review, build-before-remove, Brave/unknown refusals) | no (no conversion journey run in a VM) | no |
|
||||
| User-initiated source builds (`convert_to_source`) | yes | yes (table incl. thunderbird, review, build-before-remove, Brave/unknown refusals) | no (no conversion journey run in a VM) | no |
|
||||
| Tuned-kernel build (`build_tuned_kernel`, separate BLS, fallback kept) | yes | yes (refusal without fallback, entry creation, default never blind-switched) | no (no build/boot-test in a VM) | no |
|
||||
| Installed first-login welcome (once per user, reopenable, non-blocking) | yes | yes (assets, launcher, autostart, QML guards, DMS seed) | no (first login + graphical checks not run) | no |
|
||||
| Install metrics (time, download, peak disk, installed size) | yes | yes (report rendering; orchestration hooks) | no (no measured install yet) | no |
|
||||
|
|
@ -374,9 +374,12 @@ Booting that recovery entry offline remains a manual gate.
|
|||
`docs/VM-BOOT-VERIFICATION.md`.) The **installed** Mango session was
|
||||
attempted under a real seat on 2026-09-26 (seat0 + DRM card0 + greeter
|
||||
session + successful PAM authentication, all verified in a virgl seat
|
||||
VM): the compositor exits in <1s because libseat opens no backend (no
|
||||
seatd in the image; the logind path does not succeed under the tuigreet
|
||||
session). Greeter login works; kitty, DMS spotlight, lock/idle, the
|
||||
VM): the compositor exits in <1s because libseat opens no backend (no
|
||||
seatd in the image; the logind path does not succeed under the tuigreet
|
||||
session). Seat fix implemented + unit-tested (seatd installed and enabled
|
||||
before greetd, `gui-libs/libseat systemd builtin server`, user and greeter
|
||||
in the `seat` group, bounded seat wait in the session script);
|
||||
seat-VM reverification pending. Greeter login works; kitty, DMS spotlight, lock/idle, the
|
||||
polkit agent, logout, reboot and the compositor itself stay unverified —
|
||||
the libseat failure is the blocker, with the exact error recorded in
|
||||
`docs/VM-BOOT-VERIFICATION.md`.
|
||||
|
|
|
|||
|
|
@ -160,7 +160,9 @@ impl Default for UserConfig {
|
|||
Self {
|
||||
username: String::new(),
|
||||
fullname: "Phoebus User".into(),
|
||||
groups: split_list("wheel,audio,video,input,render,plugdev,libinput,network,power"),
|
||||
groups: split_list(
|
||||
"wheel,audio,video,input,render,plugdev,libinput,network,power,seat",
|
||||
),
|
||||
home: "/home".into(),
|
||||
}
|
||||
}
|
||||
|
|
@ -707,7 +709,7 @@ mod tests {
|
|||
fn defaults_match_bash_baseline() {
|
||||
let c = InstallConfig::default();
|
||||
assert_eq!(c.system.hostname, "phoebus");
|
||||
assert_eq!(c.user.groups.len(), 9);
|
||||
assert_eq!(c.user.groups.len(), 10);
|
||||
assert_eq!(c.storage.filesystem, Filesystem::Btrfs);
|
||||
assert_eq!(c.encryption.mode, Encryption::Luks2);
|
||||
assert_eq!(c.encryption.name, "cryptroot");
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ pub fn fast_default_deliveries() -> Vec<DeliveryEntry> {
|
|||
method: DeliveryMethod::PortageVendorBinary,
|
||||
expected_work: "download ~250 MiB prebuilt binary, no local compile",
|
||||
},
|
||||
DeliveryEntry {
|
||||
name: "Thunderbird",
|
||||
identity: "mail-client/thunderbird-bin",
|
||||
method: DeliveryMethod::PortageVendorBinary,
|
||||
expected_work: "download ~80 MiB prebuilt binary, no local compile",
|
||||
},
|
||||
DeliveryEntry {
|
||||
name: "Calibre",
|
||||
identity: "com.calibre_ebook.calibre (Flathub, system)",
|
||||
|
|
@ -135,6 +141,13 @@ pub const SOURCE_CONVERSIONS: &[SourceConversion] = &[
|
|||
expected_time: "typically 1–3 h on 8 vCPUs (measured history varies)",
|
||||
temp_disk: "needs ~20 GiB temporary build space",
|
||||
},
|
||||
SourceConversion {
|
||||
app: "thunderbird",
|
||||
installed_from: "mail-client/thunderbird-bin",
|
||||
source_atom: "mail-client/thunderbird",
|
||||
expected_time: "typically 45–90 min on 8 vCPUs (measured history varies)",
|
||||
temp_disk: "needs ~18 GiB temporary build space",
|
||||
},
|
||||
SourceConversion {
|
||||
app: "calibre",
|
||||
installed_from: "com.calibre_ebook.calibre (Flatpak)",
|
||||
|
|
@ -247,7 +260,7 @@ pub fn assert_no_installer_preference(
|
|||
system_wide: &HashMap<String, String>,
|
||||
personal: &HashMap<String, String>,
|
||||
) -> Result<(), String> {
|
||||
for app in ["firefox", "libreoffice", "calibre", "gimp"] {
|
||||
for app in ["firefox", "libreoffice", "thunderbird", "calibre", "gimp"] {
|
||||
if let Some(v) = system_wide.get(app) {
|
||||
return Err(format!(
|
||||
"installer must not set a system-wide preference for {app} (found {v})"
|
||||
|
|
@ -344,6 +357,7 @@ mod tests {
|
|||
.collect();
|
||||
assert!(ids.iter().any(|i| i.contains("firefox-bin")));
|
||||
assert!(ids.iter().any(|i| i.contains("libreoffice-bin")));
|
||||
assert!(ids.iter().any(|i| i.contains("thunderbird-bin")));
|
||||
assert!(ids.iter().any(|i| i.contains("com.calibre_ebook.calibre")));
|
||||
assert!(ids.iter().any(|i| i.contains("org.gimp.GIMP")));
|
||||
assert!(ids.iter().any(|i| i.contains("Flatseal")));
|
||||
|
|
@ -354,8 +368,8 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn source_conversions_cover_four_apps_and_not_brave() {
|
||||
for app in ["firefox", "libreoffice", "calibre", "gimp"] {
|
||||
fn source_conversions_cover_five_apps_and_not_brave() {
|
||||
for app in ["firefox", "libreoffice", "thunderbird", "calibre", "gimp"] {
|
||||
let conv = source_conversion(app).unwrap_or_else(|| panic!("missing {app}"));
|
||||
let review = source_conversion_review(conv);
|
||||
assert!(review.contains(conv.source_atom));
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ impl PackagePolicyEngine {
|
|||
("www-client/chromium", 7200),
|
||||
("app-office/libreoffice", 5400),
|
||||
("app-office/libreoffice-bin", 0),
|
||||
("mail-client/thunderbird-bin", 0),
|
||||
("dev-qt/qtbase", 900),
|
||||
("kde-plasma/plasma-desktop", 600),
|
||||
("net-im/discord-bin", 0),
|
||||
|
|
@ -111,6 +112,7 @@ impl PackagePolicyEngine {
|
|||
"app-office/libreoffice",
|
||||
"app-office/libreoffice-bin",
|
||||
"mail-client/thunderbird",
|
||||
"mail-client/thunderbird-bin",
|
||||
"dev-lang/rust",
|
||||
"dev-lang/llvm",
|
||||
"dev-qt/qtwebengine",
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ pub fn mango_desktop_packages() -> Vec<&'static str> {
|
|||
// Login & Greeter
|
||||
"gui-libs/greetd",
|
||||
"gui-apps/tuigreet",
|
||||
// Seat management: seatd backs libseat when the logind session is
|
||||
// absent or delayed (the P0 Mango crash was libseat finding no
|
||||
// backend under the tuigreet session). Enabled in
|
||||
// `desktop_login_services`; the user and greeter join the `seat`
|
||||
// group.
|
||||
"sys-auth/seatd",
|
||||
// Desktop portals
|
||||
"sys-apps/xdg-desktop-portal",
|
||||
"sys-apps/xdg-desktop-portal-gtk",
|
||||
|
|
@ -109,12 +115,15 @@ pub fn mango_desktop_packages() -> Vec<&'static str> {
|
|||
/// `package_use`).
|
||||
/// - `app-text/zathura` needs a PDF plugin; `app-text/zathura-pdf-mupdf` is
|
||||
/// included.
|
||||
/// - `app-office/libreoffice-bin` and `www-client/firefox-bin` are the
|
||||
/// maintained stable Gentoo binary redistributions used for the fast
|
||||
/// default install. They install prebuilt upstream binaries through
|
||||
/// Portage with full signature verification; they never fall back to a
|
||||
/// silent source build (see `fastinstall::require_binary_capable`).
|
||||
/// - `mail-client/thunderbird` stays a Portage build selected by policy.
|
||||
/// - `app-office/libreoffice-bin`, `www-client/firefox-bin` and
|
||||
/// `mail-client/thunderbird-bin` are the maintained stable Gentoo binary
|
||||
/// redistributions used for the fast default install. They install
|
||||
/// prebuilt upstream binaries through Portage with full signature
|
||||
/// verification; they never fall back to a silent source build (see
|
||||
/// `fastinstall::require_binary_capable`). A source build stays one
|
||||
/// explicit, reviewed opt-in away (`fastinstall::SOURCE_CONVERSIONS`).
|
||||
/// - `mail-client/thunderbird` (source) is therefore absent here; it is the
|
||||
/// conversion target, not the default.
|
||||
/// - Calibre and GIMP are **not** in this set: they install as system-wide
|
||||
/// Flatpaks from Flathub in the target (see `FAST_DEFAULT_FLATPAKS`), so
|
||||
/// the installer never installs duplicate Portage copies.
|
||||
|
|
@ -131,7 +140,7 @@ pub fn workstation_packages() -> Vec<&'static str> {
|
|||
"app-text/zathura-pdf-mupdf",
|
||||
"app-editors/nano",
|
||||
"www-client/firefox-bin",
|
||||
"mail-client/thunderbird",
|
||||
"mail-client/thunderbird-bin",
|
||||
"net-p2p/transmission",
|
||||
"media-sound/pavucontrol",
|
||||
"gnome-extra/nemo",
|
||||
|
|
@ -703,10 +712,11 @@ pub fn desktop_services(profile: DesktopProfile) -> Vec<&'static str> {
|
|||
out
|
||||
}
|
||||
|
||||
/// Services enabled only after the desktop packages are installed (greetd is
|
||||
/// not present until `desktop_install`).
|
||||
/// Services enabled only after the desktop packages are installed (greetd and
|
||||
/// seatd are not present until `desktop_install`). seatd starts first so a
|
||||
/// seat exists before the greeter asks libseat for one.
|
||||
pub fn desktop_login_services() -> Vec<&'static str> {
|
||||
vec!["greetd"]
|
||||
vec!["seatd", "greetd"]
|
||||
}
|
||||
|
||||
/// The services that should be enabled in the target, deduplicated.
|
||||
|
|
@ -985,6 +995,11 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String
|
|||
o.push_str("# Mango + DankMaterialShell desktop dependencies\n");
|
||||
o.push_str("dev-cpp/cpptrace unwind\n");
|
||||
o.push_str("sys-libs/zlib minizip\n");
|
||||
// Seat management: libseat must speak to seatd (standalone server),
|
||||
// logind (systemd sessions) and its builtin fallback, so Mango gets
|
||||
// a seat on physical hardware, VMs, and under the greeter alike.
|
||||
o.push_str("# Seat management (logind + seatd fallback)\n");
|
||||
o.push_str("gui-libs/libseat systemd builtin server\n");
|
||||
o.push_str("# Workstation defaults (Wayland-first, local printing, PipeWire audio)\n");
|
||||
o.push_str("media-sound/cava pipewire\n");
|
||||
o.push_str("net-p2p/transmission gtk\n");
|
||||
|
|
@ -1202,6 +1217,26 @@ if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ] && command -v dbus-run-session >/dev/n
|
|||
exec dbus-run-session -- "$0" "$@"
|
||||
fi
|
||||
|
||||
# Seat readiness: Mango asks libseat for a seat as soon as it starts. Wait
|
||||
# briefly (3 s) for seatd's socket or a logind session so a still-starting
|
||||
# seatd does not lose the race. This never fails the session: if no seat
|
||||
# provider appears, Mango starts anyway and reports the real error.
|
||||
# LIBSEAT_BACKEND is deliberately left unset — the default tries every
|
||||
# compiled backend (seatd, logind, builtin), while pinning one would remove
|
||||
# the fallback that covers the other environments.
|
||||
waited=0
|
||||
while [ "$waited" -lt 30 ]; do
|
||||
if [ -S /run/seatd.sock ]; then
|
||||
break
|
||||
fi
|
||||
if command -v loginctl >/dev/null 2>&1 \
|
||||
&& loginctl show-session "${XDG_SESSION_ID:-self}" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
waited=$((waited + 1))
|
||||
done
|
||||
|
||||
# Seed user configuration from the packaged defaults exactly once; never
|
||||
# overwrite what the user has customized.
|
||||
mango_conf="$HOME/.config/mango/config.conf"
|
||||
|
|
@ -1692,7 +1727,7 @@ ApplicationWindow {
|
|||
title: "1. Review and selectively build applications from source"
|
||||
Layout.fillWidth: true
|
||||
Label {
|
||||
text: "Firefox, LibreOffice, Calibre and GIMP can be rebuilt from their maintained sources. Shown first: exact packages, expected time, temporary disk, power/network needs, then an explicit approval. The working copy stays until the new build verifies."
|
||||
text: "Firefox, LibreOffice, Thunderbird, Calibre and GIMP can be rebuilt from their maintained sources. Shown first: exact packages, expected time, temporary disk, power/network needs, then an explicit approval. The working copy stays until the new build verifies."
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
color: "#d7dae0"
|
||||
|
|
@ -2360,6 +2395,13 @@ mod tests {
|
|||
assert!(!text.contains("media-video/wireplumber\n"));
|
||||
assert_eq!(text.matches("media-video/pipewire").count(), 1);
|
||||
assert!(text.contains("media-video/pipewire sound-server systemd"));
|
||||
// Seat management: libseat speaks seatd, logind and builtin.
|
||||
assert!(text.contains("gui-libs/libseat systemd builtin server"));
|
||||
// Headless has no seat stack.
|
||||
let mut headless = InstallConfig::default();
|
||||
headless.desktop.profile = DesktopProfile::None;
|
||||
let lean = package_use(&headless, &crate::hardware::HardwareReport::default());
|
||||
assert!(!lean.contains("gui-libs/libseat"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -2435,6 +2477,11 @@ mod tests {
|
|||
assert!(pkgs.contains(&"gui-apps/dankmaterialshell"));
|
||||
assert!(pkgs.contains(&"gui-apps/danksearch"));
|
||||
assert!(pkgs.contains(&"dev-vcs/git"));
|
||||
// Seat management rides along: seatd backs libseat when logind is
|
||||
// absent or delayed.
|
||||
assert!(pkgs.contains(&"sys-auth/seatd"));
|
||||
// Login runs seatd before the greeter so a seat exists first.
|
||||
assert_eq!(desktop_login_services(), vec!["seatd", "greetd"]);
|
||||
// Standalone dwl and helpers must not be present.
|
||||
assert!(!pkgs.contains(&"gui-wm/dwl"));
|
||||
assert!(!pkgs.contains(&"gui-apps/waybar"));
|
||||
|
|
@ -2505,6 +2552,14 @@ mod tests {
|
|||
wayland_at > mango_at,
|
||||
"WAYLAND_DISPLAY must only be set after mango starts"
|
||||
);
|
||||
// Seat readiness precedes the compositor; the backend stays
|
||||
// unpinned so every compiled libseat backend remains available.
|
||||
let seat_at = script.find("/run/seatd.sock").unwrap();
|
||||
assert!(
|
||||
seat_at < mango_at,
|
||||
"the seat wait must run before mango starts"
|
||||
);
|
||||
assert!(script.contains("LIBSEAT_BACKEND is deliberately left unset"));
|
||||
|
||||
let config = MANGO_CONFIG_DEFAULT;
|
||||
assert!(config.contains("dms ipc call lock lock"));
|
||||
|
|
@ -2745,7 +2800,7 @@ mod tests {
|
|||
"app-editors/nano",
|
||||
"www-client/firefox-bin",
|
||||
"www-client/brave-browser",
|
||||
"mail-client/thunderbird",
|
||||
"mail-client/thunderbird-bin",
|
||||
"net-p2p/transmission",
|
||||
"media-sound/pavucontrol",
|
||||
"net-print/cups",
|
||||
|
|
@ -2761,6 +2816,7 @@ mod tests {
|
|||
// copies.
|
||||
assert!(!pkgs.contains(&"app-office/libreoffice"));
|
||||
assert!(!pkgs.contains(&"www-client/firefox"));
|
||||
assert!(!pkgs.contains(&"mail-client/thunderbird"));
|
||||
assert!(!pkgs.contains(&"app-text/calibre"));
|
||||
assert!(!pkgs.contains(&"media-gfx/gimp"));
|
||||
for (_, id) in FAST_DEFAULT_FLATPAKS {
|
||||
|
|
@ -2907,6 +2963,7 @@ mod tests {
|
|||
assert!(INSTALLED_WELCOME_DESKTOP_ENTRY.contains("--reopen"));
|
||||
assert!(INSTALLED_WELCOME_QML.contains("Keep working system and finish"));
|
||||
assert!(INSTALLED_WELCOME_QML.contains("KeyNavigation.tab"));
|
||||
assert!(INSTALLED_WELCOME_QML.contains("Thunderbird"));
|
||||
let assets = installed_welcome_assets();
|
||||
assert!(assets.iter().any(|(p, _)| p.contains("shell.qml")));
|
||||
// DMS first-run suppression seeds the skeleton only.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,21 @@ pub fn load_api_key(path: &Path) -> Result<SecretString> {
|
|||
Ok(SecretString::new(key))
|
||||
}
|
||||
|
||||
/// Default model-call timeout: local CPU inference is slow, and the old
|
||||
/// 120 s default aborted it with `curl exit 28`.
|
||||
pub const DEFAULT_AI_TIMEOUT_SECS: u64 = 300;
|
||||
|
||||
/// Model-call timeout in seconds, overrideable via `PHOEBUS_AI_TIMEOUT`.
|
||||
/// Unparseable, zero or missing values fall back to the default; zero is
|
||||
/// refused because curl treats `max-time = 0` as "no timeout".
|
||||
pub fn ai_timeout_secs() -> u64 {
|
||||
std::env::var("PHOEBUS_AI_TIMEOUT")
|
||||
.ok()
|
||||
.and_then(|v| v.trim().parse::<u64>().ok())
|
||||
.filter(|v| *v > 0)
|
||||
.unwrap_or(DEFAULT_AI_TIMEOUT_SECS)
|
||||
}
|
||||
|
||||
/// A transport that talks to an OpenAI-compatible endpoint with curl.
|
||||
///
|
||||
/// The API key is optional: a self-hosted local model usually needs none, while
|
||||
|
|
@ -103,15 +118,17 @@ impl ModelTransport for CurlTransport<'_> {
|
|||
// absent so a redirect is never followed (a redirect could send the
|
||||
// Authorization header to another origin). `max-filesize` bounds the
|
||||
// response so a hostile or broken endpoint cannot exhaust memory.
|
||||
// `max-time` covers slow local CPU inference (see `ai_timeout_secs`).
|
||||
let config = format!(
|
||||
"url = \"{url}\"\n\
|
||||
proto = \"=http,https\"\n\
|
||||
header = \"Content-Type: application/json\"\n\
|
||||
{auth}\
|
||||
data = \"@{path}\"\n\
|
||||
silent\nshow-error\nfail-with-body\nmax-time = 120\n\
|
||||
silent\nshow-error\nfail-with-body\nmax-time = {timeout}\n\
|
||||
connect-timeout = 30\nmax-filesize = {max}\n",
|
||||
path = request.path().display(),
|
||||
timeout = ai_timeout_secs(),
|
||||
max = phoebus_ai::provider::MAX_RESPONSE_BYTES,
|
||||
);
|
||||
let spec = CommandSpec::new("ai", "query model", "curl")
|
||||
|
|
@ -141,8 +158,9 @@ impl CurlTransport<'_> {
|
|||
header = \"Content-Type: application/json\"\n\
|
||||
{auth}\
|
||||
data = \"{escaped}\"\n\
|
||||
silent\nshow-error\nfail-with-body\nmax-time = 120\n\
|
||||
silent\nshow-error\nfail-with-body\nmax-time = {timeout}\n\
|
||||
connect-timeout = 30\nmax-filesize = {max}\n",
|
||||
timeout = ai_timeout_secs(),
|
||||
max = phoebus_ai::provider::MAX_RESPONSE_BYTES,
|
||||
);
|
||||
let out = crate::sandbox::run(
|
||||
|
|
@ -276,6 +294,76 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
/// Save, set, and restore PHOEBUS_AI_TIMEOUT around a check. Only this
|
||||
/// module's tests touch the variable, and no other test asserts a
|
||||
/// timeout value, so parallel execution stays deterministic.
|
||||
fn with_ai_timeout(var: Option<&str>, check: impl FnOnce()) {
|
||||
let prev = std::env::var("PHOEBUS_AI_TIMEOUT").ok();
|
||||
match var {
|
||||
Some(v) => std::env::set_var("PHOEBUS_AI_TIMEOUT", v),
|
||||
None => std::env::remove_var("PHOEBUS_AI_TIMEOUT"),
|
||||
}
|
||||
check();
|
||||
match prev {
|
||||
Some(v) => std::env::set_var("PHOEBUS_AI_TIMEOUT", v),
|
||||
None => std::env::remove_var("PHOEBUS_AI_TIMEOUT"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ai_timeout_defaults_to_300s_and_rejects_bad_values() {
|
||||
with_ai_timeout(None, || assert_eq!(ai_timeout_secs(), 300));
|
||||
with_ai_timeout(Some("600"), || assert_eq!(ai_timeout_secs(), 600));
|
||||
with_ai_timeout(Some(" 90 "), || assert_eq!(ai_timeout_secs(), 90));
|
||||
// Zero would mean "no timeout" to curl; garbage and empty fall back.
|
||||
for bad in ["0", "", "abc", "-5", "12.5"] {
|
||||
with_ai_timeout(Some(bad), || {
|
||||
assert_eq!(ai_timeout_secs(), 300, "bad value {bad:?}")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn curl_transport_uses_the_configured_timeout() {
|
||||
let runner = RecordingRunner::new();
|
||||
runner.set_response(
|
||||
"curl",
|
||||
CommandOutput {
|
||||
status: 0,
|
||||
success: true,
|
||||
stdout: b"{}".to_vec(),
|
||||
stderr: Vec::new(),
|
||||
duration: Duration::from_millis(1),
|
||||
},
|
||||
);
|
||||
let exec = make_exec(runner.clone());
|
||||
with_ai_timeout(Some("600"), || {
|
||||
let transport = CurlTransport::new(&exec, None);
|
||||
transport
|
||||
.send(
|
||||
ProviderKind::Local,
|
||||
"http://127.0.0.1:11434/v1/chat/completions",
|
||||
"{}",
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
let stdin = String::from_utf8(runner.recorded()[0].stdin.clone().unwrap()).unwrap();
|
||||
assert!(stdin.contains("max-time = 600"), "{stdin}");
|
||||
// And the default covers slow local CPU inference (was 120 s).
|
||||
with_ai_timeout(None, || {
|
||||
let transport = CurlTransport::new(&exec, None);
|
||||
transport
|
||||
.send(
|
||||
ProviderKind::Local,
|
||||
"http://127.0.0.1:11434/v1/chat/completions",
|
||||
"{}",
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
let stdin = String::from_utf8(runner.recorded()[1].stdin.clone().unwrap()).unwrap();
|
||||
assert!(stdin.contains("max-time = 300"), "{stdin}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn curl_transport_omits_auth_without_a_key() {
|
||||
let runner = RecordingRunner::new();
|
||||
|
|
|
|||
|
|
@ -198,15 +198,21 @@ pub fn configure_login(exec: &Exec, config: &InstallConfig) -> Result<()> {
|
|||
}
|
||||
|
||||
fn ensure_greeter_user(exec: &Exec) -> Result<()> {
|
||||
let root = Path::new(&exec.root);
|
||||
// The seat group may not exist yet when seatd has not been installed
|
||||
// into the target (best-effort: seatd's install provides it; membership
|
||||
// is what the greeter needs for libseat).
|
||||
let _ = portage::chroot(exec, root, "groupadd", &["-r", "seat"]);
|
||||
let passwd_path = Path::new(&exec.root).join("etc/passwd");
|
||||
if let Ok(passwd) = std::fs::read_to_string(&passwd_path) {
|
||||
if passwd.lines().any(|l| l.starts_with("greeter:")) {
|
||||
exec.logger.info("greeter user already present in target");
|
||||
// Still ensure seat membership on re-runs (best-effort).
|
||||
let _ = portage::chroot(exec, root, "usermod", &["-a", "-G", "seat", "greeter"]);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let root = Path::new(&exec.root);
|
||||
portage::chroot(
|
||||
exec,
|
||||
root,
|
||||
|
|
@ -220,6 +226,8 @@ fn ensure_greeter_user(exec: &Exec) -> Result<()> {
|
|||
"/sbin/nologin",
|
||||
"--comment",
|
||||
"Phoebus greeter",
|
||||
"-G",
|
||||
"video,input,render,seat",
|
||||
"greeter",
|
||||
],
|
||||
)
|
||||
|
|
@ -499,6 +507,20 @@ mod tests {
|
|||
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("useradd")));
|
||||
// Seat management: seatd is enabled before the greeter, and the
|
||||
// greeter joins the seat group (plus video/input/render).
|
||||
let seat_pos = commands.iter().position(|a| a.contains("enable seatd"));
|
||||
let greet_pos = commands.iter().position(|a| a.contains("enable greetd"));
|
||||
assert!(
|
||||
seat_pos.is_some() && greet_pos.is_some() && seat_pos < greet_pos,
|
||||
"seatd must be enabled before greetd: {commands:?}"
|
||||
);
|
||||
assert!(
|
||||
commands
|
||||
.iter()
|
||||
.any(|a| a.contains("useradd") && a.contains("seat")),
|
||||
"greeter must join the seat group: {commands:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ Software:
|
|||
Fast defaults (prebuilt, verified; no local compile):
|
||||
Firefox: www-client/firefox-bin [Portage -bin (signed)] — download ~120 MiB prebuilt binary, no local compile
|
||||
LibreOffice: app-office/libreoffice-bin [Portage -bin (signed)] — download ~250 MiB prebuilt binary, no local compile
|
||||
Thunderbird: mail-client/thunderbird-bin [Portage -bin (signed)] — download ~80 MiB prebuilt binary, no local compile
|
||||
Calibre: com.calibre_ebook.calibre (Flathub, system) [Flatpak system (Flathub)] — download Flatpak runtime + app, no local compile
|
||||
GIMP: org.gimp.GIMP (Flathub, system) [Flatpak system (Flathub)] — download Flatpak app, no local compile
|
||||
Flatseal: com.github.tchx84.Flatseal (Flathub, system) [Flatpak system (Flathub)] — download Flatpak app, no local compile
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue