Skip to main content

Module network

Module network 

Source
Expand description

Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §4.3).

Structs§

NetworkBundle
Output of bind_listeners_and_network.

Functions§

bind_listeners_and_network
Step 5: Bind 2 TCP listeners (web + ws — separate ports matching Go), then bring up LAN discovery (mDNS), the LSP supervisor, stale registry cleanup, and the process tracker/broker.
bind_startup_listeners 🔒
The web and ws listeners.
spawn_registry_heartbeat 🔒
Periodic re-registration heartbeat for every LOCALLY-registered agent’s Tier 2 (per-channel) and Tier 2b (host-global shared) registry entries. Without it an entry’s updated_at is stamped once at registration and never refreshed, so should_evict_on_forward_failure (registry.rs)’s grace-period check is only ever true in the ~60s right after an agent registers, useless for any steady-state agent. The heartbeat keeps a live agent’s on-disk entries fresh indefinitely; a genuinely-dead agent simply stops appearing in the in-memory Tier-1 registry (reactive::get_global_handler().list_agents(), updated synchronously on every register/unregister), so its entries age past the grace period and become evictable again within one heartbeat interval. The interval is well under FORWARD_FAILURE_GRACE_MS so a live entry’s age never approaches the grace threshold between heartbeats. See docs/retro/retro-cross-channel-jekt-eviction-2026-08-17.md (#2640).
start_lan_services 🔒
LAN discovery (mDNS) and the LAN listener supervisor; returns the host name, resolved once because discovery needs it for its mDNS TXT records.
start_process_services 🔒
The agent process tracker and the process broker, both also set as process globals.
sweep_stale_registry_entries 🔒
Clean up stale cross-instance agent registry entries (older than 4h), and the same for the host-global shared registry (Tier 2b, #1916), which additionally drops entries whose owning PID no longer exists on this host: a channel that crashed without a clean unregister can leave an entry behind indefinitely otherwise, since no other channel’s startup would revisit it.