Skip to content

feat(windows): add native Windows ARM64 package support - #9026

Closed
jinhyunchun wants to merge 3 commits into
stablyai:mainfrom
jinhyunchun:feat/windows-arm64-native-package
Closed

jinhyunchun wants to merge 3 commits into
stablyai:mainfrom
jinhyunchun:feat/windows-arm64-native-package

Conversation

@jinhyunchun

@jinhyunchun jinhyunchun commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a native Windows ARM64 package. Until now Orca shipped only an x64 Windows installer, so Windows-on-ARM devices (Snapdragon X laptops, ARM VMs) run the entire app under x64 emulation. This PR makes pnpm build:win:arm64 produce a native orca-windows-setup-arm64.exe while leaving the existing x64 build path byte-for-byte unchanged.

How the port handles each native dependency:

  • node-pty (terminal) — the packaging hook stages node-pty's published win32-arm64 prebuild into build/Release instead of source-rebuilding, so no cross-architecture MSVC toolchain is required. Every staged binary's PE header is verified against the target machine type (0xaa64) before packaging; a wrong-architecture file fails the build rather than shipping a broken terminal.
  • sherpa-onnx (offline speech) — upstream publishes no Windows ARM64 addon, so local dictation is gated off on win32/arm64: the model catalog, model states, downloads, and dictation start all flow through one speech-platform-support module. Cloud (OpenAI) transcription keeps working. A persisted local model selection (e.g. settings migrated from an x64 install) is reconciled at startup, and attempts surface a stable voice_local_dictation_unavailable error code mapped to a localized toast with an "Open Settings" action.
  • agent-browser (browser automation) — upstream publishes no win32-arm64 executable but supports running its x64 binary under Windows on ARM emulation; the runtime resolver and packaging share that fallback, pinned together by a test.
  • Packaging correctness — arch-specific resources and the installer artifact name key off ORCA_WINDOWS_ARM64_BUILD, and validateWindowsPackageArchitecture fails the build loudly if the env flag and electron-builder's target arch ever disagree (e.g. a bare electron-builder --win --arm64 invocation), so a mislabeled or x64-contaminated ARM64 package cannot be produced silently.

Screenshots

image image

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

All checks were run natively on Windows 11 ARM64 (Node 24.18.0, pnpm 10.24.0) — i.e., on the target hardware of this port. Full-suite context on that host: every test file this PR touches passes (speech suite 82/82; orca-runtime.test.ts 701/701; all new packaging suites). The suite has ~37 files with pre-existing failures on a Windows ARM64 host — I verified they fail identically on the base commit (hardcoded /tmp paths, symlink EPERM without developer mode, Linux-only shims), so they are host-environment issues, not regressions. This PR actually improves the ARM64-host baseline: 20 stt-service.test.ts tests that fail on main there (the sherpa native package cannot resolve) now pass via an explicit platform pin/mock.

New/updated tests:

  • config/scripts/windows-node-pty-prebuild.test.mjs — PE-machine verification accepts a real ARM64 prebuild and rejects an x64 one; staging replaces stale host build output.
  • config/scripts/windows-package-architecture.test.mjs — arch-specific resources/artifact naming, plus a cross-pinning test asserting the packaged agent-browser filename equals what the runtime resolver requests.
  • config/scripts/electron-builder-native-rebuild.test.mjs — staging fires for win32/arm64 regardless of host arch; env-flag/target-arch mismatches are rejected.
  • src/main/speech/speech-platform-support.test.ts, src/main/ipc/speech.test.ts, src/main/speech/model-manager.test.ts — catalog/state filtering, settings reconciliation, stable error code.
  • src/main/browser/agent-browser-binary-name.test.ts, src/renderer/src/components/dictation/dictation-start-error-toast.test.ts — x64 fallback naming and the remediation toast.
  • src/main/speech/stt-service.test.ts, src/main/speech/model-manager*.test.ts — made host-independent (platform pinned/mocked) so they pass on Windows ARM64 dev machines too; ModelManager.downloadModel gained injectable platform/arch parameters consistent with getModelStates.

Notes

  • CI/release is intentionally out of scope. release-cut.yml has no Windows ARM64 matrix entry; this PR only adds the local build path. Wiring CI needs maintainer decisions: a windows-11-arm matrix entry, parametrizing the many dist/win-unpacked / orca-windows-setup.exe hardcoded steps, a second SignPath approval flow, and — the real design question — an updater-manifest strategy, since both Windows jobs would clobber latest.yml today. Suggest shipping ARM64 outside the auto-update channel first.
  • Deliberate behavior change: a persisted sttModel that no longer exists in the catalog is now cleared at startup on all platforms (previously it lingered and dictation failed opaquely).
  • ARM64 Windows hosts always use the verified node-pty prebuild rather than a source rebuild (no MSVC requirement); x64 hosts keep the existing source-rebuild path.
  • Future upstream flips: when sherpa-onnx or agent-browser ship native win32-arm64 binaries, the gate/fallback should be reverted; the sites are cross-referenced in comments (speech-platform-support.ts, agent-browser-binary-name.ts, windows-package-architecture.cjs).

Issues

Fixes #8607

Maintainer update (rebased onto main)

  • Rebased onto current main (it was 1,500+ commits behind and conflicting).
  • Installer name is now orca-windows-setup-arm64.exe. Shipped x64 clients pick bootstrap installers with /windows-setup\.exe$/, so the arm64 name must not match it.
  • Update channel: arm64 builds publish under latest-arm64 (latest-arm64.yml), and native arm64 clients pass channel: 'latest-arm64' to every setFeedURL call. electron-updater reads latest.yml on every Windows arch, so without this an arm64 install would auto-update to the x64 installer. The release picker, prerelease probing and fallback matchers are arch-aware too. Dev channels (x64-only builds) show as unsupported on Windows ARM64. Every change is gated on win32 && arm64; x64, including x64 under ARM emulation, is unchanged.
  • Speech: reuses main's existing voice_model_not_ready:unavailable error and hasLocalSpeechRecognizer() gate (mobile already maps them), instead of adding a parallel error code. getSherpaModulePath() returns null on Windows ARM64.
  • Verified by building node config/scripts/build-windows-arm64.mjs on a GitHub windows-11-arm runner. The afterPack daemon-boot and node-pty checks ran natively. Output: orca-windows-setup-arm64.exe + latest-arm64.yml, and no latest.yml. Orca.exe, orca.exe, the agent hook, node-pty/ConPTY and rg are all native ARM64 (aa64); the only x64 executable used at runtime is agent-browser, which runs under emulation.
  • Release CI (release-cut.yml) is still out of scope and will be a follow-up.

ELI5

Orca now ships a native Windows ARM64 installer for Snapdragon and other ARM PCs. Those machines no longer need to run the whole app under x64 emulation.

@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from a561dd8 to afa3221 Compare July 16, 2026 15:01
@jinhyunchun
jinhyunchun marked this pull request as ready for review July 16, 2026 15:29
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 2331cd25718f903ba799bc5bc60a17294e3bcce5
  • Latest commit, not reviewed: 02b0ed3

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The pull request adds Windows ARM64 packaging support, including architecture-specific resources, installer naming, browser binary fallback, native node-pty staging, and runtime module pruning. Speech model discovery, selection, downloading, and execution now account for unsupported local recognition on Windows ARM64. A shared error code and localized renderer toast guide users toward supported transcription settings. Tests cover architecture normalization, packaging, native staging, speech gating, and error presentation.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed The PR implements native Windows ARM64 packaging, matching the objectives in linked issue #8607.
Out of Scope Changes check Passed No clearly unrelated changes stand out; the speech, browser, and packaging work all supports the ARM64 goal.
Title check Passed The title "feat(windows): add native Windows ARM64 package support" matches the main change in the changeset. The PR adds a native Windows ARM64 installer build path (build:win:arm64), ARM64 node-pty …
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #8607), Visual Proof (two screenshots), Testing with platform details (Windows 11 ARM64), A…
Full details: Title check

Explanation

The title "feat(windows): add native Windows ARM64 package support" matches the main change in the changeset. The PR adds a native Windows ARM64 installer build path (build:win:arm64), ARM64 node-pty staging, arch-aware packaging and artifact naming, and speech gating for Windows ARM64. The title is concise, specific, and follows a conventional commit style.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #8607), Visual Proof (two screenshots), Testing with platform details (Windows 11 ARM64), AI Disclosure header, Review, Notes, and a Checklist. The 'What Changed' and 'Why' sections are covered by the Summary and per-component bullets, which explain the mechanism and alternatives such as using the x64 agent-browser under emulation and the prebuild instead of a source rebuild. The 'Agent skill upstream boundary' checkbox is unchecked and the 'AI Disclosure' section is empty, which are minor gaps. The 'Visual Proof' section has before/after images for the UI change but does not clearly label them as before and after. The 'Maintainer update' section is an addition beyond the template and some items in the 'Testing' checklist are checked without the manual-testing box being checked.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/windows-package-architecture.cjs (1)

23-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use path.join for file paths.

As per coding guidelines, "Use path.join or Electron/Node path utilities for file paths; never assume / or \." Although Electron Builder can often resolve POSIX paths internally, adhering to the guideline ensures cross-platform consistency.

♻️ Proposed refactor
+const { join } = require('path')
+
 function createWindowsArchitectureResources(env = process.env) {
   const resources = []
   if (!isWindowsArm64Build(env)) {
     resources.push({
-      from: 'node_modules/sherpa-onnx-win-x64',
-      to: 'node_modules/sherpa-onnx-win-x64'
+      from: join('node_modules', 'sherpa-onnx-win-x64'),
+      to: join('node_modules', 'sherpa-onnx-win-x64')
     })
   }
 
   // Why: keep this filename aligned with getAgentBrowserBinaryName; upstream
   // uses its x64 executable under Windows on ARM emulation.
   resources.push({
-    from: 'node_modules/agent-browser/bin/agent-browser-win32-x64.exe',
+    from: join('node_modules', 'agent-browser', 'bin', 'agent-browser-win32-x64.exe'),
     to: 'agent-browser-win32-x64.exe'
   })
   return resources

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 10ba0802-a47b-41a2-bbfe-c0ea8b45d4c7

📥 Commits

Reviewing files that changed from the base of the PR and between ef23b67 and afa3221fb2394cbd594ccfc33a14efbaf2a3a223.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • config/electron-builder.config.cjs
  • config/packaged-runtime-node-modules.cjs
  • config/scripts/build-native-for-platform.mjs
  • config/scripts/build-windows-arm64.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/electron-builder-native-rebuild.cjs
  • config/scripts/electron-builder-native-rebuild.test.mjs
  • config/scripts/stage-windows-node-pty-prebuild.mjs
  • config/scripts/synchronous-child-process-result.mjs
  • config/scripts/windows-node-pty-prebuild.test.mjs
  • config/scripts/windows-package-architecture.test.mjs
  • config/windows-node-pty-prebuild.cjs
  • config/windows-package-architecture.cjs
  • package.json
  • src/main/browser/agent-browser-binary-name.test.ts
  • src/main/browser/agent-browser-binary-name.ts
  • src/main/browser/agent-browser-bridge.ts
  • src/main/ipc/speech.test.ts
  • src/main/ipc/speech.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/speech/model-manager-download-error.test.ts
  • src/main/speech/model-manager.test.ts
  • src/main/speech/model-manager.ts
  • src/main/speech/speech-platform-support.test.ts
  • src/main/speech/speech-platform-support.ts
  • src/main/speech/stt-service.test.ts
  • src/main/speech/stt-service.ts
  • src/main/windows-arm64.ts
  • src/renderer/src/components/dictation/dictation-start-error-toast.test.ts
  • src/renderer/src/components/dictation/dictation-start-error-toast.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/speech-types.ts

@jinhyunchun

Copy link
Copy Markdown
Contributor Author

@Jinwoo-H Hi, when you have a chance, could you please take a look at this PR?
Please let me know if you need any additional context. Thanks!

@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 823b0d8 to d289165 Compare July 20, 2026 11:35
@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:36
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from d289165 to 2331cd2 Compare July 23, 2026 16:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/windows-node-pty-prebuild.cjs (1)

44-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a friendlier error when the ARM64/x64 prebuild directory is missing.

If sourceDir (e.g. node_modules/node-pty/prebuilds/win32-arm64) doesn't exist, openSync inside readPortableExecutableMachine will throw a raw ENOENT, which doesn't hint at the fix (installing/rebuilding the arch-specific prebuild). A pre-check with a descriptive error would speed up CI/build debugging.

♻️ Optional improvement
   const nodePtyDir = resolve(projectDir, 'node_modules', 'node-pty')
   const sourceDir = join(nodePtyDir, 'prebuilds', `win32-${architecture}`)
   const releaseDir = join(nodePtyDir, 'build', 'Release')
+
+  if (!existsSync(sourceDir)) {
+    throw new Error(`Missing node-pty prebuild for win32-${architecture}: ${sourceDir}`)
+  }

(requires importing existsSync from node:fs)


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd31ff33-ae06-430f-86be-593dd1d5f42a

📥 Commits

Reviewing files that changed from the base of the PR and between d289165f53145a4f32b85ad2fdaed4406b4ccb09 and 2331cd25718f903ba799bc5bc60a17294e3bcce5.

📒 Files selected for processing (13)
  • config/electron-builder.config.cjs
  • config/packaged-runtime-node-modules.cjs
  • config/scripts/build-native-for-platform.mjs
  • config/scripts/build-windows-arm64.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/electron-builder-native-rebuild.cjs
  • config/scripts/electron-builder-native-rebuild.test.mjs
  • config/scripts/stage-windows-node-pty-prebuild.mjs
  • config/scripts/synchronous-child-process-result.mjs
  • config/scripts/windows-node-pty-prebuild.test.mjs
  • config/scripts/windows-package-architecture.test.mjs
  • config/windows-node-pty-prebuild.cjs
  • config/windows-package-architecture.cjs
🚧 Files skipped from review as they are similar to previous changes (11)
  • config/scripts/build-windows-arm64.mjs
  • config/scripts/windows-package-architecture.test.mjs
  • config/scripts/windows-node-pty-prebuild.test.mjs
  • config/scripts/stage-windows-node-pty-prebuild.mjs
  • config/windows-package-architecture.cjs
  • config/scripts/build-native-for-platform.mjs
  • config/scripts/electron-builder-native-rebuild.cjs
  • config/scripts/electron-builder-native-rebuild.test.mjs
  • config/electron-builder.config.cjs
  • config/scripts/electron-builder-config.test.mjs
  • config/packaged-runtime-node-modules.cjs

Comment on lines +1 to +11
export function forwardSynchronousChildFailure(result) {
if (result.signal) {
process.kill(process.pid, result.signal)
}
if (result.error) {
throw result.error
}
if (result.status !== 0) {
process.exit(result.status ?? 1)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repository files matching target/consumer names:"
git ls-files | rg '(^|/)synchronous-child-process-result\.mjs$|build-native-for-platform\.mjs|spawnSync|forwardSynchronousChildFailure' || true

echo
echo "Target file:"
if [ -f config/scripts/synchronous-child-process-result.mjs ]; then
  cat -n config/scripts/synchronous-child-process-result.mjs
fi

echo
echo "References to forwardSynchronousChildFailure:"
rg -n "forwardSynchronousChildFailure" . || true

echo
echo "Node availability and behavioral probe for signal/status/null/exit race:"
node - <<'JS'
const { spawnSync } = require('node:child_process');

console.log('node:', process.version);

// Probe 1: demonstrate Node allows code after process.kill for the same process/same turn
let sawTimeout = false;
process.kill(process.pid, 'SIGUSR1');
setTimeout(() => { sawTimeout = true; }, 0);
process.nextTick(() => { console.log('nextTick sawTimeout after kill:', sawTimeout); });
setTimeout(() => { console.log('timeout sawTimeout:', sawTimeout); }, 0).unref();

// Probe 2: spawnSync behavior for termination by signal
const result = spawnSync('node', ['-e', 'process.kill(process.pid, "SIGINT")', '--unhandled-rejections=strict'], { encoding: 'utf8' });
console.log('spawnSync result keys:', Object.keys(result).sort());
console.log('result.signal:', result.signal);
console.log('result.status:', result.status);
console.log('result.status !== 0:', result.status !== 0);
console.log('result.status ?? 1:', result.status != null ? result.status : 1);

setTimeout(() => process.exit(0), 0).unref();
JS

Repository: stablyai/orca

Length of output: 1787


Return after forwarding the signal.

When result.signal is set, spawnSync also sets status to null, so result.status !== 0 falls through and calls process.exit(1) immediately after process.kill(). Node schedules the forwarded signal delivery asynchronously, so the synchronous exit can override the intended signal semantics.

🐛 Proposed fix
 export function forwardSynchronousChildFailure(result) {
   if (result.signal) {
     process.kill(process.pid, result.signal)
+    return
   }
   if (result.error) {
     throw result.error
   }
   if (result.status !== 0) {
     process.exit(result.status ?? 1)
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function forwardSynchronousChildFailure(result) {
if (result.signal) {
process.kill(process.pid, result.signal)
}
if (result.error) {
throw result.error
}
if (result.status !== 0) {
process.exit(result.status ?? 1)
}
}
export function forwardSynchronousChildFailure(result) {
if (result.signal) {
process.kill(process.pid, result.signal)
return
}
if (result.error) {
throw result.error
}
if (result.status !== 0) {
process.exit(result.status ?? 1)
}
}

@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 2331cd2 to 836a075 Compare July 24, 2026 13:10
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 836a075 to 05adf28 Compare July 29, 2026 09:43
Comment on lines +1 to +11
export function forwardSynchronousChildFailure(result) {
if (result.signal) {
process.kill(process.pid, result.signal)
}
if (result.error) {
throw result.error
}
if (result.status !== 0) {
process.exit(result.status ?? 1)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Spawn-failure propagation changed from process.exit to throw

Previously both callers (runPnpmScript, runNodeScript) called process.exit(result.status ?? 1) when result.error was set (e.g. the child binary was not found). The new helper instead throws result.error, so those scripts now crash with an uncaught-exception stack trace rather than a clean non-zero exit. That is unlikely to break CI but can make build-failure diagnostics noisier. The original code checked result.status !== 0 || result.error in a single branch; the rewrite separates them, which is cleaner, but the observable difference is worth knowing about.

Comment thread src/main/ipc/speech.ts Resolved
@greptile-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds a native Windows ARM64 package target (pnpm build:win:arm64) to Orca. It handles three native dependencies: node-pty (staged via verified arm64 prebuilds with PE-header checking), sherpa-onnx (gated off entirely with a stable error code and a localized remediation toast), and agent-browser (falls back to the x64 binary under Windows ARM emulation). The existing x64 build path is unchanged.

  • A new stageWindowsNodePtyPrebuild helper verifies every file's PE machine type (0xaa64) before staging and fails the build loudly on any mismatch, eliminating the need for an ARM64 MSVC toolchain.
  • ORCA_WINDOWS_ARM64_BUILD env-flag is validated by validateWindowsPackageArchitecture at the electron-builder hook call site, so a mislabeled or arch-mismatched package cannot be produced silently.
  • A new speech-platform-support module centralises all ARM64 speech-gating logic: catalog filtering, settings reconciliation at startup, and a single voice_local_dictation_unavailable error code wired to a localized toast with an "Open Settings" action; cloud transcription (OpenAI) continues to work normally.

Confidence Score: 5/5

  • This PR is safe to merge. The x64 Windows, macOS, and Linux build paths are completely unchanged, and the ARM64 path is gated behind an explicit env flag that is validated at the electron-builder hook call site.
  • The implementation is disciplined throughout: PE-header verification fails the build loudly rather than silently shipping a wrong-arch binary; the env-flag/target-arch mismatch guard prevents mislabeled packages; all three native-dependency strategies (staged prebuild, gated-off with stable error code, emulated fallback) are cross-referenced between the runtime resolver and the packager. The new speech-platform-support module is consistently applied across every code path that could reach local speech (IPC handler, model manager, runtime catalog, stt-session-start, mobile dictation controller). Test coverage is strong: PE verification, arch-resource correctness, the agent-browser cross-pin, catalog filtering, settings reconciliation, and the remediation toast are all exercised.
  • No files require special attention.

Important Files Changed

Filename Overview
config/windows-node-pty-prebuild.cjs New module: reads PE machine type from every node-pty Windows binary and copies the target-arch prebuild into build/Release. Verification-before-copy ordering is correct; file descriptors are closed in finally blocks. The hardcoded file list will fail loudly if node-pty's prebuild layout changes, which is the intended safety behaviour.
config/windows-package-architecture.cjs New module: env-flag helpers for ORCA_WINDOWS_ARM64_BUILD. createWindowsArchitectureResources correctly omits sherpa-onnx-win-x64 for ARM64 while always including the x64 agent-browser binary (used under emulation). getWindowsInstallerArtifactName gates artifact naming. validateWindowsPackageArchitecture provides a loud guard against flag/arch mismatch.
src/main/speech/speech-platform-support.ts New module: centralises all ARM64 speech-gating logic. supportsLocalSpeechRecognition, getSupportedSpeechModels, getSupportedSpeechModelSelection, and assertLocalSpeechRecognitionSupported are all cleanly injectable for testing. The stable LOCAL_SPEECH_UNAVAILABLE_ERROR_CODE constant is the single point of truth for the error code.
src/main/ipc/speech.ts reconcileUnsupportedSpeechSettings now runs at startup and clears any persisted sttModel absent from the filtered catalog (deliberate behaviour change, documented in PR notes). speech:getCatalog now returns filtered models. All cloud models are preserved; local models are cleared on ARM64. The IPC handler for getModelStates uses process defaults, consistent with the rest of the runtime path.
config/scripts/electron-builder-native-rebuild.cjs Updated to call validateWindowsPackageArchitecture before any work, then branches on shouldStageWindowsNodePtyPrebuild(win32, arm64) to run the prebuild stage script instead of a native rebuild. x64 Windows path is unchanged. The early-return after staging (return false) is correct — it skips the regular rebuild loop.
src/main/browser/agent-browser-binary-name.ts New module: getAgentBrowserBinaryName falls back to win32-x64 on ARM64 (emulation), consistent with the packaged resource name in windows-package-architecture.cjs. The cross-pinning is validated by a dedicated test in windows-package-architecture.test.mjs.
src/main/speech/model-manager.ts getModelStates and downloadModel now accept optional platform/arch parameters (defaulting to process values) for testability. assertLocalSpeechRecognitionSupported is called early in downloadModel before the actual download starts, ensuring ARM64 can't begin a local model download.
src/renderer/src/components/dictation/dictation-start-error-toast.ts Adds a new branch for LOCAL_SPEECH_UNAVAILABLE_ERROR_CODE that shows a localized remediation toast with an "Open Settings" action pointing to the voice settings pane. All 5 locale files are updated.
config/scripts/build-windows-arm64.mjs New script: guards against non-Windows hosts, then invokes electron-builder with --win --arm64 and ORCA_WINDOWS_ARM64_BUILD=1 injected into the child process env. Uses forwardSynchronousChildFailure for clean exit propagation.
src/main/runtime/runtime-mobile-speech-catalog.ts Catalog list, download, and configure all correctly funnel through the new speech-platform-support guards. getSupportedSpeechModels and getSupportedSpeechModelSelection are consistently used for both the model list and selectedModelId, so the response is coherent on ARM64.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Script as build-windows-arm64.mjs
    participant EB as electron-builder
    participant Hook as electron-builder-native-rebuild.cjs
    participant Validate as validateWindowsPackageArchitecture
    participant Stage as stage-windows-node-pty-prebuild.mjs
    participant Pkg as windows-package-architecture.cjs
    participant App as App Runtime (ARM64)

    Dev->>Script: pnpm build:win:arm64
    Script->>Script: "assert process.platform === 'win32'"
    Script->>EB: "electron-builder --win --arm64<br/>(ORCA_WINDOWS_ARM64_BUILD=1)"
    EB->>Hook: "afterPack hook (platform=win32, arch=arm64)"
    Hook->>Validate: validateWindowsPackageArchitecture('win32','arm64', env)
    Validate-->>Hook: OK (env flag matches target arch)
    Hook->>Hook: build-windows-cli-launcher.mjs
    Hook->>Stage: "stage-windows-node-pty-prebuild.mjs --arch=arm64"
    Stage->>Stage: "PE-verify all prebuilds/win32-arm64/* files (machine=0xaa64)"
    Stage->>Stage: rmSync build/Release then copy ARM64 files
    Stage-->>Hook: staged
    Hook-->>EB: return false (rebuild handled externally)
    Pkg->>EB: "createWindowsArchitectureResources()<br/>(omit sherpa-onnx, include agent-browser-win32-x64.exe)"
    Pkg->>EB: "artifactName = orca-windows-arm64-setup.exe"
    EB-->>Dev: orca-windows-arm64-setup.exe

    Note over App: At runtime on ARM64
    App->>App: "reconcileUnsupportedSpeechSettings()<br/>clears local-model sttModel from settings"
    App->>App: "getCatalog → getSupportedSpeechModels()<br/>(filters out local models)"
    App->>App: "startDictation(localModel) → assertLocalSpeechRecognitionSupported()<br/>throws voice_local_dictation_unavailable"
    App->>App: "showDictationStartErrorToast()<br/>→ localized toast with "Open Settings""
Loading

Reviews (4): Last reviewed commit: "feat(windows): add native Windows ARM64 ..." | Re-trigger Greptile

@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 05adf28 to 606efdc Compare August 1, 2026 06:07
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 606efdc to e787f57 Compare August 4, 2026 02:46
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch 4 times, most recently from 6886da9 to d6c96ee Compare September 4, 2026 02:10
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from d6c96ee to 369f325 Compare October 4, 2026 03:21
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 369f325 to 4a8f7cb Compare October 13, 2026 18:11
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch from 4a8f7cb to 85ab98a Compare October 20, 2026 15:52
@nwparker
nwparker force-pushed the feat/windows-arm64-native-package branch from 85ab98a to ae4921b Compare October 27, 2026 11:03
@janvanhuffel

Copy link
Copy Markdown

Tested this branch (ae4921b) end to end on a Windows 11 ARM64 laptop: native build, install, and hands-on use. It works. One blocker turned up along the way, plus an offer for the release-CI follow-up.

Bug: the ARM64 installer silently drops every arm64 exe/dll

The package builds fine and the afterPack checks pass. But after a /S install, %LOCALAPPDATA%\Programs\orca has no Orca.exe and none of the other 22 arm64 PE files: the Electron DLLs, resources\bin\orca.exe, orca-agent-hook.exe, ConPTY and rg.exe. The installer still exits 0. The x64/x86 executables and every .node addon do get installed.

Cause: app-builder-lib 26.15.3 packs the payload with 7-Zip 24.09, which automatically applies its ARM64 branch filter to arm64 PE files (7za l shows Method = ARM64 LZMA2 BCJ2). The nsis7z plugin in NSIS 3.0.4.1 can't decode that filter, so it skips those entries without reporting an error. The windows-11-arm CI check built the package but never installed it, which is why this slipped through.

Fix: force ELECTRON_BUILDER_7Z_FILTER=BCJ2 for ARM64 Windows packages from the builder config. That covers local builds, CI packaging and the --prepackaged signed rebuild. x64 packaging is unchanged. After the fix, the payload method is BCJ2, all 6688 files install, and every Orca process runs native (IsWow64Process2 → aa64, not emulated).

Commit: janvanhuffel@596681ab365

Release CI follow-up (offered, untested)

janvanhuffel@1fcda9fd7d4 adds a windows-11-arm / win-arm64 leg to release-cut.yml:

  • It runs the same two-stage SignPath signing, evidence gate and upload as x64, producing orca-windows-setup-arm64.exe and latest-arm64.yml.
  • Paths, installer and manifest names, artifact names and Slack labels come from matrix fields. The x64 values equal the old literals, so the x64 leg behaves the same.
  • verify-release-required-assets.mjs now requires the ARM64 assets, which makes Windows ARM64 release-blocking, the same as Linux arm64.

I couldn't run it, since it needs your SignPath secrets. Things only you can check:

  • Whether the github-actions-windows-installer and windows-inner-binaries-zip SignPath artifact configurations accept the arm64 file names.
  • Whether you're OK with two extra SignPath approvals per release.
  • windows-signing-rehearsal.yml and the dev-channel Windows workflows are untouched.

Both commits sit directly on top of ae4921b, so you can cherry-pick either one on its own.

Setup notes in case anyone else builds this natively on Windows ARM:

  • Node 24: winget's "LTS" package is now Node 26.
  • VS 2022 Build Tools with VC.Tools.ARM64.
  • rustup stable-aarch64-pc-windows-msvc.
  • A separate pnpm install --frozen-lockfile in mobile/.

cc @nwparker

@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch 2 times, most recently from f33afb8 to f53429b Compare November 10, 2026 02:08
@jinhyunchun
jinhyunchun force-pushed the feat/windows-arm64-native-package branch 2 times, most recently from b6dac40 to b69b20d Compare November 17, 2026 05:18
jinhyunchun and others added 3 commits November 20, 2026 14:23
…l speech gate

- Name the ARM64 installer orca-windows-setup-arm64.exe so shipped x64 pickers (/windows-setup\.exe$/) never match it
- Publish ARM64 under the latest-arm64 channel; native ARM64 clients read latest-arm64.yml so they never update to x64
- Gate dev channels off on Windows ARM64 (dev workflows build x64 only)
- Reuse main's voice_model_not_ready:unavailable error and hasLocalSpeechRecognizer() instead of a parallel error code
@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #52193, which rebased these commits onto current main, folded in the NSIS ELECTRON_BUILDER_7Z_FILTER=BCJ2 fix, and wired the windows-11-arm release CI leg. Thanks @jinhyunchun and @janvanhuffel!

@nwparker nwparker closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Windows on ARM native build

5 participants