From 186ee430b5a74bca37209eb6d045701d8a853e44 Mon Sep 17 00:00:00 2001 From: damocles Date: Thu, 4 Jun 2026 11:42:45 +0200 Subject: [PATCH] docs: comment std::process::exit(0) intent in M_UNKNOWN_TOKEN recovery --- hive-matrix-mcp/src/client.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hive-matrix-mcp/src/client.rs b/hive-matrix-mcp/src/client.rs index 41121b7a..1db66db4 100644 --- a/hive-matrix-mcp/src/client.rs +++ b/hive-matrix-mcp/src/client.rs @@ -84,6 +84,12 @@ pub async fn build_and_restore( "failed to remove sdk state dir; next startup may fail with stale state" ); } + // Exit 0 rather than returning Err: `hive-matrix-daemon` is a + // single-purpose process binary; the call site is before any + // tasks are spawned so there are no resources to clean up. + // Using exit(0) (not Err) keeps systemd's Restart=on-failure + // from looping — the systemd.paths watcher re-launches us + // once hive-c0re writes a fresh token file. std::process::exit(0); } return Err(e);