feat(app): version handshake — GUI restarts a stale running daemon

The daemon outlives the GUI, so after an update an OLD daemon can keep serving
the socket and the new GUI just connects to it (stale code — e.g. the missing
TERM fix). Both binaries are now stamped with the git build id (build.rs):
the daemon reports it in `health.build`, and on connect the bridge compares it
to the GUI's own SPACESH_BUILD; on mismatch it shuts the daemon down and lets
ensure_daemon respawn the bundled (matching) one. No-op for unstamped dev
builds or daemons too old to report a build. Build id is shown in Settings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 12:39:46 +07:00
parent 8f431eaa40
commit cf7410b46a
6 changed files with 84 additions and 4 deletions
+1
View File
@@ -622,6 +622,7 @@ async fn handle_request(
Cmd::Health => {
let _ = out.send(ok(id, serde_json::json!({
"version": env!("CARGO_PKG_VERSION"),
"build": option_env!("SPACESH_BUILD").unwrap_or("dev"),
"pid": std::process::id(),
"started_at_ms": started_at_ms,
}))).await;