diff --git a/server/src/main.rs b/server/src/main.rs index 9c02d514..7c75ab47 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -171,6 +171,11 @@ async fn main() -> Result<(), std::io::Error> { } }); + // Log the build hash so we can verify which commit is running. + let build_hash = std::fs::read_to_string(".huskies/build_hash") + .unwrap_or_else(|_| "unknown".to_string()); + slog!("[startup] Running build: {}", build_hash.trim()); + let app_state = Arc::new(SessionState::default()); let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); // Migrate legacy root-level store.json into .huskies/ if the new path does diff --git a/server/src/rebuild.rs b/server/src/rebuild.rs index 9ab8074d..b4f5af0e 100644 --- a/server/src/rebuild.rs +++ b/server/src/rebuild.rs @@ -175,7 +175,18 @@ pub async fn rebuild_and_restart( return Err(format!("Build failed:\n{stderr}")); } - slog!("[rebuild] Build succeeded, re-execing with new binary"); + // Write the current git HEAD to a file so we can verify which commit is running. + if let Ok(head) = std::process::Command::new("git") + .args(["rev-parse", "--short", "HEAD"]) + .current_dir(workspace_root) + .output() + { + let hash = String::from_utf8_lossy(&head.stdout).trim().to_string(); + let _ = std::fs::write(workspace_root.join(".huskies/build_hash"), &hash); + slog!("[rebuild] Build succeeded (commit {hash}), re-execing with new binary"); + } else { + slog!("[rebuild] Build succeeded, re-execing with new binary"); + } // 5. Send shutdown notification before replacing the process so that chat // participants know the bot is going offline. Best-effort only — we