mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-06 05:17:15 +00:00
Review finding (#144647, P2): the object-store lock sweep removed a live writer's lock. _git_proc_running matched only processes named exactly `git` (git-core's dashed executables, e.g. a `git-commit-graph` writer, ran unseen) and answered "no git running" whenever pgrep was missing or failed. A writer stopped after taking commit-graph.lock, its lock aged past ten minutes, lost the lock to the sweep; once resumed the repo was left with no commit graph while Hermes had stamped it fresh. The guard now fails closed: on POSIX it scans with psutil (pgrep with a `^git(-.*|\.exe)?$` pattern in the dependency-free bootstrap), on Windows it reads every tasklist image name; both match git, git-<sub> and .exe through _early_recovery._git_program. A probe that cannot tell (pgrep missing or erroring, tasklist failing, a psutil read denied) keeps every lock. This covers every sweep that shares the guard (update-path shallow/index/HEAD locks, tmp-pack debris), not only the graph refresh. The freshness stamp is written only when a graph is on disk after a successful write (a split chain whose layers all exist, or a monolithic graph): a write that exits 0 with no graph, as in a commitless repo, no longer marks the repo fresh.