Skip to content

fix(windows): hide console windows from the update signature check and OpenCode preflight - #52063

Merged
nwparker merged 1 commit into
stablyai:mainfrom
theobinomy:fix/windows-console-windows
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
theobinomy:fix/windows-console-windows

Conversation

@theobinomy

@theobinomy theobinomy commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On Windows, Orca sometimes made black command-prompt windows pop up for a moment. One showed up while Orca checked that a downloaded update was really signed by us. Others showed up while Orca checked OpenCode before starting it. This fix tells Windows to run those background helpers without a window. They do the same work, but nothing flashes on screen.

What Changed

  • Update signature check. New file config/patches/[email protected], registered in pnpm-workspace.yaml (the patch_hash lines in pnpm-lock.yaml change to match).
    • Before: electron-updater 6.8.12's windowsExecutableCodeSignatureVerifier.js runs Get-AuthenticodeSignature with execFile(..., { shell: true, timeout }) and no windowsHide. Electron's main process has no console, so cmd.exe and the powershell.exe it starts each opened a visible console window.
    • After: the patch adds one line, windowsHide: true, to the options in preparePowerShellExec. Nothing else in the file changes: shell: true, the arguments and escaping, and the Status, path and publisher checks are byte-for-byte the same. The handleError fallback uses the same options, so it is covered too.
  • OpenCode launch-model preflight. src/main/opencode/model-launch/opencode-launch-model-context.ts.
    • Before: the unsupervised spawnProcess call, which only runs on Windows, passed detached: true. libuv turns that into DETACHED_PROCESS, and Windows ignores CREATE_NO_WINDOW when that flag is set. So opencode serve had no console at all, and every console program it started (including the native binary started by OpenCode's npm launcher) opened its own visible window.
    • After: the flag is removed. The child gets the hidden console that windowsHide provides (the spawnProcess default), and its own child processes inherit that hidden console. The flag is removed outright instead of made conditional, because createProviderSpawnSpec sets supervised = platform !== 'win32', so this branch only runs on Windows. The POSIX supervised path (spawnProviderProcess) still detaches and does not change.

Why

Fixes visible console windows popping up in two background flows on Windows. Upstream electron-updater 7 already uses windowsHide: true (builder-util-runtime/src/authenticodeSignature.ts). Until Orca moves to it, a one-line pnpm patch is the smallest fix and keeps the built-in Authenticode check. Orca must never override verifyUpdateCodeSignature. The patch is pinned to the exact version 6.8.12. pnpm's default allowUnusedPatches: false makes install fail on a version bump until the patch is redone or dropped, so it cannot quietly go stale. detached: true in the preflight was left over from #42760, when one spawn call served both platforms.

Linked Issue

Fixes #52051

Visual Proof

N/A for screenshots. The window only flashes for a moment, so the proof is a Windows probe that checks the console window directly. Each probe runs from a parent process with no console, the same way Electron runs when started from Explorer. A PowerShell grandchild then reports GetConsoleWindow / IsWindowVisible. Real Windows host, Node v24.18.0:

opencode main (detached:true, windowsHide:true): grandchild hwnd=16255568 visible=True
opencode PR   (windowsHide:true):                grandchild hwnd=0 visible=False
updater main  (shell:true):                      hwnd=16321104 visible=True
updater PR    (shell:true, windowsHide:true):    hwnd=0 visible=False

Testing

  • Ran the real electron-updater verifier on Windows, unpatched and then patched, against a signed node.exe. In both cases the correct publisher was accepted (585 ms unpatched, 531 ms patched) and a wrong publisher was rejected with the usual failure string. The only difference in the execFile options was windowsHide: true.

  • A throwaway vitest (not committed) that stubs win32 checks that the preflight child is not detached. It fails on main and passes on this branch. No regression test was committed because it would only check a spawn flag or a line in a third-party file.

  • Patch integrity: the patch's index hash matches the unmodified 6.8.12 file. A diff -r of the unpatched and patched packages shows only that one line. The lockfile changes only the patch_hash lines; no version or integrity changes.

  • vitest run src/main/opencode src/main/updater src/main/provider-process: 12 files, 38 tests passed.

  • oxlint, oxfmt, anti-slop oxlint, native-plugin oxlint, ast-grep and the changed-code quality gate are all clean.

  • Platforms: Windows for the behavior. macOS for unit tests and to confirm the POSIX path is unchanged.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Performance

None, because only process-creation flags change, and only on Windows. The number of spawns is the same (1 before, 1 after), with no new I/O, subprocesses or polling. Neither path is hot: the signature check runs once per downloaded Windows update, and the preflight runs once per OpenCode launch attempt. No renderer or store code changes, so per-tab fan-out does not apply.

Risk

Level: Low

  • The riskiest part is the dependency patch. It adds one option line and does not touch the signature, path or publisher logic. The Windows run above confirms that verification still accepts the right publisher and rejects a wrong one.
  • Without the detach, the preflight child joins libuv's kill-on-close job on Windows. A preflight still running (it has a 10 s cap) now ends when Orca exits instead of being left orphaned.
  • Windows tree teardown (taskkill /T) does not rely on process groups, so it is unaffected.
  • Whichever of this PR and fix(updater): give the Windows installer signature check 120 s instead of 20 s #43005 (same patch file) merges second must combine both hunks into one patch and regenerate patch_hash.
  • To back it out, revert this commit.

Review

Reviewed for correctness, security (the dependency patch was read byte by byte) and performance. The root cause was checked against libuv's src/win/process.c.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Original fix by theobinomy in #52063. Their authorship is kept on the commit.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR hides console windows during Windows update signature checks and OpenCode launch checks.

  • Windows update signature checks keep their PowerShell window hidden.
  • OpenCode's Windows preflight keeps its console programs hidden.

Reviews (2) · Last reviewed commit: "fix(windows): hide console windows from ..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The updater patch adds windowsHide: true to the PowerShell process options and is mapped to [email protected] in the workspace configuration. The unsupervised OpenCode child spawn no longer sets detached: true. Its program, arguments, working directory, and environment remain passed to the spawn.

Merge Risk: Minimal · up to 6e5b9 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Issue #52051 has two coding requirements. Signature verification must stay enabled, and neither path may show a console window.

(1) Update signature check [#52051]: config/patches/electron-updater@6.…
Out of Scope Changes check Passed The changed files are config/patches/[email protected], pnpm-workspace.yaml, and src/main/opencode/model-launch/opencode-launch-model-context.ts. Each change maps to an objective in #52051…
Title check Passed The title names the two Windows-only changes: hiding console windows in the update signature check and in the OpenCode preflight. It matches the changeset and the linked issue #52051. It uses the conv…
Description check Passed The description follows the repository template. It covers ELI5, What Changed (before and after with mechanism), Why, a linked issue (Fixes #52051), Visual Proof (N/A with a reason and a probe output)…
Full details: Linked Issues check

Explanation

Issue #52051 has two coding requirements. Signature verification must stay enabled, and neither path may show a console window.

(1) Update signature check [#52051]: config/patches/[email protected] adds windowsHide: true to the preparePowerShellExec options. Those options feed the shell: true Get-AuthenticodeSignature execFile call. pnpm-workspace.yaml maps the patch to [email protected]. The PR description states that the signature, path, and publisher checks are unchanged.

(2) OpenCode launch model preflight [#52051]: src/main/opencode/model-launch/opencode-launch-model-context.ts sets detached to process.platform !== 'win32'. On Windows the opencode serve child is no longer detached. windowsHide stays on through the spawnProcess default. The new comments state that the Windows path stays attached to avoid separate console windows.

Evidence for (2) comes from the author's reasoning and manual Windows 11 checks described in the PR description. Those checks are not reproduced here, and no automated test covers this behavior. The change matches the expected behavior in the issue. The side effect that the preflight child now ends if Orca exits mid-preflight is disclosed in the PR description and is not a stated requirement violation.

The current-head summary shows the same mechanism as the prior review. The changes since the previous head were not inspected in detail, so this verdict relies on the supplied summary.

Full details: Out of Scope Changes check

Explanation

The changed files are config/patches/[email protected], pnpm-workspace.yaml, and src/main/opencode/model-launch/opencode-launch-model-context.ts. Each change maps to an objective in #52051. The patch adds windowsHide to the signature-check options. The workspace entry registers that patch. The preflight change sets detached per platform. The external editor launch file is intentionally untouched, as the PR description states. pnpm-lock.yaml is excluded by the ignored-files rule. Its absence does not affect this assessment, because the lock file follows from the patch registration. The overlap with PR #43005 on the same patch file is a merge coordination note, not an out-of-scope change. No unrelated change is demonstrated.

Full details: Title check

Explanation

The title names the two Windows-only changes: hiding console windows in the update signature check and in the OpenCode preflight. It matches the changeset and the linked issue #52051. It uses the conventional fix(windows) prefix and is 89 characters long, which is within a reasonable length.

Full details: Description check

Explanation

The description follows the repository template. It covers ELI5, What Changed (before and after with mechanism), Why, a linked issue (Fixes #52051), Visual Proof (N/A with a reason and a probe output), Testing with checked boxes and platforms, Performance with a completed 'None, because' line, Risk with a level and back-out plan, AI Disclosure (left blank, which the template allows for internal contributors), the upstream boundary checkbox, Notes, and the Checklist. The description is detailed and specific. The only gap is that the Risk level and some checklist items are asserted rather than fully evidenced in the description itself, but this does not make the description incomplete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3a751e8-933c-4eda-8e6e-06f6b32392a0
Commits

Reviewing files that changed from the base of the PR and between 6be00c0 and 6e5b969.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 1

  • src/main/opencode/model-launch/opencode-launch-model-context.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

…d OpenCode preflight

electron-updater 6.8.12 verifies the downloaded installer's Authenticode
signature with execFile({ shell: true }) and no windowsHide, so Windows
opened a visible console for cmd.exe and powershell.exe. Patch the
verifier to pass windowsHide: true; the signature, path and publisher
checks are unchanged.

The Windows-only OpenCode launch-model preflight spawned opencode serve
with detached: true. libuv maps that to DETACHED_PROCESS, which overrides
CREATE_NO_WINDOW, so the child had no console and every console program
it started opened its own window. Drop the flag so the child gets the
hidden console. The POSIX supervised path still detaches.

Fixes stablyai#52051
@nwparker
nwparker force-pushed the fix/windows-console-windows branch from 6be00c0 to 6e5b969 Compare November 28, 2026 23:28
@nwparker nwparker changed the title fix(windows): stop console windows from the update signature check and OpenCode preflight fix(windows): hide console windows from the update signature check and OpenCode preflight Nov 28, 2026
@nwparker
nwparker merged commit 69cfd36 into stablyai:main Nov 28, 2026
69 of 70 checks passed
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.

[Bug]: Windows: console window from the update signature check and the OpenCode model preflight

2 participants