libchat/extensions
Ivan FB 27b55408b3
feat: wait for a healthy mesh before handing back the transport
Channels autoshard onto the relay shards the node subscribes to at startup, so
a publish only reaches peers once one of those shards has a gossipsub mesh.
Discovery plus grafting takes tens of seconds, and the previous unconditional
sleep(3s) returned long before that — so a message sent in the first seconds of
a conversation was published into an unformed mesh and silently dropped, only
sometimes rescued by SDS retransmission.

The node thread now waits on the topic-health event for the first shard to
reach a mesh (MinimallyHealthy or better) before reporting ready, bounded by a
timeout so an isolated node still comes up. Measured effect: an immediate
send after joining went from mostly dropping to landing ~6/7 of the time, with
startup settling in ~5s once the network is reachable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ai43sF2rymPFMG9iki9fwL
2026-07-18 21:31:48 +02:00
..