The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): run gh auth token under the noninteractive git env
Tekniumd783c312a79a
diff --git a/hermes_cli/git_credentials.py b/hermes_cli/git_credentials.pyindex d08a5f0dec4..c6ffb5b57bf 100644--- a/hermes_cli/git_credentials.py+++ b/hermes_cli/git_credentials.py@@ -27,7 +27,7 @@ import subprocessimport urllib.parsefrom typing import Mapping, Optional-from hermes_cli._subprocess_compat import windows_hide_flags+from hermes_cli._subprocess_compat import noninteractive_git_env, windows_hide_flagslogger = logging.getLogger(__name__)@@ -54,9 +54,11 @@ def _github_token() -> Optional[str]:if not gh:return Nonetry:+ env = noninteractive_git_env()+ env["GH_PROMPT_DISABLED"] = "1"result = subprocess.run([gh, "auth", "token"], capture_output=True, text=True, encoding="utf-8", errors="replace",- timeout=10, stdin=subprocess.DEVNULL, creationflags=windows_hide_flags())+ timeout=10, stdin=subprocess.DEVNULL, env=env, creationflags=windows_hide_flags())except (OSError, subprocess.TimeoutExpired) as exc:logger.debug("gh auth token lookup failed: %s", exc)return Nonediff --git a/tests/hermes_cli/test_noninteractive_git.py b/tests/hermes_cli/test_noninteractive_git.pyindex 72f5f4a177a..a3e0588965f 100644--- a/tests/hermes_cli/test_noninteractive_git.py+++ b/tests/hermes_cli/test_noninteractive_git.py@@ -202,7 +202,8 @@ def _capture_run(monkeypatch, module, **result_kwargs):def _assert_noninteractive(call: dict):- assert call.get("stdin") is subprocess.DEVNULL, call["argv"]+ # A stdin fed by ``input=`` (git credential fill's request) is written and closed, not a terminal.+ assert call.get("stdin") is subprocess.DEVNULL or "input" in call, call["argv"]env = call.get("env")assert env is not None and env.get("GIT_TERMINAL_PROMPT") == "0", call["argv"]