Skip to content

Upgrade to Electron 45 and adapt clipboard, preload, and packaging APIs - #32176

Open
nwparker wants to merge 1 commit into
mainfrom
nwparker/electron-45
Open

nwparker wants to merge 1 commit into
mainfrom
nwparker/electron-45

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​361 $\color{#cf222e}{\Huge{\mathbf{−}}}$​207 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​154
Prod 28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​358 $\color{#cf222e}{\Huge{\mathbf{−}}}$​159 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199

ELI5

Upgrade Orca's desktop engine from Electron 43.7.8 to 45.0.0, adapting clipboard and dictation code so existing workflows keep working. macOS now requires Ventura (13) or newer.

What Changed

  • Pin Electron 45.0.0 and update its managed-Node association; the standalone Node runtime remains 24.22.1.
  • Migrate removed clipboard APIs to asynchronous ClipboardItem/Blob operations, including Linux selection, images, copied-file lists, and write verification. Preserve sender checks, bounded reads, image limits, platform fallbacks, and remote attachment routing.
  • Replace the removed sandboxed-preload Buffer global with a byte view for dictation audio.
  • Enable isolated browser-guest zoom while retaining Orca's site/profile persistence and propagation.
  • Reject automatic client-certificate selection for background network requests, retain the Windows WER helper under the packaged executable name, and capture child-process OS error codes.
  • Set the macOS packaging minimum to 13.0 and document the complete Electron 44/45 feature, breaking-change, and deprecation review.

Why

Electron 44 removed synchronous/raw clipboard helpers; Electron 45 removed Node globals from sandboxed preloads. A dependency-only bump would break copy/paste and dictation. The review also evaluates new features against Orca's existing ownership, security, and cross-platform constraints.

Synchronous safeStorage still works in 45 but is removed in 46. Its shared secret-store contract needs a separate migration covering old ciphertext, temporary keychain unavailability, headless hosts, concurrent persistence, and mixed client/server versions. The reference review records that requirement; do not upgrade to 46 first. Experimental Prompt API, static protocol sources, passkeys, and spare renderers remain separate decisions.

Linked Issue

Maintainer-requested upgrade; no existing issue supplied.

Visual Proof

N/A — no intended appearance or interaction redesign. The upgrade preserves existing clipboard, browser, terminal, and dictation workflows. A hidden-renderer startup screenshot was inspected locally, and browser/terminal behavior is exercised by Electron tests.

Testing

Local platform: macOS arm64. All app/test launches use ORCA_BACKGROUND_LAUNCH=1, hidden renderers, and isolated profiles. No microphone recording or developer clipboard writes in the executed tests.

  • pnpm tc: all four projects pass.
  • Focused unit suites: 288 passed, 1 skipped, covering clipboard limits/parsers/async verification, remote attachments, recovery dialogs, browser display, crash diagnostics, runtime pins, and safe storage.
  • Additional async-copy regression suite: 17 passed, including stalled verification, failure recovery, and a queued ordinary copy.
  • Packaging suites: 44 passed, 1 skipped, including WER filesystem packaging and Electron runtime contracts.
  • Changed-code quality: zero new findings across all six scans plus casting rationale checks; formatting and git diff --check pass.
  • E2E type-error ratchet: passes against the existing 222-error baseline. The broad E2E typecheck is not clean on the existing optional cloud/mobile dependency baseline.
  • Electron Vite build in E2E mode passes; installed native modules load with Electron 45.
  • Hidden Electron tests cover browser zoom/reload/reset and link/popups, fresh-profile startup, clipboard JPEG recovery/PNG previews, sandboxed dictation byte transport, the background-certificate guard, and terminal file links/external edits.
  • Final combined E2E run: 12 passed; external-edit refresh timed out once at its 20-second assertion. Both terminal golden tests passed on isolated rerun (and had passed in the earlier run). The intermittent refresh timeout remains a validation limitation.

Windows/Linux native behavior and signed packaged/ASAR builds remain for their platform CI lanes; local macOS source tests do not establish WER loading, Explorer paste, Wayland/X11, GPU, native prompts, or updater compatibility.

  • Automated local behavior validation completed
  • Automated tests added/updated

Review

Self-reviewed sender authorization before asynchronous access, allocation/dimension limits, URI/path handling, write serialization and failures, certificate authority, WER naming, and compatibility of unchanged IPC contracts with remote/mobile clients and folder workspaces.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied or translated.

Checklist

  • Focused on one Electron runtime upgrade and its required adaptations
  • Explained what changed and why
  • Visual proof applicability explained
  • Self-reviewed correctness, security, and performance
  • Considered cross-platform, SSH/remote, mobile, and folder workspace impact
  • Local typecheck, focused tests, changed-line lint/format checks, and desktop build pass; platform packaging remains for CI

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The pull request upgrades Electron from 43.7.8 to 45.0.0 and updates desktop platform requirements and Windows packaging. It adds runtime adaptations for browser zoom, certificate selection, audio transport, and child-process reporting. Clipboard reads and writes now support asynchronous Electron APIs, image formats, and URI-list file paths. Clipboard text writes use a pending-write queue and await verification. Tests cover the updated runtime, packaging, and clipboard paths.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to eccc4

Rapid terminal clipboard updates can lose the latest value. Correct the migration guidance and image-write tests as well; the remaining risk is bounded but warrants attention before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 38 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the Electron 45 upgrade and the required API adaptations, which are the main changes in the pull request.
Description check Passed The description covers the required sections, explains the user-facing changes and rationale, documents testing and known limitations, and addresses cross-platform and compatibility considerations. Th…
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.
Full details: Description check

Explanation

The description covers the required sections, explains the user-facing changes and rationale, documents testing and known limitations, and addresses cross-platform and compatibility considerations. The missing issue link is acceptable because the author identifies this as a maintainer-requested upgrade.

Full details: Docstring Coverage

Explanation

Docstring coverage is 22.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 38 files. (6 skipped: 6 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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

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

@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: 3


ℹ️ 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: 5766c092-5c3c-4f6e-a7ed-44678757fafc
📥 Commits

Reviewing files that changed from the base of the PR and between 52e413e and eccc409.

⛔ Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing: 44
  • .gitignore
  • README.md
  • config/electron-builder.config.cjs
  • config/scripts/package-windows-wer-helper.cjs
  • config/scripts/package-windows-wer-helper.test.mjs
  • docs/reference/electron-45-upgrade.md
  • docs/reference/macos-daemon-tcc-attribution.md
  • package.json
  • pnpm-workspace.yaml
  • src/main/browser/browser-site-display-controller.test.ts
  • src/main/browser/browser-site-display-controller.ts
  • src/main/ipc/crash-reporting.ts
  • src/main/ipc/speech.ts
  • src/main/persistence/profile-state/profile-state-startup-recovery-dialog.ts
  • src/main/startup/main-process-ready-foundation.ts
  • src/main/startup/main-process-ready-runtime.ts
  • src/main/window/clipboard-agent-session-attachment-paste.test.ts
  • src/main/window/clipboard-copied-file-paths.test.ts
  • src/main/window/clipboard-copied-file-paths.ts
  • src/main/window/clipboard-dashboard-popout-access.test.ts
  • src/main/window/clipboard-file-copy.ts
  • src/main/window/clipboard-file-urls.ts
  • src/main/window/clipboard-formats.ts
  • src/main/window/clipboard-image-source.test.ts
  • src/main/window/clipboard-image-source.ts
  • src/main/window/clipboard-ipc-handlers.test.ts
  • src/main/window/clipboard-ipc-handlers.ts
  • src/main/window/clipboard-macos-image-paste.test.ts
  • src/main/window/clipboard-native-image.ts
  • src/main/window/clipboard-platform-routing.test.ts
  • src/main/window/clipboard-runtime-owned-ssh-paste.test.ts
  • src/main/window/clipboard-text-publisher.test.ts
  • src/main/window/clipboard-text-publisher.ts
  • src/main/window/clipboard-text-write-verify.test.ts
  • src/main/window/clipboard-text-write-verify.ts
  • src/main/window/clipboard-windows-image-file.ts
  • src/main/window/renderer-recovery-prompt.test.ts
  • src/main/window/renderer-recovery-prompt.ts
  • src/preload/api/speech-bridge.ts
  • src/shared/node-runtime-pin.ts
  • tests/e2e/clipboard-macos-image-paste.spec.ts
  • tests/e2e/electron-runtime-compatibility.spec.ts
  • tests/e2e/file-explorer-copy-file-windows.spec.ts
  • tests/e2e/paired-client-hosted-browser-markup.spec.ts

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


Synchronous `safeStorage.isEncryptionAvailable()`, `encryptString()`, and `decryptString()` still work in 45 but are **removed in 46**. They remain behind `guardedSafeStorage` and the synchronous `SecretStore` contract. Callers include persisted host credentials, plugin secrets, and cloud profile sessions.

Migrate the shared secret-store interface and all callers together to `isAsyncEncryptionAvailable()`, `encryptStringAsync()`, and `decryptStringAsync()`. The latter returns `{ result, shouldReEncrypt, isTemporarilyUnavailable }`, not a string. Required checks for that follow-up:

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Correct the decryptStringAsync() return contract.

Electron 45 resolves with { result, shouldReEncrypt }. Temporary unavailability rejects the promise; it does not return isTemporarilyUnavailable. If the planned credential migration follows this description, it could miss the rejection path. Document that path separately so callers preserve saved credentials and handle retries. (github.com)

Comment on lines +118 to +125
vi.mock('./clipboard-formats', () => ({
clipboardFormatReader: {
availableFormats: clipboardAvailableFormatsMock,
readBuffer: clipboardReadBufferMock,
has: () => false
},
writeClipboardBuffer: clipboardWriteBufferMock
}))

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,145p' src/main/window/clipboard-ipc-handlers.test.ts
rg -n 'writeImage|WriteImage|writeClipboardPng|clipboardWriteImageMock|clipboardWritePngMock' src/main/window/clipboard-ipc-handlers.test.ts src/main/window/clipboard-ipc-handlers.ts
sed -n '245,285p' src/main/window/clipboard-ipc-handlers.ts

Repository: stablyai/orca

Length of output: 7682


Retarget the untrusted and oversized writeImage tests to writeClipboardPng.

clipboard:writeImage now writes through writeClipboardPng from ./clipboard-formats, not clipboard.writeImage. The not.toHaveBeenCalled() assertions on clipboardWriteImageMock at lines 297, 710, and 725 cannot fail, so they do not detect an image write. The clipboard-formats mock also omits writeClipboardPng. Any future test that reaches the write call will fail with a Vitest missing-export error.

Proposed mock and hoisted-variable changes
 const {
   removeHandlerMock,
   ...
   clipboardWriteImageMock,
   clipboardWriteBufferMock,
+  clipboardWritePngMock,
   nativeImageCreateFromBufferMock,
   ...
 } = vi.hoisted(() => ({
   ...
   clipboardWriteImageMock: vi.fn(),
   clipboardWriteBufferMock: vi.fn(),
+  clipboardWritePngMock: vi.fn(),
   nativeImageCreateFromBufferMock: vi.fn(),
   ...
 }))
 vi.mock('./clipboard-formats', () => ({
   clipboardFormatReader: {
     availableFormats: clipboardAvailableFormatsMock,
     readBuffer: clipboardReadBufferMock,
     has: () => false
   },
-  writeClipboardBuffer: clipboardWriteBufferMock
+  writeClipboardBuffer: clipboardWriteBufferMock,
+  writeClipboardPng: clipboardWritePngMock
 }))

Then make these test-level changes:

  • Reset clipboardWritePngMock in the same beforeEach block that resets clipboardWriteImageMock (line 222).
  • In the untrusted-sender test (line 297) and both oversized-image tests (lines 710 and 725), assert against clipboardWritePngMock instead of clipboardWriteImageMock.
  • Add await before the clipboard:writeImage handler calls at lines 707 and 722, because the handler is async.

Comment on lines +55 to +58
if (!deps.isWayland()) {
await deps.write(safeText, kind)
return
}

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 | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Find renderer/main callers that can issue many clipboard text writes quickly.
rg -nP --type=ts -C3 "writeClipboardText|clipboard:writeTerminalText|clipboard:writeText|copyOnSelect|copy-on-select" src -g '!**/*.test.ts'

Repository: stablyai/orca

Length of output: 45667


🏁 Script executed:

cat -n src/main/window/clipboard-text-publisher.ts
rg -n -F -e 'MAX_PENDING_CLIPBOARD_WRITES' -e 'Too many pending clipboard writes' -e 'pendingCodeUnits' -e 'code-unit' src/main || test "$?" -eq 1
rg -l -F -e 'MAX_PENDING_CLIPBOARD_WRITES' -e 'Too many pending clipboard writes' src || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 7915


🏁 Script executed:

rg -n -F -e 'publishClipboardText' -e 'writeCoalesced' src/main src/shared || test "$?" -eq 1
sed -n '88,140p' src/shared/osc52-clipboard.ts

Repository: stablyai/orca

Length of output: 3678


Non-Wayland clipboard writes now share the 32-write cap, and OSC 52 bursts can reach it.

Before this change, non-Wayland writes ran immediately. Now each accepted call counts against MAX_PENDING_CLIPBOARD_WRITES (32) until its write completes. Calls beyond that limit reject with Too many pending clipboard writes. When terminal OSC 52 clipboard writes are enabled, the OSC 52 handler can reach this limit. writeCoalesced starts one write per microtask flush and does not wait for the previous write to settle. If the PTY stream sends OSC 52 sequences faster than the IPC and clipboard writes complete, pending writes build up and some are rejected. A rejected write shows the failure toast and is dropped. If the last payload is dropped, the clipboard keeps an earlier value.

Other write callers found in the inspected source are single user actions, so the OSC 52 path is the main burst source.

Fix direction: limit writeCoalesced to one write in flight per handler. Keep pendingText while the previous writeClipboardText promise is unresolved. When that promise settles, flush the latest value.

brennanb2025 added a commit that referenced this pull request Nov 16, 2026
Ports #32176 onto current main and pins Electron 45.3.2. Moves every
clipboard caller to the async ClipboardItem API, including the saved-password
copy whose delayed clipboard wipe would otherwise never run.

Co-authored-by: Neil <[email protected]>
brennanb2025 added a commit that referenced this pull request Nov 20, 2026
Ports #32176 onto current main and pins Electron 45.3.2. Moves every
clipboard caller to the async ClipboardItem API, including the saved-password
copy whose delayed clipboard wipe would otherwise never run.

Co-authored-by: Neil <[email protected]>
brennanb2025 added a commit that referenced this pull request Nov 25, 2026
Ports #32176 onto current main and pins Electron 45.3.2. Moves every
clipboard caller to the async ClipboardItem API, including the saved-password
copy whose delayed clipboard wipe would otherwise never run.

Co-authored-by: Neil <[email protected]>
brennanb2025 added a commit that referenced this pull request Nov 25, 2026
Ports #32176 onto current main and pins Electron 45.3.2. Moves every
clipboard caller to the async ClipboardItem API, including the saved-password
copy whose delayed clipboard wipe would otherwise never run.

Co-authored-by: Neil <[email protected]>
brennanb2025 added a commit that referenced this pull request Nov 26, 2026
…Is (#43018)

* Upgrade to Electron 45 and adapt clipboard, preload, and packaging APIs

Ports #32176 onto current main and pins Electron 45.3.2. Moves every
clipboard caller to the async ClipboardItem API, including the saved-password
copy whose delayed clipboard wipe would otherwise never run.

Co-authored-by: Neil <[email protected]>

* fix(deps): update node-abi to 4.40.0 so native rebuilds recognize Electron 45

node-abi 4.33.0 predates Electron 45, so CI native rebuilds failed with
"Could not detect abi for version 45.3.2". 4.40.0 maps Electron 45 to ABI 150.

* fix(clipboard): await the clipboard read before wiping a copied secret

Electron 45's clipboard.readText() returns a Promise, so comparing it to the
copied secret was always false and the webhook key was never wiped.

* docs(electron): record the 45.3.3 pin and its Node 24.22.3 security release

* fix(electron-45): adapt to main's newer clipboard handlers, tests and startup layout

- Keep clipboard:writeImage synchronous like main so refusals still throw before decoding.
- Fall back to Explorer's FileNameW when a Windows URI list yields no paths.
- Point the clipboard handler tests at Orca's async clipboard modules.
- Move the background client-certificate guard into network-compatibility setup;
  main's ready-foundation file is at its line limit.
- Move the Electron runtime E2E spec beside the desktop fixtures.

* fix(browser): drop the embedded-browser prompt() shim that Electron 45 blocks

Electron 45 installs its throwing window.prompt natively in every frame, so
the about:blank iframe workaround now throws too. prompt() returns to
Electron's deliberate 'not supported' behavior; alert() and confirm() still
reach Orca's dialog.

* chore(deps): pin Electron 45.4.1 for upstream Chromium security backports

45.4.1 carries 83 upstream ANGLE/Chromium/Dawn/FFmpeg/PDFium/V8 security
cherry-picks over 45.3.3. Same Chromium 156.0.8078.100, Node 24.22.3 and ABI 150.
Verified against the GitHub release file-for-file and against npm's checksums.

* fix(clipboard): address review findings on the Electron 45 port

- Reject Windows device and pipe paths from text/uri-list, as the FileNameW path already does.
- A newer copied secret now supersedes a clipboard read already in flight.
- Docs: Electron 45 rejects decryptStringAsync when the key provider is temporarily
  unavailable; CVE-2026-123864 and CVE-2026-123872 are server-side.

---------

Co-authored-by: Neil <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant