Skip to content

High CPU and repeated "gh auth token" failures when not signed in (worse without gh) #5256

Closed

Description

@nekrozis

Describe the bug

When Copilot CLI runs without a usable GitHub credential, the background auth probe copilot_runtime::auth::gh (i.e. gh auth token) is retried in a tight loop with no backoff. I hit this in a normal interactive session using a BYOK provider, with no GitHub account signed in: the process sat with a CPU core pegged while I was working in that session, and signing in (/login) brought it back to idle immediately. The faster the probe fails, the worse it gets — where gh is not resolvable on PATH every attempt fails in microseconds and the process busy-spins at ~145 % of one core; with gh installed but signed out it still spins at ~19 %.

Every attempt logs:

[WARNING] [rust:copilot_runtime::auth::gh] Failed to run `gh auth token` {"error":"program path has no file name","program":""}

Note "program":"" — the probe is invoked with an empty program path, so no process is spawned and the caller retries at once. The warning rate equals the retry rate: 274 lines/s in the reproduction below (inter-arrival median 3 ms, min 0 ms).

Affected version

GitHub Copilot CLI 1.0.101.

Windows standalone binary via winget (GitHub.Copilot). gh was absent from PATH when variant A was measured, and installed but signed out (2.103.2) for variant B.

Steps to reproduce the behavior

How I ran into it: a normal interactive session using a BYOK provider, with no GitHub account signed in. CPU sat with one core pegged for as long as the session was open, and %USERPROFILE%\.copilot\logs\process-*.log filled up with the warnings above. Signing in via /login brought CPU back to idle.

Isolated experiment (measurement only, not the trigger): the essential condition is just a session with no GitHub credential. Without one the CLI would exit immediately, so to keep such a session alive on demand I pointed the BYOK provider at a port that refuses connections and ran it headless (-p). This setup exists only to make the spin measurable — it is not the scenario in the report.

$env:COPILOT_HOME              = "C:\temp\cp-empty"        # empty dir => no credentials
$env:COPILOT_PROVIDER_BASE_URL = "http://127.0.0.1:9/v1"   # refuses connections
$env:COPILOT_PROVIDER_API_KEY  = "sk-test"

copilot -p "say hi" -s --model gpt-4o-mini --no-auto-update
  1. Run the block above with gh not on PATH (variant A).
  2. Run it again with gh installed but not signed in (variant B).
  3. Sample CPU per second: Get-Process copilot | Select-Object CPU.
  4. Inspect %USERPROFILE%\.copilot\logs\process-*.log (or point --log-dir at a directory).

Result:

Variant CPU auth::gh warnings
A: gh not on PATH ~145 % of one core, sustained for the whole run 9,921 lines in 36.2 s → 274 /s; inter-arrival median 3 ms, min 0 ms, p90 6 ms
B: gh on PATH, not signed in ~19 % of one core 0 lines

Three consecutive lines from variant A:

2026-10-26T07:23:17.891Z [WARNING] [rust:copilot_runtime::auth::gh] Failed to run `gh auth token` {"error":"program path has no file name","program":""}
2026-10-26T07:23:17.896Z [WARNING] [rust:copilot_runtime::auth::gh] Failed to run `gh auth token` {"error":"program path has no file name","program":""}
2026-10-26T07:23:17.899Z [WARNING] [rust:copilot_runtime::auth::gh] Failed to run `gh auth token` {"error":"program path has no file name","program":""}

Expected behavior

CPU should stay near idle during a session that has no GitHub credential — interactive or not — and an unresolvable gh binary should be treated as "gh unavailable": probed once, or on a backoff schedule, instead of being re-probed on every call.

Additional context

Environment

  • OS: Windows 10 Enterprise LTSC 10.0.19044, x64
  • Observed in an interactive session with a BYOK provider, no GitHub account signed in
  • The figures come from the headless experiment above: same log signature, easier to sample
  • No proxy configured

Earlier occurrence, same signature (first launch on this machine, 1.0.101, no login): 4,459 warnings in 37.0 s = 120.5 /s, median gap 7 ms, flat until the user signed in.

Notes on the mechanism

  • The probe fails without spawning anything ("program":""), so retry latency is ~0 and the loop period collapses to microseconds.
  • Failures appear to be retried immediately — no backoff, and the 0 ms inter-arrival gaps suggest overlapping attempts.
  • Other auth probes settle at a ~1.1 s cadence while network-bound (auth::manager_orchestration: Failed to fetch GitHub CLI user login (401) ↔ Failed to fetch PAT user login (401)), so the gh-probe path is the outlier.
  • With gh installed the loop is only slower (~19 % CPU), not gone.

Workaround

Signing in (/login) or exporting COPILOT_GITHUB_TOKEN / a fine-grained PAT stops the loop; installing gh only lowers the severity.

Possibly related (different root causes)

Activity

  1. added theissue type on Oct 26, 2026
  2. changed the title [-]Windows: High CPU and repeated "gh auth token" failures when not signed in (worse without gh)[/-] [+]High CPU and repeated "gh auth token" failures when not signed in (worse without gh)[/+] on Oct 26, 2026
  3. added
    area:authenticationLogin, OAuth, device auth, token management, and keychain integration
    and removed on Oct 27, 2026
  4. AetherMindForge commented on Oct 31, 2026

    @AetherMindForge

    Still happening in 1.0.105, and it also happens on Linux, with different log lines.

    Windows 11 (build 26200), Copilot CLI 1.0.105 from winget, gh not installed, signed out:

    • Copilot started on its own in a fresh console, signed out, measured for 5 minutes: about 23 MB of log (process-….log, .1.log, .2.log, about 10 MB each), with about 21,000 lines of Failed to run `gh auth token` . That is about 4.6 MB a minute.
    • The same laptop, signed in for a whole session: about 55 lines in total.

    Linux (Ubuntu 24.04.5, a clean container), Copilot CLI 1.0.105, gh not installed, signed out:

    • The same speed, about 66,500 lines (10 MB) every 2 minutes, but no gh auth token line at all. These six lines repeat about 95 times a second:
      [INFO] [rust:lsp::session_service] Resolved LSP telemetry consent {"telemetry_level":"off","source":"auth_change","rotated_clients":0}
      [INFO] [rust:copilot_runtime::storage::managed_settings] [managedSettings] device MDM: no policy present on this device
      [INFO] [rust:copilot_runtime::storage::managed_settings] [managedSettings] server policy fetch skipped: no authenticated GitHub host available
      [INFO] [rust:copilot_runtime::storage::managed_settings] [managedSettings] effective policy resolved: source=none, bypassDisabled=false, serverFetchFailed=false, …
      [INFO] [rust:otel] OTel session policy applied
      [INFO] Remote session access disabled
      
    • The log is kept to about 5 files (about 50 MB) per process; older files of the same process are removed. Each new signed-out process adds up to about 50 MB more.

    Signing in stops it on both. We did not measure CPU.

  5. copilot-cli-bot commented on Nov 11, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.109. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authenticationLogin, OAuth, device auth, token management, and keychain integration

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions