Skip to content

fix(win32): hide console for SSH and browser helpers - #14589

Closed
OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/aug14-win-sta4337-console-focus
Closed

OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/aug14-win-sta4337-console-focus

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On Windows, some background helper tasks — checking SSH connection settings, routing SSH traffic through jump hosts or proxies, closing stale browser-automation sessions, and reading encrypted browser cookies — could briefly flash a black command-prompt window over whatever you were doing, sometimes stealing keyboard focus from the app you were typing in. This change makes sure every such helper window stays hidden. Nothing else changes: the helpers run exactly as before, just invisibly. If you never noticed the flashes, this PR simply guarantees you won't.

Summary

On Windows, console-subsystem helpers launched by Orca's console-less Electron main process can create a visible console host that flashes over the user's work and steals keyboard focus. This combines the current-main versions of the SSH and browser hypotheses from #10497 and #10636 into one fresh patch for STA-4337 / #14543 / #10488.

The fix passes windowsHide: true at all six currently uncovered relevant call sites:

  • SSH -G configuration resolution
  • SSH ProxyJump
  • SSH ProxyCommand's explicit cmd.exe wrapper
  • agent-browser stale-session close
  • agent-browser ordinary commands
  • Windows Chromium DPAPI PowerShell extraction

No argv, stdio, env, timeout, output, exit-status, quoting, or cleanup behavior changes.

Validation

  • Current origin/main was reproduced as source-level broken: all six call shapes lacked windowsHide.
  • The six new regression assertions fail when only the production flags are disabled and pass with the fix restored.
  • Focused suite: 144 passed.
  • Browser module: 40 files / 639 passed.
  • Full three-project TypeScript typecheck: passed.
  • Changed-file oxlint and oxfmt: passed.
  • Performance audit: no added process creation, retry, polling, buffering, or retained memory; only one option property per existing spawn.
  • Fresh architecture and reproduction review lanes: clean.

A temporary isolated Electron GUI-parent oracle on Windows 2 exercised the exact argv/exit/output shapes. Windows Terminal made GetConsoleWindow() and foreground APIs unusable for this session and the independent top-level watcher saw no child console, so this run does not claim visual baseline/candidate proof. The regression tests intentionally cover the CI-suitable option boundary; the remaining OS-level visual/focus proof needs a Windows session with a reliable console-host/foreground oracle.

Full lint is currently blocked by stale generated skill manifests already present on main. The full SSH module is not a valid Windows baseline here: its unrelated failures depend on POSIX /bin/sh, system-OpenSSH path assumptions, and relay test environment. The changed SSH tests pass.

Original implementation attribution is preserved in commit 410a193249 via co-authorship with Wooseong Kim (@innocarpe).

Refs: STA-4337, #14543, #10488

Visual Proof

N/A — Windows-only fix that keeps background helper console windows HIDDEN (SSH config checks, proxy command, browser helpers). By design nothing appears on screen on any platform; not demonstrable on macOS.

Add windowsHide to the remaining console-subsystem child launches so Windows cannot flash a console or steal focus during SSH and browser workflows. Preserve the original argv, stdio, environment, timeout, and output behavior.

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa62fee2-f0f4-40e4-925a-794920c851a2

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb8836 and 410a193.

📒 Files selected for processing (8)
  • src/main/browser/agent-browser-bridge.test.ts
  • src/main/browser/agent-browser-bridge.ts
  • src/main/browser/browser-cookie-import.test.ts
  • src/main/browser/browser-cookie-import.ts
  • src/main/ssh/ssh-config-resolver.test.ts
  • src/main/ssh/ssh-g-config-resolution.ts
  • src/main/ssh/ssh-proxy-command.test.ts
  • src/main/ssh/ssh-proxy-command.ts

📝 Walkthrough

Walkthrough

The change sets windowsHide: true on agent-browser cleanup and command processes, Windows PowerShell DPAPI extraction, SSH configuration resolution, jump-host processes, and ProxyCommand processes. Tests verify the option for each browser and SSH execution path, including encrypted Chromium cookie import on Windows.

Merge Risk: ⚪ Minimal · up to 410a1

The PR limits Windows console creation for six existing SSH and browser helper launches without changing command arguments or process behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: hiding Windows console windows for SSH and browser helper processes.
Description check ✅ Passed The description clearly explains the problem, six affected call sites, preserved behavior, linked references, testing, and known validation limits.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@innocarpe

Copy link
Copy Markdown
Contributor

Acknowledged — #10497 and #10636 are now closed in favor of this combined current-main patch. Thank you for carrying the co-authorship and covering the six remaining windowsHide sites together.

@dcieslak19973

Copy link
Copy Markdown
Contributor

Rebased this onto current main (012e9f410c) in case it's useful — no rush and no pressure to take it.

The only conflict is src/main/browser/agent-browser-bridge.test.ts, which #14728 deleted when it split oversized test files off the max-lines list. Both of this PR's additions re-home cleanly into agent-browser-bridge-tab-routing.test.ts, where that test now lives verbatim (same closeCall body, same following test), so the anchor is unambiguous:

  • the windowsHide: true assertion appended to "closes the named agent-browser session when a tab closes"
  • the new test "hides the agent-browser console window for ordinary commands"

Scope and authorship are unchanged — still 8 files, +83/−5, still authored by @OrcaWin with @innocarpe's co-authorship trailer intact.

git fetch https://github.com/dcieslak19973/orca dcieslak19973/rebase-14589-win-console-hide
git cherry-pick bf85f692f7

Branch: https://github.com/dcieslak19973/orca/tree/dcieslak19973/rebase-14589-win-console-hide

Verified on the rebased tree — all six spawn sites guarded:

file line
ssh-g-config-resolution.ts 279 (the ssh -G probe that fires on ordinary connects)
ssh-proxy-command.ts 107 (ProxyJump ssh -W), 118 (cmd.exe ProxyCommand)
agent-browser-bridge.ts 2607 (stale-session close), 2670 (ordinary commands)
browser-cookie-import.ts 1114 (DPAPI PowerShell)

tsc -p config/tsconfig.node.json is clean and the SSH proxy-command, config-resolver, and tab-routing suites pass (29 tests). browser-cookie-import.test.ts fails only in my checkout on Cannot find package 'psl' — a stale local install missing the dep #12607 added, unrelated to this change.

Happy to drop this if you'd rather rebase it yourself — just didn't want the conflict to be the thing holding it up, since all five original spawn sites are still unguarded on main today.

@nwparker

Copy link
Copy Markdown
Contributor

Closing — adopted, and it conflicts now for a reason worth explaining.

The diagnosis is right: a GUI Electron process spawning a console-subsystem binary without windowsHide opens a real console window that flashes and steals foreground.

Of the sites here:

This PR now conflicts because agent-browser-bridge.test.ts was split into several files since you opened it, so rebasing it would be more work than carrying the two remaining lines forward.

#15887 also adds a ratchet: every file importing child_process is scanned, and a call without windowsHide fails the build. The allowlist starts at the 76 files that still offend and can only shrink. Enumerating them one PR at a time is how this class kept coming back, so it seemed worth closing the class rather than the instance.

Thanks.

@nwparker

Copy link
Copy Markdown
Contributor

Adopted in #15887 with credit; the SSH and cookie-import sites are already fixed on main by the W1 migration.

@nwparker nwparker closed this Aug 22, 2026
nwparker added a commit that referenced this pull request Aug 22, 2026
…#15887)

* fix(win32): hide the console window for agent-browser and git helpers

W1 routed most child processes through `runProcess`, which always sets
`windowsHide`. Six call sites still spawn directly, so each one opens a real
console window on Windows: it flashes and steals foreground. For the git status
poll, that is once per poll (#10488).

A ratchet now scans every file that imports `child_process` and fails on a call
without the flag. Its allowlist starts at the 76 files that still offend and can
only shrink — it doubles as the worklist for routing them through the chokepoint,
which is where the flag stops being a per-call-site decision at all.

Diagnosed in #14589; the SSH and cookie-import sites it also covered are already
fixed on main by the W1 migration.

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>

* test(wsl): stop the exec-mode guard scanning historical release checkouts

The cross-version e2e lane checks whole past releases out under
`tests/e2e/.cross-version-checkouts/`. The guard walked into them, so on any
machine that had run that lane it reported 21 offenders -- every one a copy of
shipped code we cannot edit -- and failed. Skip dot-directories; the >500-file
vacuity assertion still holds.

---------

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>
@nwparker

Copy link
Copy Markdown
Contributor

Landed: #15887 is merged (98c03fe12ff), with you credited as co-author.

paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 23, 2026
…stablyai#15887)

* fix(win32): hide the console window for agent-browser and git helpers

W1 routed most child processes through `runProcess`, which always sets
`windowsHide`. Six call sites still spawn directly, so each one opens a real
console window on Windows: it flashes and steals foreground. For the git status
poll, that is once per poll (stablyai#10488).

A ratchet now scans every file that imports `child_process` and fails on a call
without the flag. Its allowlist starts at the 76 files that still offend and can
only shrink — it doubles as the worklist for routing them through the chokepoint,
which is where the flag stops being a per-call-site decision at all.

Diagnosed in stablyai#14589; the SSH and cookie-import sites it also covered are already
fixed on main by the W1 migration.

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>

* test(wsl): stop the exec-mode guard scanning historical release checkouts

The cross-version e2e lane checks whole past releases out under
`tests/e2e/.cross-version-checkouts/`. The guard walked into them, so on any
machine that had run that lane it reported 21 offenders -- every one a copy of
shipped code we cannot edit -- and failed. Skip dot-directories; the >500-file
vacuity assertion still holds.

---------

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>
(cherry picked from commit 98c03fe)
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…stablyai#15887)

* fix(win32): hide the console window for agent-browser and git helpers

W1 routed most child processes through `runProcess`, which always sets
`windowsHide`. Six call sites still spawn directly, so each one opens a real
console window on Windows: it flashes and steals foreground. For the git status
poll, that is once per poll (stablyai#10488).

A ratchet now scans every file that imports `child_process` and fails on a call
without the flag. Its allowlist starts at the 76 files that still offend and can
only shrink — it doubles as the worklist for routing them through the chokepoint,
which is where the flag stops being a per-call-site decision at all.

Diagnosed in stablyai#14589; the SSH and cookie-import sites it also covered are already
fixed on main by the W1 migration.

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>

* test(wsl): stop the exec-mode guard scanning historical release checkouts

The cross-version e2e lane checks whole past releases out under
`tests/e2e/.cross-version-checkouts/`. The guard walked into them, so on any
machine that had run that lane it reported 21 offenders -- every one a copy of
shipped code we cannot edit -- and failed. Skip dot-directories; the >500-file
vacuity assertion still holds.

---------

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…stablyai#15887)

* fix(win32): hide the console window for agent-browser and git helpers

W1 routed most child processes through `runProcess`, which always sets
`windowsHide`. Six call sites still spawn directly, so each one opens a real
console window on Windows: it flashes and steals foreground. For the git status
poll, that is once per poll (stablyai#10488).

A ratchet now scans every file that imports `child_process` and fails on a call
without the flag. Its allowlist starts at the 76 files that still offend and can
only shrink — it doubles as the worklist for routing them through the chokepoint,
which is where the flag stops being a per-call-site decision at all.

Diagnosed in stablyai#14589; the SSH and cookie-import sites it also covered are already
fixed on main by the W1 migration.

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>

* test(wsl): stop the exec-mode guard scanning historical release checkouts

The cross-version e2e lane checks whole past releases out under
`tests/e2e/.cross-version-checkouts/`. The guard walked into them, so on any
machine that had run that lane it reported 21 offenders -- every one a copy of
shipped code we cannot edit -- and failed. Skip dot-directories; the >500-file
vacuity assertion still holds.

---------

Co-authored-by: OrcaWin <orcawin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants