You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 407163d
Browse filesBrowse the repository at this point in the historyBrowse files
fix(doctor): warn when the hostagent's binary was replaced under it (#17)
#14 made the binary-replacement check work when the hostagent runs a different
path than the current klimax. It still could not see the case that actually
causes the failure: the same path, replaced underneath a running process.
`make dev-install` does `sudo cp` over /usr/local/bin/klimax, overwriting the
file the hostagent is executing — which is what makes macOS amfid kill
subsequent klimax execs. Both sides of a path comparison still read
"/usr/local/bin/klimax", so doctor reported OK while the machine was in exactly
the broken state the check exists to catch.
Compare timestamps instead: if the binary's mtime is later than the process
start time, it was replaced after launch. Process start comes from the kernel
proc table via sysctl — there is no /proc on macOS, and `ps` only offers a
locale-formatted date.
A Homebrew upgrade does NOT trigger amfid, because it writes a new file into the
Caskroom and re-points the symlink, so the running process keeps its own inode.
It does still trip this check — correctly: the hostagent is running an older
klimax and the VM wants rebuilding either way. Hence a warning, never a failure;
mtime is a heuristic and a rebuild producing identical content would also trip
it.
processStartTime is darwin-only and split across build tags, since internal/cli
builds for linux today and must keep doing so.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01298bsrxR44xPnT3qM9fu2D
Message: fmt.Sprintf("hostagent (pid %d) is running a binary that has since been replaced", pid),
462
+
Detail: fmt.Sprintf("%s was modified at %s, after the hostagent started at %s.\n It is still running the old code; klimax execs may fail with 'killed'.",
0 commit comments