The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): sweep stale git locks at the start of the run, not only before the fetch
kokhlo9c6ff602d6c0
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex c616049f751..dc903fd98ac 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -1788,6 +1788,13 @@ def _cmd_update_impl(args, gateway_mode: bool):_record_stop("git_in_progress", without_receipt="failed") # before the receipt opens: a metrics row onlysys.exit(1)+ # Self-heal abandoned .git/*.lock files (a crashed fetch) and aborted-transfer pack temps+ # before anything else touches the checkout. Run at START, not only in the apply path+ # below: a run that dies between here and the fetch would otherwise leave the next run to+ # fail with "File exists" until an operator removed the lock by hand (#132089). Idempotent,+ # and _sweep_stale skips everything while a git process holds it.+ _check.clear_git_debris(_m().PROJECT_ROOT)+opts = _resolve_update_options(args, gateway_mode)gw_input_fn, assume_yes = opts.gw_input_fn, opts.assume_yes@@ -1878,17 +1885,6 @@ def _cmd_update_impl(args, gateway_mode: bool):returntry:- # Self-heal abandoned .git/*.lock files (crashed fetch) or the fetch fails "File exists".- from hermes_cli.gitlock import clear_stale_git_locks, clear_stale_tmp_packs- cleared = clear_stale_git_locks(_m().PROJECT_ROOT)- if cleared:- print(" (removed stale git lock(s): %s)" % ", ".join(cleared))- swept = clear_stale_tmp_packs(_m().PROJECT_ROOT)- if swept:- print(" (removed %d aborted-fetch pack temp file(s))" % len(swept))- # A partial clone must never write a commit-graph (#127711); keep its keys in place.- from hermes_cli.gitlock import settle_partial_clone_maintenance- settle_partial_clone_maintenance(_m().PROJECT_ROOT)_check.report_pack_tidy(_m().PROJECT_ROOT)# Shallow installer checkouts collect one `.git/shallow` graft per past depth-1 fetch# (#105951); stale grafts break merge-base and push this run into the divergence path.