Skip to content

gh aw still hangs at startup under Windows ConPTY (Cursor integrated terminal) on v0.80.9 — PR #37823 guard doesn't cover live pseudo-consoles #41024

Description

@astefan

Summary

On Windows, every gh aw invocation — including no-op commands like gh aw version
and gh aw --help — hangs indefinitely at startup, producing zero output, when run
inside a ConPTY-based pseudo-terminal (specifically the Cursor IDE integrated
terminal). The same binary works fine in a normal console (Windows Terminal /
standalone PowerShell / cmd).

This looks like the same startup terminal-capability probe addressed in
PR #37823 ("Guard startup terminal probing on Windows when stderr is redirected"),
but that guard does not cover this case: the guard skips probing only when stderr
is redirected (pipe/file, e.g. CI). Under a live ConPTY the std handles look
like a real console character device, so the guard enables the probe, and the
probe then blocks waiting for a terminal query response that the pseudo-console
never returns.

Environment

  • OS: Windows 10 (10.0.19045)
  • gh: 2.95.0
  • gh aw: github/gh-aw v0.80.9 (latest release as of 2026-06-22)
  • Host terminal: Cursor IDE integrated terminal (PowerShell over Windows ConPTY)
  • Install: clean gh extension install github/gh-aw; on disk gh-aw.exe +
    manifest.yml + state.yml all present and intact.

Steps to reproduce

  1. On Windows, install the extension: gh extension install github/gh-aw.
  2. From a ConPTY-based pseudo-terminal (e.g. the Cursor IDE integrated terminal),
    run: gh aw version
  3. Observe: it hangs forever with no output. gh aw --help behaves the same.

Expected

gh aw version prints gh aw version v0.80.9 and exits promptly, as it does in a
real console.

Actual

Hangs at startup, before any output, on non-interactive commands. Must be killed.

Evidence / what I ruled out

  1. Not a corrupt installgh extension list shows v0.80.9; binary + manifest
    • state.yml are all intact. Reinstalling does not help.
  2. Not a network / auto-upgrade stall — state.yml shows the update check already
    completed and the extension is current; gh auth status reaches GitHub fine.
  3. Reproduces with full redirection — running gh-aw.exe directly with
    stdin/stdout/stderr all redirected to files STILL hangs. (This is the key signal
    that the Guard startup terminal probing on Windows when stderr is redirected #37823 stderr guard is insufficient: even with stderr redirected to a
    file, it hangs — suggesting the probe opens the console device directly rather
    than going through the redirected stderr handle.)
  4. Works in a real console — launching the exact same binary in a freshly
    allocated (hidden) conhost console completes immediately and prints the version.
    Only the terminal environment differs.
  5. Env-var bypass attempts don't help — CI=true, NO_COLOR=1, TERM=dumb all still
    hang, consistent with the probe querying the console device directly.

Suspected root cause

The Windows guard added in PR #37823 (shouldConfigureLipglossCompat /
configureLipglossCompat in pkg/styles/theme.go) gates the probe on whether
stderr is a console character device. That correctly skips probing when stderr
is redirected (CI/pipe), but:

  • Under a live ConPTY the handle still presents as a console char device, so the
    guard ENABLES the probe; and
  • the hang reproduces even when stderr IS redirected to a file, which implies the
    probe reaches the console device directly rather than honoring the stderr handle.

Net effect: the merged fix targets "stderr redirected" but not "interactive
pseudo-console that never answers the capability query" (Cursor's ConPTY).

Suggested directions (for maintainers)

  • Make the terminal-capability probe time-bounded / cancellable so an unanswered
    query can't block startup indefinitely.
  • Provide an explicit opt-out env var (e.g. GH_AW_NO_TERMINAL_PROBE=1) that fully
    disables the probe regardless of detected device type.
  • Re-examine whether the probe queries CONOUT$/CONIN$ directly; if so, the
    stderr-only guard cannot prevent this class of hang.

Workaround (for other users hitting this)

Run gh aw from an external console, or wrap it so it spawns in its own console:

spawn gh aw in a fresh hidden console and capture output back

Start-Process cmd -ArgumentList '/c','gh aw version 1>out.txt 2>&1' -WindowStyle Hidden -Wait
Get-Content out.txt

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions