Session: wait for the document portal's mount before reopening apps; say when it's broken
CI / test (push) Canceled after 1m11s

V's session.log had kwi (a Flatpak) failing with "bwrap: Can't find source path
/run/user/1000/doc/by-app/org.kde.kwi". At login chandra-session restarts
xdg-desktop-portal, and xdg-document-portal stopped and started with it in the
same second (V's journal, 21:36:12); a Flatpak started in that gap, such as one
session restore reopens, finds no FUSE mount to bind into its sandbox.

When flatpak is installed, chandra-session now asks the document portal for its
mount point (which also starts it), waits up to 5 s for the FUSE mount and
checks it answers. If it doesn't, the reason goes to the log and into
CHANDRA_SESSION_ERRORS, which the shell shows as an error notice once the desktop
is up (DesktopShell::show_session_errors). A missing dbus-send is reported too.

Tested: the snippet against a real xdg-document-portal on a dbus-run-session bus
(mounted after 0 waits) and with an unreachable bus (error text); the notice in
compositor/host/launch_test.mbt and headless with build/wasmhost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiGJWeuHiTgtoyB4kb
This commit is contained in:
Claude committed 2026-11-26 06:29:54 +00:00
1 parent 70b24ffe47
commit 2752b81e36
3 files changed
+62

No files matched your search

+12
View File
@@ -84,3 +84,15 @@ test "an app that keeps running is not reported, and its output still reaches th
assert_eq(lines, [])
assert_eq(comp.shell.launch_fds().length(), 1)
}
///|
test "problems chandra-session found at login show as an error notice" {
let comp = new_comp("session-errors")
comp.shell.show_session_errors("")
assert_eq(comp.shell.notice_lines, [])
comp.shell.show_session_errors(
"Flatpak apps can't start: the document portal answered but nothing is mounted at /run/user/1000/doc\n",
)
assert_eq(comp.shell.notice_lines[0], "Flatpak apps can't start: the document portal answered but nothing is mounted at /run/user/1000/doc")
assert_eq(comp.shell.notice_lines.length(), 2)
}
+17
View File
@@ -368,6 +368,23 @@ fn DesktopShell::ensure_booted(self : DesktopShell) -> Unit {
ignore(self.load_path(path))
}
}
self.show_session_errors(@sys.getenv("CHANDRA_SESSION_ERRORS"))
}
///| Show what chandra-session found broken before the desktop started (CHANDRA_SESSION_ERRORS,
/// one problem per line; the document portal Flatpak apps need, for one).
pub fn DesktopShell::show_session_errors(self : DesktopShell, errors : String) -> Unit {
let lines : Array[String] = []
for l in errors.split("\n") {
let t = l.trim(chars=" \t").to_string()
if t != "" {
lines.push(t)
}
}
if lines.length() > 0 {
lines.push("Found at login by chandra-session; details in ~/.local/state/chandra/session.log")
self.say_error(lines)
}
}
///| Load the module file at `path` into the panel (any number of instances may be loaded).