The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(update): move the no-prompt git kwargs helper where the bootstrap can reach it
Teknium54365962e87b
diff --git a/hermes_cli/_subprocess_compat.py b/hermes_cli/_subprocess_compat.pyindex 07dc5b50439..57341530ce3 100644--- a/hermes_cli/_subprocess_compat.py+++ b/hermes_cli/_subprocess_compat.py@@ -220,6 +220,26 @@ def windows_hide_flags() -> int:return _CREATE_NO_WINDOW if IS_WINDOWS else 0++def no_prompt_git_kwargs() -> dict:+ """``subprocess.run`` kwargs for the updater's network git calls.++ GitHub answers anonymous fetches with HTTP 401 during outages (and for+ unreachable repos); git then prompts ``Username for 'https://github.com':``+ on the inherited terminal and the update sits there forever. Disable the+ prompt so the fetch fails fast into ``_classify_fetch_failure``. Only the+ *prompt* is disabled — a configured credential helper / askpass still+ runs, so a private-fork origin keeps authenticating non-interactively.+ Lives here, dependency-free, because the update hand-off's bootstrap+ interpreter runs the treeless conversion before any dependency exists.+ """+ env = dict(os.environ)+ env["GIT_TERMINAL_PROMPT"] = "0"+ env["GCM_INTERACTIVE"] = "Never"+ # Every network git spawn (fetch/pull/shallow heal) runs under a console-less+ # desktop backend on Windows; hide the per-spawn console (#117781).+ return {"stdin": subprocess.DEVNULL, "env": env, "creationflags": windows_hide_flags()}+def suppress_platform_ver_console() -> None:"""Stub ``platform._syscmd_ver`` on Windows so it never flashes a console. No-op elsewhere.diff --git a/hermes_cli/gitlock.py b/hermes_cli/gitlock.pyindex 1396a8dc6e3..3258729bece 100644--- a/hermes_cli/gitlock.py+++ b/hermes_cli/gitlock.py@@ -543,7 +543,7 @@ def fetch_full_commit_graph(repo_root: Path, *extra_refspecs: str, **run_kwargs)"""shallow_path = _shallow_file_path(repo_root)shallow = shallow_path is not None- # Callers already inject creationflags via _no_prompt_git_kwargs(); OR the+ # Callers already inject creationflags via no_prompt_git_kwargs(); OR the# hide flag into the shared kwargs instead of passing the keyword twice# (TypeError: got multiple values) — the config probes below inherit it.run_kwargs["creationflags"] = run_kwargs.get("creationflags", 0) | windows_hide_flags()@@ -659,11 +659,12 @@ def convert_treeless_checkout_first(repo_root: Path) -> None:``_update_takeover.prepare``) call this before minutes of dependency work: a Desktop built beforethe fix keeps walking history during that window, and on a treeless checkout every walkdownloads trees again (#129514: 434 GB, disk full mid-update). Runs in the dependency-free- bootstrap interpreter, so only the prompt is disabled here; a credential helper still works.+ bootstrap interpreter."""- env = {**os.environ, "GIT_TERMINAL_PROMPT": "0", "GCM_INTERACTIVE": "Never"}+ from hermes_cli._subprocess_compat import no_prompt_git_kwargs+try:- if convert_treeless_checkout(repo_root, env=env):+ if convert_treeless_checkout(repo_root, **no_prompt_git_kwargs()):print(" ✓ Fetched this checkout's directory history once; updates stop re-downloading it",flush=True)except (OSError, subprocess.SubprocessError) as exc:diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex a252a207471..13509f0674d 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -17,6 +17,8 @@ from dataclasses import dataclassfrom pathlib import Pathfrom typing import NoReturn+# Old updaters load _no_prompt_git_kwargs from here after the checkout swap (frozen surface).+from hermes_cli._subprocess_compat import no_prompt_git_kwargs as _no_prompt_git_kwargsfrom hermes_cli.config import get_hermes_home # noqa: F401 (re-exported; patched via update_cmd)from hermes_cli import update_handoff as _update_handofffrom hermes_cli.update_cmd_common import _best_effort@@ -193,25 +195,6 @@ def _map_ssl_cert_file_for_git(git_cmd) -> None:os.environ["GIT_SSL_CAINFO"] = bundle-def _no_prompt_git_kwargs() -> dict:- """``subprocess.run`` kwargs for the updater's network git calls.-- GitHub answers anonymous fetches with HTTP 401 during outages (and for- unreachable repos); git then prompts ``Username for 'https://github.com':``- on the inherited terminal and the update sits there forever. Disable the- prompt so the fetch fails fast into ``_classify_fetch_failure``. Only the- *prompt* is disabled — a configured credential helper / askpass still- runs, so a private-fork origin keeps authenticating non-interactively.- """- env = dict(os.environ)- env["GIT_TERMINAL_PROMPT"] = "0"- env["GCM_INTERACTIVE"] = "Never"- # Every network git spawn (fetch/pull/shallow heal) runs under a console-less- # desktop backend on Windows; hide the per-spawn console (#117781).- from hermes_cli._subprocess_compat import windows_hide_flags- return {"stdin": subprocess.DEVNULL, "env": env, "creationflags": windows_hide_flags()}--_UPDATE_CRITICAL_FILES = ("hermes_cli/main.py", "hermes_cli/config.py", "hermes_cli/__init__.py","hermes_cli/web_server.py", "cli.py", "run_agent.py", "model_tools.py", "toolsets.py",