From 49116f2deb41cdd64bebd347cd962f145802e845 Mon Sep 17 00:00:00 2001 From: cheedo Date: Fri, 2 Jan 2026 18:50:02 -0800 Subject: [PATCH] feat(daemon): Add binary age detection to status command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shows binary modification time in gt daemon status and warns when the binary is newer than the running process, suggesting a restart. This helps detect when bug fixes or new features aren't active because the daemon is running old code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/daemon.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/internal/cmd/daemon.go b/internal/cmd/daemon.go index 175cbf5b..554c72e3 100644 --- a/internal/cmd/daemon.go +++ b/internal/cmd/daemon.go @@ -181,6 +181,16 @@ func runDaemonStatus(cmd *cobra.Command, args []string) error { state.LastHeartbeat.Format("15:04:05"), state.HeartbeatCount) } + + // Check if binary is newer than process + if binaryModTime, err := getBinaryModTime(); err == nil { + fmt.Printf(" Binary: %s\n", binaryModTime.Format("2006-01-02 15:04:05")) + if binaryModTime.After(state.StartedAt) { + fmt.Printf(" %s Binary is newer than process - consider '%s'\n", + style.Bold.Render("⚠"), + style.Dim.Render("gt daemon stop && gt daemon start")) + } + } } } else { fmt.Printf("%s Daemon is %s\n", @@ -192,6 +202,19 @@ func runDaemonStatus(cmd *cobra.Command, args []string) error { return nil } +// getBinaryModTime returns the modification time of the current executable +func getBinaryModTime() (time.Time, error) { + exePath, err := os.Executable() + if err != nil { + return time.Time{}, err + } + info, err := os.Stat(exePath) + if err != nil { + return time.Time{}, err + } + return info.ModTime(), nil +} + func runDaemonLogs(cmd *cobra.Command, args []string) error { townRoot, err := workspace.FindFromCwdOrError() if err != nil {