Reload panel modules from outside the session: control socket, chandra-ctl, SIGUSR1
CI / test (push) Failing after 16s

Until now a module reload was only reachable by clicking Settings > Panel inside the session.
Now:

- The compositor listens on $XDG_RUNTIME_DIR/chandra/<wayland socket name>.sock (the login
  session's is wayland-moon-0.sock) with a line protocol: ping, list, reload [NAME], help.
  Replies end with an "ok ..." or "error ..." line. It lives in compositor/host/control.mbt,
  runs from ChandraCompositor::step, and its fds join the idle loop's wait set, so an idle
  desktop still sleeps (measured ~0.4% CPU on wasmhost, ~0.1% on host-wasm) and wakes for a
  command. A path another live compositor answers on is left alone.
- DesktopShell::reload_modules(name) reloads every loaded module (or those whose module id,
  stem, slot or path is NAME) in place via replace_slot: same panel position, saved
  :module-config applied, a module that fails to load stays as it was and the error is
  reported to the caller and shown as a notice. The catalog is rescanned.
- SIGUSR1 to the host reloads every module (result in the log and the notice): new WIT
  function sys.take-sigusr1, implemented in compositor/sys (native build and wasmhost) and
  host-wasm; the handler has no SA_RESTART so it interrupts the idle poll.
- session/chandra-ctl (installed to /usr/local/bin), `just reload [NAME]`, docs/reloading.md,
  README.
- Tests: compositor/host/control_test.mbt (protocol, reload all / by name / by slot, order
  and settings kept, failing module kept, busy socket). Checked headless on both hosts with
  chandra-ctl and kill -USR1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjLJtvYcgW48okL6qQ
This commit is contained in:
Claude committed 2026-11-25 20:57:40 +00:00
1 parent 0fc2598d27
commit 68164ff75e
21 files changed
+844 -31

No files matched your search

+3 -2
View File
@@ -32,7 +32,7 @@ interface** with **deny-by-default capabilities**:
Design: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (Plasma to component mapping, permissions,
versioning) and [docs/compositor-design.md](docs/compositor-design.md) (the compositor and its
hosts). Toolchain notes: [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md). Dark mode and the portal: [docs/dark-mode.md](docs/dark-mode.md). Running as root and run0:
[docs/run0.md](docs/run0.md). Picking up a new build without logging out: [docs/reloading.md](docs/reloading.md).
[docs/run0.md](docs/run0.md). Picking up a new build without logging out (`just reload`, `chandra-ctl reload`): [docs/reloading.md](docs/reloading.md).
## How it runs
@@ -76,6 +76,7 @@ just client # start foot inside it (or: just client konsol
| `just run-drm` | As a login session on the real screen (from a text console, as yourself) |
| `just install-session` | Install the "Chandra" display-manager session (asks for root once) |
| `just install-session-dev` | Same, but symlinked into this checkout: later just rebuild |
| `just reload` | Reload the running session's panel modules from disk (`chandra-ctl reload [NAME]`) |
| `just run-rust`, `run-drm-rust`, `install-session-rust` | The same with the Rust host |
| `just run-native`, `run-drm-native`, `install-session-native` | The native (non-wasm) build |
| `just compositor-wasm`, `wasmhost`, `host-wasm`, `modules` | Build one piece |
@@ -188,7 +189,7 @@ lib/ pure, unit-tested logic (panel layout, clock, launcher, ba
wasmhost/ the default host (MoonBit + wasmtime C API)
host-wasm/ the fallback host (Rust + wasmtime)
host/ the original M0 browser/Node host (jco), kept for the component demos
session/ chandra-session, chandra-root, chandra.desktop, chandra.portal, install.py
session/ chandra-session, chandra-root, chandra-ctl, chandra.desktop, chandra.portal, install.py
config/ desktop configs, themes, app list
scripts/ setup-toolchain, build-*, gen-bindings, as-root, remote-build, test
docs/ ARCHITECTURE, compositor-design, TOOLCHAIN, run0, dark-mode, reloading, screenshots