Console-VM + user-VM pair: real async message-passing relay

Console sessions now route through the same general VM-to-VM messaging
system (Phase C) any VM can already use for its own reasons -- not a
synchronous shortcut. Per direct instruction: real async MSG-SEND/
MSG-DELIVER (Option B), not a VM-EXEC-based synchronous relay, because
messaging is a general capability, not a console-specific mechanism.

New CONSOLE-CMD-EVENT message type (common:messaging.4th). New
sk_repl_dispatch_line() (repl.c), called from both sk_repl_step and
sk_repl_run in place of a direct vm_interpret(): if the active VM's own
name has a live "<name>~user" counterpart registered, the raw input
line is wrapped as an S"-embedded CONSOLE-CMD-EVENT MSG-SEND and
interpreted on the console VM instead of being run directly -- the
console's own next MSG-TICK (Hera's idle pump) delivers it into the
paired user VM via VM-EXEC, same mechanism every other message already
uses. Falls back to direct interpretation if there's no pairing, or if
the line contains a `"` (known v1 limitation, warned about explicitly
rather than silently mishandled).

New capsule_console_birth() (capsule_console.h/.c): a bare VM whose
only content is loading common:messaging.4th -- the console side of a
pairing, parallel in shape to RUNCAP's user-VM birth but with fixed
embedded content instead of a devblock read (no identity, no thumbdrive
involved). New PAIR-TEST diagnostic word (mama_forth_words.c, matches
RUNCAP-TEST's own precedent): births both halves of a pairing and
registers the "<name>~user" mapping. Not the real pairing call site --
that's the eventual attach/onboarding flow -- this exists to exercise
the relay live before that flow exists.

Found and fixed a real, serious bug live: console_set_vm_name() stored
the caller's raw pointer instead of copying it. mama_word_use() (USE)
passes a VMRegistryEntry field living on its own stack frame -- once
USE returns, that pointer dangles, corrupting every console tag after
the first USE (observed directly as garbled "[[]" / binary-looking
prefixes instead of "[CaptBob]"). Fixed at the source: console_set_
vm_name() now copies into internal storage. That surfaced a second,
related bug across every console_get_vm_name()-based save/restore call
site in mama_forth_words.c (BIRTH, VM-STEP, VM-EXEC, CONNECT-HERMES,
CONNECT-ARTEMIS): saving just a pointer into the single internal buffer
meant an intervening console_set_vm_name() call silently corrupted the
saved value before the restore ever ran. New console_save_vm_name()
copies into caller-owned storage; every save/restore site updated.

Verified end-to-end, live in QEMU: typed WELCOME at a paired console
VM -- it did not execute directly (no UNKNOWN WORD), printed ok
immediately (queued, async), and on the next idle tick
"[CaptBob~user] Minted identity -- default personality" appeared on
its own -- genuine delivery and execution in the paired user VM through
the real MSG-SEND/MSG-DELIVER pipeline. Console tags confirmed clean
(no garbling) across all three architectures' full regression boot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZGkimpfyh63EZyRkNbkPD
This commit is contained in:
Robert Allan James
2026-08-28 16:39:07 -04:00
co-authored by Claude Sonnet 5
parent 71b6937deb
commit b0f12710bb
14 changed files with 46122 additions and 55 deletions
+38 -37
View File
@@ -1,5 +1,5 @@
# Capsule Block Manifest — Auto-generated
<!-- Generated by mkcapsule --manifest 2026-08-28T20:09:16Z -->
<!-- Generated by mkcapsule --manifest 2026-08-28T20:37:43Z -->
<!-- DO NOT EDIT — re-run mkcapsule --manifest to refresh. -->
<!-- Hand-written justifications and immutability notes live -->
<!-- in MANIFEST.md alongside this auto-generated index. -->
@@ -10,7 +10,7 @@
|---------|----------------|----------|--------|
| `ACL.4th` | 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4015 | `0xd781d22148ff171d` | yes |
| `artemis:init.4th` | 4110, 4111, 4112, 4113, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4177, 4178, 4179, 4180, 4181, 4182, 4851, 4852, 4853, 4854 | `0xfe6e570467368153` | yes |
| `common:messaging.4th` | 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037 | `0x3eb5408bc357d1de` | yes |
| `common:messaging.4th` | 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038 | `0x892fd1c86d8c175e` | yes |
| `common:msg.4th` | 4055 | `0x850a0382344ea6c4` | yes |
| `doe-campaign.4th` | 4060, 4061, 4062, 4063, 4064, 4065 | `0x3d4549142d91ec20` | yes |
| `doe.4th` | 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107 | `0xf154616d248e861f` | yes |
@@ -294,41 +294,42 @@
| 5000 | `fabric.4th` | `0x9b1d061339cea98d` | ok |
| 5001 | `fabric.4th` | `0x9b1d061339cea98d` | ok |
| 5002 | `fabric.4th` | `0x9b1d061339cea98d` | ok |
| 5003 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5004 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5005 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5006 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5007 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5008 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5009 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5010 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5011 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5012 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5013 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5014 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5015 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5016 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5017 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5018 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5019 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5020 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5021 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5022 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5023 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5024 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5025 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5026 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5027 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5028 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5029 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5030 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5031 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5032 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5033 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5034 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5035 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5036 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5037 | `common:messaging.4th` | `0x3eb5408bc357d1de` | ok |
| 5003 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5004 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5005 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5006 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5007 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5008 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5009 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5010 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5011 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5012 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5013 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5014 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5015 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5016 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5017 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5018 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5019 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5020 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5021 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5022 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5023 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5024 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5025 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5026 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5027 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5028 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5029 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5030 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5031 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5032 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5033 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5034 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5035 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5036 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5037 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5038 | `common:messaging.4th` | `0x892fd1c86d8c175e` | ok |
| 5100 | `turtle.4th` | `0x4d470418ca543365` | ok |
| 5101 | `turtle.4th` | `0x4d470418ca543365` | ok |
| 5102 | `turtle.4th` | `0x4d470418ca543365` | ok |
+4
View File
@@ -15,6 +15,10 @@ Block 5003
64 CONSTANT MBR-MAX
65208 CONSTANT Q-DECAY
255 CONSTANT MSG-DELIVERED
Block 5038
( CONSOLE-CMD-EVENT: console-VM -> paired user-VM command )
( relay message type, async MSG-SEND/MSG-DELIVER. )
7 CONSTANT CONSOLE-CMD-EVENT
Block 5004
( StadiumBehaviour tags, match stadium.h's enum )
0 CONSTANT SB-MIGRATE