Skip to content

fix(windows): close two console-flash sites #53829's sweep missed (gateway gh/git probes) - #53844

Closed
lpaiu-cs wants to merge 3 commits into
NousResearch:mainfrom
lpaiu-cs:fix/windows-console-flash-gateway-gaps
Closed

fix(windows): close two console-flash sites #53829's sweep missed (gateway gh/git probes)#53844
lpaiu-cs wants to merge 3 commits into
NousResearch:mainfrom
lpaiu-cs:fix/windows-console-flash-gateway-gaps

Conversation

@lpaiu-cs

@lpaiu-cs lpaiu-cs commented Jun 27, 2026

Copy link
Copy Markdown

What does this PR do?

Hides the console window on two Windows console-flash sites the (now-reverted) sweep chain never reached: the gh auth token probe in hermes_cli/copilot_auth.py, and the Cmd-P file-finder's git probes in tui_gateway/server.py. Both flash a console from the windowless desktop gateway today.

Updated after #53853. The first cut routed these through the _subprocess_compat.run / popen chokepoint, but #53853 reverted #53791 / #53810 / #53829 and removed those wrappers — so as-written it would AttributeError on current main. This now passes creationflags=windows_hide_flags() directly (the helper that survived the revert), the same approach the sibling #53892 took. Net diff is just the two probe sites + a test.

Why these two were missed

capture_output is not a no-window boundary on a console-less parent (pythonw.exe) — a console-subsystem child still allocates (and flashes) a console. Even so, two sites wouldn't be caught by a call-site checker:

  1. copilot_auth.py — lint-invisible. The call is subprocess.run(cmd, …) where cmd = [gh_path, "auth", "token"] is a variable, so a literal-argv rule can't tell it's gh.
  2. tui_gateway/server.py — out of scan scope. tui_gateway/ isn't in the footgun checker's package roots, so it was never linted.

Fix

Pass creationflags=windows_hide_flags() (CREATE_NO_WINDOW on win32, 0/no-op on POSIX) to the gh probe and the two git probes. No new helper surface — uses what survived #53853.

Scope note

This targets the idle / periodic probe flash (constant cadence, no live session) — the same mechanism captured on Windows 11 while debugging #52310 (gateway gh/git probe → visible console window; the no-window flag removes it). It is not aimed at the hermes update → gateway-restart flurry that #53853 reset to baseline (that lives in the re-exec / launcher legs, not these call sites). Sibling #53892 covers the periodic git_probe leg + the re-exec phantom; this covers the gh and Cmd-P git sites it doesn't.

Verification — Windows 11

  • pytest tests/hermes_cli/test_copilot_auth.py26 passed, including TestGhCliTokenHidesConsole::test_try_gh_cli_token_passes_no_window_flag, which asserts the gh lookup passes the no-window flag — the only regression guard for that lint-invisible site.

Related

Type of Change

  • 🐛 Bug fix
  • ✅ Tests

lpaiu-cs and others added 2 commits June 28, 2026 07:06
… missed through the chokepoint

NousResearch#53791/NousResearch#53829's console-spawn rule exempts output-captured calls — right in
general, but the desktop gateway runs under console-less pythonw.exe, where a
captured console child still allocates (and flashes) a new console. Two sites
slipped the sweep:

- hermes_cli/copilot_auth.py (gh auth token): the argv is a variable, so the
  checker's literal-argv rule can't see it's gh. Lint-invisible -> added a
  regression test as its only guard.
- tui_gateway/server.py (Cmd-P finder git rev-parse / ls-files): tui_gateway
  isn't in the checker's --all roots, so these were never scanned.

Both now go through _subprocess_compat.run (the NousResearch#53810 chokepoint), matching
the convention NousResearch#53829 used for its other sites. See NousResearch#52310 / canonical NousResearch#42544.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The console-spawn guard (NousResearch#53791/NousResearch#53829) scans a fixed package list, and
tui_gateway/ was absent — so the gateway's own git probes were never linted
(this is why server.py slipped). Adding it makes the guard cover the gateway
package. Surfaces two pre-existing hasattr-guarded signal handlers in
entry.py; marked '# windows-footgun: ok' (false positives — guard is on the
line above, which the line-based scanner can't see).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) platform/windows Native Windows-specific behavior or breakage P2 Medium — degraded but workaround exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation labels Jun 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Same Windows console-flash family as merged #53829 / #53810 / #53791 and the open #53123 / #53397 / #53781 -- but these two spawn sites (gh auth token in hermes_cli/copilot_auth.py and the Cmd-P git probes in tui_gateway/server.py) are disjoint from what those covered, so related, not duplicate. Flagging the cluster for the maintainer to sequence.

@lpaiu-cs

Copy link
Copy Markdown
Author

Thanks — agreed, related not duplicate. To confirm the split: #53791 / #53810 / #53829 covered the rest of cluster B, including #53123, which I've since closed in favor of this PR (3 of its 5 sites were swept by that chain). The remaining two are disjoint precisely because they're structurally invisible to that sweep: copilot_auth.py's argv is a variable, so the literal-argv rule can't see it's gh; and tui_gateway/ isn't in the checker's --all roots, so server.py was never scanned (this PR adds it). No sequencing dependency — it applies cleanly on current main.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Windows console-flash closure (5 files). Well-structured fix:

  • Routes gh auth token subprocess through _subprocess_compat chokepoint
  • Adds tui_gateway to the footgun checker's scan roots
  • New test TestGhCliTokenHidesConsole verifies the routing
  • Proper comment explaining why the footgun checker can't catch this site itself (variable program name)

Clean fix for a known Windows console-flash issue.

…ch#53853 revert

The first cut routed these probes through _subprocess_compat.run/popen (the
NousResearch#53810 chokepoint), but NousResearch#53853 reverted NousResearch#53791/NousResearch#53810/NousResearch#53829 — so those calls
would now AttributeError on main (the wrappers are gone; windows_hide_flags()
survived). Switch the two sites to pass creationflags=windows_hide_flags()
directly, the same surviving-helper approach NousResearch#53892 took post-revert.

Also drop the now-moot footgun changes: the console-spawn rule was reverted, so
adding tui_gateway to its --all roots no longer buys anything (and would only
surface unrelated, hasattr-guarded signal handlers in entry.py). Net change is
now just the two gateway probe sites + the test, which asserts the no-window
flag is passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lpaiu-cs

Copy link
Copy Markdown
Author

Heads-up @tonydwb — I've updated this since your review, so it's worth a re-look.

The first version routed both probes through the _subprocess_compat.run chokepoint, but that helper was reverted out of main by #53853 (which rolled back #53791 / #53810 / #53829). As-written it would AttributeError on current main, even though the diff itself merges cleanly.

The new commit switches both sites to creationflags=windows_hide_flags() directly — that helper survived the revert (same approach the sibling #53892 uses post-revert). Net diff is now just the two probe sites + the test; the now-moot tui_gateway footgun-roots change is dropped since the console-spawn rule it relied on was reverted too.

@lpaiu-cs

Copy link
Copy Markdown
Author

#53844 is covered all issue that I said, so I will close this PR. LGTM.

@lpaiu-cs lpaiu-cs closed this Jun 28, 2026
@lpaiu-cs
lpaiu-cs deleted the fix/windows-console-flash-gateway-gaps branch June 28, 2026 13:51
@LZL0

LZL0 commented Jun 28, 2026

Copy link
Copy Markdown

The issue is still there on the latest version.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants