Repository navigation
feat(windows): add native Windows ARM64 package support - #9026
jinhyunchun wants to merge 3 commits into
Conversation
a561dd8 to
afa3221
Compare
|
Important Review skippedWe 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 You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt 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
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Pre-merge checks:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/windows-package-architecture.cjs (1)
23-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
path.joinfor file paths.As per coding guidelines, "Use
path.joinor 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 resourcesSource: 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.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (36)
config/electron-builder.config.cjsconfig/packaged-runtime-node-modules.cjsconfig/scripts/build-native-for-platform.mjsconfig/scripts/build-windows-arm64.mjsconfig/scripts/electron-builder-config.test.mjsconfig/scripts/electron-builder-native-rebuild.cjsconfig/scripts/electron-builder-native-rebuild.test.mjsconfig/scripts/stage-windows-node-pty-prebuild.mjsconfig/scripts/synchronous-child-process-result.mjsconfig/scripts/windows-node-pty-prebuild.test.mjsconfig/scripts/windows-package-architecture.test.mjsconfig/windows-node-pty-prebuild.cjsconfig/windows-package-architecture.cjspackage.jsonsrc/main/browser/agent-browser-binary-name.test.tssrc/main/browser/agent-browser-binary-name.tssrc/main/browser/agent-browser-bridge.tssrc/main/ipc/speech.test.tssrc/main/ipc/speech.tssrc/main/runtime/orca-runtime.tssrc/main/speech/model-manager-download-error.test.tssrc/main/speech/model-manager.test.tssrc/main/speech/model-manager.tssrc/main/speech/speech-platform-support.test.tssrc/main/speech/speech-platform-support.tssrc/main/speech/stt-service.test.tssrc/main/speech/stt-service.tssrc/main/windows-arm64.tssrc/renderer/src/components/dictation/dictation-start-error-toast.test.tssrc/renderer/src/components/dictation/dictation-start-error-toast.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/speech-types.ts
|
@Jinwoo-H Hi, when you have a chance, could you please take a look at this PR? |
823b0d8 to
d289165
Compare
d289165 to
2331cd2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
config/windows-node-pty-prebuild.cjs (1)
44-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider 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,openSyncinsidereadPortableExecutableMachinewill throw a rawENOENT, 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
existsSyncfromnode: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.cjsconfig/packaged-runtime-node-modules.cjsconfig/scripts/build-native-for-platform.mjsconfig/scripts/build-windows-arm64.mjsconfig/scripts/electron-builder-config.test.mjsconfig/scripts/electron-builder-native-rebuild.cjsconfig/scripts/electron-builder-native-rebuild.test.mjsconfig/scripts/stage-windows-node-pty-prebuild.mjsconfig/scripts/synchronous-child-process-result.mjsconfig/scripts/windows-node-pty-prebuild.test.mjsconfig/scripts/windows-package-architecture.test.mjsconfig/windows-node-pty-prebuild.cjsconfig/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
| 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) | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 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();
JSRepository: 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.
| 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) | |
| } | |
| } |
2331cd2 to
836a075
Compare
836a075 to
05adf28
Compare
| 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) | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
Greptile SummaryThis PR adds a native Windows ARM64 package target (
Confidence Score: 5/5
|
| 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""
Reviews (4): Last reviewed commit: "feat(windows): add native Windows ARM64 ..." | Re-trigger Greptile
05adf28 to
606efdc
Compare
606efdc to
e787f57
Compare
6886da9 to
d6c96ee
Compare
d6c96ee to
369f325
Compare
369f325 to
4a8f7cb
Compare
4a8f7cb to
85ab98a
Compare
85ab98a to
ae4921b
Compare
|
Tested this branch ( Bug: the ARM64 installer silently drops every arm64 exe/dllThe package builds fine and the afterPack checks pass. But after a 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 ( Fix: force Commit: janvanhuffel@596681ab365 Release CI follow-up (offered, untested)janvanhuffel@1fcda9fd7d4 adds a
I couldn't run it, since it needs your SignPath secrets. Things only you can check:
Both commits sit directly on top of Setup notes in case anyone else builds this natively on Windows ARM:
cc @nwparker |
f33afb8 to
f53429b
Compare
b6dac40 to
b69b20d
Compare
…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
b69b20d to
02b0ed3
Compare
|
Superseded by #52193, which rebased these commits onto current |
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:arm64produce a nativeorca-windows-setup-arm64.exewhile leaving the existing x64 build path byte-for-byte unchanged.How the port handles each native dependency:
win32-arm64prebuild intobuild/Releaseinstead 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.win32/arm64: the model catalog, model states, downloads, and dictation start all flow through onespeech-platform-supportmodule. 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 stablevoice_local_dictation_unavailableerror code mapped to a localized toast with an "Open Settings" action.ORCA_WINDOWS_ARM64_BUILD, andvalidateWindowsPackageArchitecturefails the build loudly if the env flag and electron-builder's target arch ever disagree (e.g. a bareelectron-builder --win --arm64invocation), so a mislabeled or x64-contaminated ARM64 package cannot be produced silently.Screenshots
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAll 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.ts701/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/tmppaths, symlinkEPERMwithout developer mode, Linux-only shims), so they are host-environment issues, not regressions. This PR actually improves the ARM64-host baseline: 20stt-service.test.tstests that fail onmainthere (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.downloadModelgained injectable platform/arch parameters consistent withgetModelStates.Notes
release-cut.ymlhas no Windows ARM64 matrix entry; this PR only adds the local build path. Wiring CI needs maintainer decisions: awindows-11-armmatrix entry, parametrizing the manydist/win-unpacked/orca-windows-setup.exehardcoded steps, a second SignPath approval flow, and — the real design question — an updater-manifest strategy, since both Windows jobs would clobberlatest.ymltoday. Suggest shipping ARM64 outside the auto-update channel first.sttModelthat no longer exists in the catalog is now cleared at startup on all platforms (previously it lingered and dictation failed opaquely).speech-platform-support.ts,agent-browser-binary-name.ts,windows-package-architecture.cjs).Issues
Fixes #8607
Maintainer update (rebased onto main)
main(it was 1,500+ commits behind and conflicting).orca-windows-setup-arm64.exe. Shipped x64 clients pick bootstrap installers with/windows-setup\.exe$/, so the arm64 name must not match it.latest-arm64(latest-arm64.yml), and native arm64 clients passchannel: 'latest-arm64'to everysetFeedURLcall. electron-updater readslatest.ymlon 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 onwin32 && arm64; x64, including x64 under ARM emulation, is unchanged.voice_model_not_ready:unavailableerror andhasLocalSpeechRecognizer()gate (mobile already maps them), instead of adding a parallel error code.getSherpaModulePath()returns null on Windows ARM64.node config/scripts/build-windows-arm64.mjson a GitHubwindows-11-armrunner. The afterPack daemon-boot and node-pty checks ran natively. Output:orca-windows-setup-arm64.exe+latest-arm64.yml, and nolatest.yml.Orca.exe,orca.exe, the agent hook, node-pty/ConPTY andrgare all native ARM64 (aa64); the only x64 executable used at runtime is agent-browser, which runs under emulation.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.