Launches that fail say why: command, exit status and what it printed
CI / test (push) Canceled after 17m11s

V: "kwi not starting from app menu or dock". Kwi is a Flatpak, and bwrap died
before it opened a window ("Can't find source path /run/user/1000/doc/by-app/
org.kde.kwi"); Chandra forked apps and forgot them, so the failure only reached
the session log and the click did nothing visible.

Every app the Applications menu, the dock, Super+1..9 and session restore start
now runs under a small monitor (sys spawn-watch, compositor/sys/sys_stub.c): it
copies the app's output to the session log as before, keeps its last 2 KiB,
and reports how sh -c CMD exited on a socket the main loop wakes on. The shell
(compositor/shell/launch.mbt) shows a red error notice for 15 s, and logs it,
when the app exits non-zero or by a signal within 30 s, or exits 0 without ever
opening a window here (after a 2 s grace for single-instance hand-offs): the
first line says what happened, then the command and the last lines it printed,
repeats folded ("(3 times)"). Status 127/126 say "command not found" / "not
executable". Launched apps no longer inherit the compositor's fds.

chandra-ctl launch ID starts a desktop app exactly as the dock does.

Tests: compositor/host/launch_test.mbt (bwrap-style failure incl. drawn notice,
127, SIGSEGV, exit 0 without a window, an app that keeps running), unit tests
in launch.mbt. Checked end to end with build/wasmhost + compositor.wasm
headless and a Flatpak-style kwi desktop file: chandra-ctl launch org.kde.kwi
shows the notice.

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 05:48:39 +00:00
1 parent 77fcc4db1c
commit 50149e6b99
18 files changed
+686 -30

No files matched your search

+34 -2
View File
@@ -347,6 +347,11 @@ pub(all) struct DesktopShell {
mut notice : String
mut notice_frames : Int
mut notice_start : Int
/// A multi-line error notice (`say_error`): its lines, shown for `notice_secs`.
mut notice_lines : Array[String]
mut notice_secs : Int
/// Apps started and still watched for a failed launch (launch.mbt).
launches : Array[LaunchWatch]
/// Right-click menu.
mut menu_open : Bool
mut menu_rect : @scene.Rect
@@ -504,6 +509,9 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
notice: "",
notice_frames: 0,
notice_start: 0,
notice_lines: [],
notice_secs: 4,
launches: [],
menu_open: false,
menu_rect: zero,
menu_title: "",
@@ -1131,11 +1139,35 @@ pub fn DesktopShell::render(
self.menu_rect = { x: 0, y: 0, w: 0, h: 0 }
}
if self.notice_frames > 0 {
if (wall_secs() - self.notice_start + 86400) % 86400 >= 4 {
if (wall_secs() - self.notice_start + 86400) % 86400 >= self.notice_secs {
self.notice_frames = 0
}
}
if self.notice_frames > 0 {
if self.notice_frames > 0 && self.notice_lines.length() > 0 {
// An error: its lines in a box above the panel's right end, a red edge on the left.
let rows = notice_rows(self.notice_lines, 110)
let fs = tokens.font_size.reinterpret_as_int() - 3
let lh = fs + 6
let mut longest = 0
for r in rows {
longest = if r.length() > longest { r.length() } else { longest }
}
let nw = longest * 7 + 32
let nw = if nw > w - 24 { w - 24 } else { nw }
let nh = rows.length() * lh + 16
let red = @ui.color(229, 72, 77, 255)
let ops = [
@ui.fill_rect(@ui.rect(0, 0, nw, nh), tokens.palette.surface_popup, radius=tokens.radius.reinterpret_as_int()),
@ui.stroke_rect(@ui.rect(0, 0, nw, nh), red, radius=tokens.radius.reinterpret_as_int()),
@ui.fill_rect(@ui.rect(0, 0, 4, nh), red),
]
for i, r in rows {
ops.push(
@ui.text(16, 8 + i * lh + lh / 2, r, fs, if i == 0 { red } else { tokens.palette.foreground }),
)
}
translate(ops, w - nw - 12, self.panel_rect.y - nh - 12, panel_ops)
} else if self.notice_frames > 0 {
let nw = self.notice.length() * 7 + 24
translate(
[