Stage O-B: Hera drains her own mail at the idle point, not on the ~1 s idle beat (FABRIC-3.9.0 §2.5)

- sk_vm_idle_point(may_drain_self): with no frame live and mail pending,
  Hera drains one message and returns to the poll loop. Readline passes
  n == 0 (the mid-edit gate), headless 1, the key read 0.
- Removed sk_repl_idle()'s timer-paced drain of Hera's queue and the two
  flags that guarded it (g_mama_interpreting, g_idle_pump_active) -- the
  idle point's frames check already covers that re-entry hazard.

Probe (reverted), all three ISAs: admission -> drain for mail to an idle
Hera 0-1 beats (was up to 100); a message arriving mid-edit is held until
the line is entered (2080-3587 beats), never printed into typed text; an
event queued during a busy line drains when it ends; BLK-ATTACH at boot 1
beat. Acceptance passes; parity, dict_hash set and relay ledger unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-24 22:33:33 -04:00
co-authored by Claude Opus 5.5
parent fe55038e9a
commit ee4c401d1c
16 changed files with 55062 additions and 65 deletions
+12 -1
View File
@@ -218,13 +218,24 @@ void sk_vm_switch_checkpoint(VM *vm) {
* frame (nothing in progress), so she becomes eligible again only through
* mail or pending console input, or is returned to by a trampoline with
* nothing left to do. */
void sk_vm_idle_point(void) {
void sk_vm_idle_point(int may_drain_self) {
VM *self = g_switch_current_vm;
VM *next;
if (!self || self != (VM *)sk_get_mama_vm()) return;
if (self->frames.count != 0) return; /* inside a word (KEY/EXPECT): not idle */
/* FABRIC-3.9.8 Stage O-B (FABRIC-3.9.0.md §2.5): Hera acts on her own
* mail the moment she is idle -- one message, then back to the caller's
* poll loop, which calls again. Was sk_repl_idle()'s drain, paced by the
* ~1 s SK_IDLE_BEAT_INTERVAL. Safe here by the check just above: no
* frame means no line, word or drain of hers is in progress, so the
* drain can't re-enter her interpreter. */
if (may_drain_self && sk_hermes_pending_count(self->stadium_vm_id) > 0) {
(void)sk_hermes_drain_checkpoint(self);
return;
}
sk_vm_switch_reap_pending();
next = sk_vm_switch_decide(self, 0);
if (!next) return;