From e04e07865b43de767f99e75ec1b75c44130d8a6a Mon Sep 17 00:00:00 2001 From: Chuenlye Leo Date: Wed, 26 Aug 2026 10:34:22 +0900 Subject: [PATCH] fix(doctor): drop --json authenticated for gh CLI compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gh CLI 2.98+ removed the 'authenticated' field from 'gh auth status --json' (only 'hosts' remains), causing the command to exit 1 even when the user is authenticated. The doctor then falsely reports 'No GITHUB_TOKEN' despite the user being logged in via 'gh auth login'. Since the code only checks the return code (it never parses stdout), the '--json' flag is unnecessary. 'gh auth status' without it works across all gh versions and returns exit 0 when authenticated. Fixes: gh auth status --json authenticated → gh auth status --- hermes_cli/doctor_state.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.py index 6702cd54ad..296371ecb9 100644 --- a/hermes_cli/doctor_state.py +++ b/hermes_cli/doctor_state.py @@ -294,9 +294,14 @@ def _check_state_db(should_fix: bool, f: Finding) -> None: def _gh_authenticated() -> bool: - """Check if gh CLI is authenticated via token file or device flow.""" + """Check if gh CLI is authenticated via token file or device flow. + + Plain ``gh auth status`` (exit code only): gh 2.98+ dropped the + ``authenticated`` JSON field, so ``--json authenticated`` exits 1 even + when logged in, and the doctor falsely reported "No GITHUB_TOKEN". + """ try: - result = subprocess.run(["gh", "auth", "status", "--json", "authenticated"], capture_output=True, timeout=10) + result = subprocess.run(["gh", "auth", "status"], capture_output=True, timeout=10) return result.returncode == 0 except (FileNotFoundError, subprocess.TimeoutExpired): return False