feat(#2038): hint matrix bridge errors may be a daemon restart

This commit is contained in:
damocles 2026-06-27 10:30:30 +02:00 committed by mara
commit 52de0ca648

View file

@ -35,9 +35,13 @@ use hive_matrix_mcp::protocol::{DaemonOp, DaemonRequest, DaemonResponse, InviteA
/// a single round-trip) so connection pooling would be over-engineering.
async fn round_trip(req: DaemonRequest) -> Result<DaemonResponse> {
let socket = paths::daemon_socket();
let stream = UnixStream::connect(&socket)
.await
.with_context(|| format!("connect daemon socket {}", socket.display()))?;
let stream = UnixStream::connect(&socket).await.with_context(|| {
format!(
"matrix daemon unreachable at {} — it may be starting up or restarting \
(the daemon rebinds its socket a few seconds after a restart); retry shortly",
socket.display()
)
})?;
let (reader, mut writer) = stream.into_split();
let mut line = serde_json::to_string(&req)?;
line.push('\n');