Fixes
- Session ID death spiral — Multiple concurrent requests would each independently try to refresh the session ID after a server restart, causing competing SSE reconnections that prevented stabilization. Session ID is now stored behind an
RwLock; only one writer wins and clears stale channels. - TCP connections survive SSE reconnects (server) — Previously, every SSE reconnect replaced the session entirely, destroying all active
tcp_writers. The server now reuses the existing session and only swaps the SSE channel, so in-flight TCP relays survive client reconnections seamlessly. - Dynamic
sse_txin relay tasks (server) — TCP relay tasks now fetchsse_txfrom the session on each send instead of capturing it at spawn time. This allows existing relays to automatically write to the new SSE channel after a reconnect. - Near-instant forced reconnect —
send_messagenow skips the 3-second retry sleep when triggering a forced SSE reconnect, enabling near-immediate recovery on POST failure. - Increased reconnect wait —
RECONNECT_WAITraised to 10s for better stability on high-latency links (e.g., Google Cloud Shell).