Skip to content

fix(dev): keep Node-only Quick Open path accumulator out of the renderer - #27372

Merged
Jinwoo-H merged 1 commit into
mainfrom
fix/dev-renderer-process-host-cjs
Oct 11, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
fix/dev-renderer-process-host-cjs

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 $\color{#cf222e}{\Huge{\mathbf{−}}}$​26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70 $\color{#cf222e}{\Huge{\mathbf{−}}}$​69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

When running Orca from source (pnpm dev), opening any workspace showed "The workspace workbench hit an error." and the right sidebar crashed too. A small file shared by the app's window and its background process pulled in background-only code, which the dev server can't load in the window. This moves that background-only code into its own file so the window never loads it.

What Changed

  • Before: in the dev server, activating a workspace showed error boxes in the workbench and right sidebar. The console showed LazyChunkLoadError, and importing TerminalPane.tsx directly failed with The requested module '.../process-host/dist/growing-byte-buffer.js' does not provide an export named 'GrowingByteBuffer'.
  • After: the workbench and right sidebar render normally (terminal opens, file list shows).
  • Mechanism: src/shared/quick-open-listing-limits.ts held two things: the result cap (QUICK_OPEN_LISTING_MAX_RESULTS, used by the renderer's Quick Open list) and QuickOpenSubprocessPathAccumulator, a Buffer-based class only the main process uses. Since Extract subprocess handling into @orca/process-host #26963 the class imports GrowingByteBuffer from @orca/process-host, whose dist is CommonJS. Vite dev serves workspace-linked packages to the renderer as raw ESM without CommonJS conversion, so the named import fails and every lazy chunk that reaches the limits file (terminal pane, right sidebar) fails to load. The accumulator now lives in src/shared/quick-open-subprocess-path-accumulator.ts, imported only by src/main/ipc/filesystem-search-file-paths.ts. The limits file has no imports anymore. Tests split the same way.
  • Production builds weren't broken, because Rollup converts the CommonJS module. But the production renderer bundle shipped the unused Buffer class in its quick-open-file-list chunk. After this change the renderer bundle has no GrowingByteBuffer code.

Why

The renderer should never load a class built on Node's Buffer. The fix removes that dependency where it starts, instead of making the dev server able to load it. Alternatives I considered:

  • Adding the process-host subpaths to renderer.optimizeDeps.include works, but it keeps Node-only code in the renderer graph and each new subpath that leaks in would need its own entry.
  • Resolving the renderer through the orca-source condition would load the TypeScript source, but Buffer still doesn't exist in the renderer. It only works today because the code is never run there.

src/shared/windows-breakaway-launcher.ts also imports from process-host, but the renderer can't reach it (it imports node:fs), so it is left as is.

Linked Issue

None. Maintainer fix.

Visual Proof

Same dev server, fresh throwaway profile, folder workspace activated through CDP.

Before (origin/main):
before.png

After (this branch):
after.png

Testing

  • Original repro on macOS: background dev launch (ORCA_BACKGROUND_LAUNCH=1, throwaway ORCA_DEV_USER_DATA_PATH), added a folder repo with window.api.repos.add, then fetchRepos and setActiveWorktree. On main: both error boxes, LazyChunkLoadError in the console, and the GrowingByteBuffer SyntaxError on a direct import('/src/components/terminal-pane/TerminalPane.tsx'). On this branch: the workbench renders, the import resolves, and there are no console errors.

  • Production electron-vite build: before, out/renderer/assets/quick-open-file-list-*.js contained the GrowingByteBuffer class. After, no renderer asset contains it.

  • pnpm test on the quick-open limits and accumulator tests, filesystem-search-file-paths, the renderer quick-open list tests, and the relay list-files limit test: all pass. pnpm tc, oxlint, oxfmt, check:code-quality:changed, check:process-host-imports, and check:max-lines-ratchet pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below (existing tests moved alongside the code they cover)

Review

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

Behavior doesn't change on any platform. The main process and relay still use the same limit and the same accumulator code. SSH and relay are unaffected: the relay imports only resolveQuickOpenResultLimit, which stays where it was.

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)
  • 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)

The renderer imports quick-open-listing-limits for the result cap, but the
same module also held a Buffer-backed accumulator that imports the CommonJS
@orca/process-host dist. Vite dev serves that dist as raw ESM, so the named
import failed and the workspace workbench and right sidebar crashed. Move the
accumulator to its own main-only module.
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2ef030b6-3f43-4ab5-b1f0-013ce23c2a1f

📥 Commits

Reviewing files that changed from the base of the PR and between 666d990 and 02d89af.


📒 Files selected for processing (5)
  • src/main/ipc/filesystem-search-file-paths.ts
  • src/shared/quick-open-listing-limits.test.ts
  • src/shared/quick-open-listing-limits.ts
  • src/shared/quick-open-subprocess-path-accumulator.test.ts
  • src/shared/quick-open-subprocess-path-accumulator.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.



📝 Walkthrough

Walkthrough

The path accumulator moves from quick-open-listing-limits.ts to quick-open-subprocess-path-accumulator.ts. The filesystem search import now uses the new module. Tests for path overflow and callback stopping are added there. The listing-limits module retains the result limit and no longer contains the accumulator implementation.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 02d89

The change isolates Node-only code from the renderer-imported limits module. No issue requiring a fix before merge is established; normal checks remain appropriate.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: keeping the Node-only Quick Open path accumulator out of the renderer to fix development loading failures.
Description check Passed The description is complete and follows the repository template. It explains the user impact, mechanism, rationale, testing, visual proof, maintainer issue exception, and checklist status.
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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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.

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