Stage M-B: autonomous events -- EV-DONE / EV-BORN / EV-DIED published by the kernel itself (FABRIC-3.9.0 §7.3, M-3..M-6)

- Permanent event channels 1/2/3 created at boot beside channel 0, exposed
  as FORTH constants EV-DONE / EV-BORN / EV-DIED; CHANNEL-CLOSE refuses 0..3.
- sk_hermes_event(): `S" <name>" ON-...` as type 32 to every member except
  the VM it's about; never blocks -- undeliverable copies are dropped,
  counted (EV-DROPPED), printed and logged.
- Fired for participants only: EV-DONE from the switch trampoline when real
  work runs dry (funded by the VM), EV-BORN at a LIVE VM's first naming
  (funded by the newborn), EV-DIED on KILL/reap after departure (funded by
  the root). VM.ev_real_work keeps event handling from firing EV-DONE, so
  mutual subscribers can't storm.

Console evidence identical on amd64/aarch64/riscv64: one BORN per birth,
one DONE per job run dry (2 queued -> 1), one DIED per KILL, no SEND in any
job text; storm guard: exactly one reaction; channels 1-3 unclosable;
non-joined VMs see nothing; EV-DROPPED 0. Flood probe (reverted): 32
delivered, 7 dropped and counted, never blocked, all heat returned.
dict_hash set changes by the 4 words (546), identical across ISAs;
acceptance passes with held=2048.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-24 21:12:51 -04:00
co-authored by Claude Opus 5.5
parent b562e16ccf
commit fe55038e9a
19 changed files with 55239 additions and 7 deletions
+14
View File
@@ -156,6 +156,20 @@ void sk_vm_switch_entry(void) {
if (drained == 0 && has_mail) {
sk_hal_panic("switch trampoline: pending mail the drain did not consume");
}
/* FABRIC-3.9.8 Stage M-B (§7.3): a participant that did real work
* and now has none tells whoever joined EV-DONE -- the OS emits its
* completion; its own code never decides to. Funded by the VM it's
* about (M-5); observers never announce their own idleness (M-4). */
if (!has_mail && self->ev_real_work) {
self->ev_real_work = 0;
if (!sk_vm_switch_signal_is_observer(self->stadium_vm_id)) {
VMRegistryEntry e;
if (capsule_vm_registry_get(self->stadium_vm_id, &e) == 0) {
(void)sk_hermes_event(SK_HERMES_CHANNEL_EV_DONE, self->stadium_vm_id,
self->stadium_vm_id, e.name);
}
}
}
sk_vm_switch_reap_pending();
next = sk_vm_switch_decide(self, has_mail);
if (!next) {