Skip to content

schema-dbus: on-demand service activation - #113

Merged
ajax80 merged 11 commits into
masterfrom
feat/schema-dbus-activation
Sep 4, 2026
Merged

schema-dbus: on-demand service activation#113
ajax80 merged 11 commits into
masterfrom
feat/schema-dbus-activation

Conversation

@ajax80

@ajax80 ajax80 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Gives the schema-dbus broker on-demand bus activation — closing the last functional gap after the flip. A method call to an unowned-but-activatable name (or an explicit StartServiceByName) now spawns the service, holds the triggering message, and delivers it once the name is claimed.

Why

Live audit: 43 services (the b1 set — mostly KDE kauth/polkit helpers plus fwupd, PackageKit, ColorManager, GeoClue2, bolt, fprintd, RealtimeKit1, ModemManager1) are direct-activated on demand by stock dbus-daemon and went dark under the broker (StartServiceByName was a stub). This builds the general mechanism; all 43 are covered.

Design

  • Full auto-activation — implicit (method call to activatable name) + explicit StartServiceByName.
  • Broker forks+execs directly — traditional dbus-daemon model; PID 1 untouched.
  • Matches stock semantics, always sanitizes — no per-caller activation policy gate; always drop to User= (fail-closed if unresolvable), DBUS_STARTER_* env, CLOEXEC fd hygiene.

Spec: docs/superpowers/specs/2026-09-04-schema-dbus-activation-design.md
Plan: docs/superpowers/plans/2026-09-04-schema-dbus-activation.md

What's here

  • sdbus_activate.h — service-file table parser + pending-activation state machine (pure logic, unit-tested).
  • schema-dbus.cspawn_service (fork+exec, fail-closed uid drop), implicit trigger at the synth branch, signalfd(SIGCHLD) reaper, release-on-name-acquire, spawn-timeout reaping, explicit StartServiceByName, SCHEMA_DBUS_SVCDIR test override.

Verification

  • make test — full suite green incl. new test_sdbus_activate (parse + state machine).
  • Live smoke (scratch bus): explicit u 1 (SUCCESS) / u 2 (ALREADY_RUNNING), ServiceUnknown for non-activatable, Spawn.ChildExited when the drop fails, and implicit method-call spawn→hold→deliver (real reply routed back from the spawned service).
  • schema-vmtest PASS — schema-init PID 1 boots clean, no init regression.
  • Commit security review finding (fail-open uid drop) fixed.

Not deployed to the live bus yet — hardware deploy + reboot pending.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK

ajax80 and others added 11 commits September 4, 2026 00:16
Full auto-activation (implicit + explicit StartServiceByName), broker
forks+execs directly, matches stock dbus-daemon semantics with env/fd/uid
sanitization. Covers the 43-service (b1) regression set by mechanism.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
10 tasks: pure-logic table (parse + pending state machine, TDD unit-tested),
then broker wiring — spawn helper, implicit trigger, SIGCHLD reaper, release
on name-acquire, spawn timeout, explicit StartServiceByName. vmtest-gated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
Caller wired in the next commit; transient unused-function warning until then.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
Also fail closed in spawn_service when User= cannot be resolved (never
silently exec as root) — from the commit security review of the prior commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
Intercepts StartServiceByName in the driver path: ALREADY_RUNNING if owned,
ServiceUnknown if not activatable, else spawn + hold EXPLICIT and reply SUCCESS
on name-acquire. arg0 read via dbus_message_get_args (codec exposes DBusMessage,
not a parsed args array). Adds SCHEMA_DBUS_SVCDIR env override for test/vmtest.

Live smoke (scratch bus) confirms: explicit u1/u2, ServiceUnknown, ChildExited
on failed drop, and implicit method-call spawn+hold+deliver.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACQXzjkwWQcHibMgBh5WxK
@ajax80
ajax80 merged commit 65ac980 into master Sep 4, 2026
@ajax80
ajax80 deleted the feat/schema-dbus-activation branch September 4, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant