Skip to content

fix(renderer): stop a Node-only process-table module blanking the app at boot - #18814

Merged
nwparker merged 1 commit into
mainfrom
fix/e2e-workspace-session-ready
Sep 5, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/e2e-workspace-session-ready

Conversation

@nwparker

@nwparker nwparker commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​111 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​111
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

Severity: main currently boots to a blank white window on every launch

This is not an e2e-only problem. On current main the renderer throws before React mounts, so the app shows an empty window. Every Playwright spec that boots the app fails with workspaceSessionReady did not become true; a control PR of main plus one no-op line failed 14 SSH specs, all with that error. It also reproduces locally on plain origin/main.

Regressing commit

e1599c94b8b — perf(terminals): let idle panes share one process-table capture instead of forking their own (#18742).

Bisected by building the renderer at each candidate: 7856e5a677c (its parent) passes; e1599c94b8b onward fails. e95d247be1e (#18780) later added a second copy of the same landmine.

Root cause

agent-completion-poll-interval.ts value-imported one constant, PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS, from src/shared/process-table-snapshot-reader.ts — a node:child_process / node:fs/promises module. Its dependency process-table-snapshot.ts evaluates process.platform at module scope to choose ps columns. The renderer runs sandboxed with contextIsolation, where process is undefined, so evaluating that chunk threw ReferenceError: process is not defined and took the whole bundle down.

The import chain is 10 hops from main.tsx, which is why a pure-perf terminal change silently reached a Node-only module:

main.tsx → App.tsx → use-app-shell-services → useIpcEvents → app-lifetime-ipc-bridge
  → agent-hook-completion-notifications → agent-completion-coordinator
  → agent-completion-process-monitor → agent-completion-poll-scheduler
  → agent-completion-poll-interval → process-table-snapshot-reader

Evidence: with ORCA_STARTUP_DIAGNOSTICS=1, main reaches did-finish-load at t=1323ms then idles for 40s with zero renderer-* diagnostics. CDP Runtime.exceptionThrown pins it to the emitted PS_ARGS initializer.

Fix

  • src/shared/process-table-snapshot.ts:88 — constant moved to the environment-neutral half of the pair; process-table-snapshot-reader.ts:14 re-exports it, so every host caller is unchanged and the value (500) is identical.
  • src/renderer/src/components/terminal-pane/agent-completion-poll-interval.ts:3 — imports the neutral module; the renderer reaches no node: builtin.
  • src/shared/process-table-snapshot.ts:19 — both ps column sets read the platform through one typeof process-guarded HOST_IS_DARWIN, defusing the same trap for any future renderer import. Only hosts ever run the argv.

Ratchet test

src/renderer/src/renderer-node-builtin-boundary.test.ts walks the import graph (including lazy import() routes) from all three renderer entries and fails on any reachable module importing a node: builtin. The graph is 6,361 modules with zero other offenders — so this class of regression cannot land silently again.

Verification

Red-then-green on the real symptom, confirmed independently of the authoring run:

  • default-branch-visibility.spec.ts — passes in 14.2s with the fix; fails with the three source files reverted to main and the test kept.
  • The ratchet test fails on the pre-fix import (printing the full 10-hop chain) and passes after.
  • ssh-docker-transport-drop-recovery.spec.ts -g "keeps one reattachable lease" passes (39.4s) — this is the spec whose CI failures started this investigation.
  • 7,125 unit tests pass; pnpm tc, oxlint, oxfmt and the changed-code quality gate all clean.

… at boot

Every Electron E2E spec that boots the app has been failing on
`workspaceSessionReady did not become true`, and the app itself has been
launching to a blank white window: the renderer threw
`ReferenceError: process is not defined` while evaluating a shared chunk,
so React never mounted and no startup step ever ran.

`agent-completion-poll-interval.ts` (renderer) imported one constant,
`PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS`, out of
`shared/process-table-snapshot-reader.ts` — a `node:child_process` /
`node:fs/promises` module whose dependency evaluates `process.platform` at
module scope to pick `ps` columns. The renderer runs sandboxed with
contextIsolation, where `process` is undefined, so that module-scope read
threw and took the whole chunk with it. Introduced by #18742; #18780 added a
second module-scope read next to the first.

The constant now lives in `shared/process-table-snapshot.ts`, the
environment-neutral half of the pair, and the reader re-exports it so host
callers are unchanged. The two `ps` column sets read the platform behind a
`typeof process` guard, which defuses the same landmine for any future
renderer import of that module — only hosts ever run the argv.

The regression test walks the renderer import graph (lazy routes included)
from all three entries and refuses any module that reaches a `node:` builtin.
It fails on the pre-fix import with the full 10-hop chain from `main.tsx`.
@jondmarien

Copy link
Copy Markdown

ha - just encountered this as well. will close my pr 😝

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: a7c6cfb5-3ab0-485f-9e9d-8928412799a4

📥 Commits

Reviewing files that changed from the base of the PR and between 12e0520 and 579209e.

📒 Files selected for processing (4)
  • src/renderer/src/components/terminal-pane/agent-completion-poll-interval.ts
  • src/renderer/src/renderer-node-builtin-boundary.test.ts
  • src/shared/process-table-snapshot-reader.ts
  • src/shared/process-table-snapshot.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The shared process-table module now safely evaluates platform-specific arguments without requiring process. It exports the snapshot staleness limit, which the node reader re-exports and uses for its default TTL. The renderer polling module imports the constant from the renderer-safe module. A static test now walks renderer imports, detects reachable node: builtins, and verifies that the traversal includes more than 3,000 modules and the shared process-table module.

Merge Risk: ⚪ Minimal · up to 57920

This restores renderer startup by removing the Node-only import path while preserving the process-table staleness API and adding regression coverage for renderer-reachable Node builtins. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the regression, root cause, fix, regression test, and verification results. However, it does not follow the required template and omits the required Linked Issue, Visual Proof… Complete the required template sections. Add a linked issue after Fixes #, provide before/after visual proof or write N/A with a reason, complete the Testing checklist, address AI Disclosure, Review, Agent skill upstream boundary, Notes…
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: preventing a Node-only process-table module from blanking the renderer at startup.
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 explains the regression, root cause, fix, regression test, and verification results. However, it does not follow the required template and omits the required Linked Issue, Visual Proof or explicit N/A, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

Resolution

Complete the required template sections. Add a linked issue after Fixes #, provide before/after visual proof or write N/A with a reason, complete the Testing checklist, address AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist items, and retain the existing technical details under the appropriate headings.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Constant relocated to the renderer-safe module — PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS moves out of the node:child_process-importing reader into process-table-snapshot.ts; the reader re-exports it, so every host caller keeps the identical value (500).
  • Platform read guarded — PS_ARGS / CHEAP_PS_ARGS now take their darwin branch from a typeof process !== 'undefined'-guarded HOST_IS_DARWIN, defusing the module-scope process.platform evaluation that threw ReferenceError in the sandboxed renderer.
  • Renderer import pointed at the neutral module — agent-completion-poll-interval.ts imports the constant from process-table-snapshot instead of the reader.
  • Ratchet test — renderer-node-builtin-boundary.test.ts walks the full import graph (static and lazy import()) from all three renderer entries and fails on any reachable module importing a node: builtin, with a > 3_000-node and known-module guard so an empty walk cannot pass vacuously.

ℹ️ Ratchet detects node: imports, not bare process globals

The failure the ratchet catches (node:child_process) is one of the two landmines; the actual fatal evaluation was the bare process.platform read at module scope in process-table-snapshot.ts. The new typeof process !== 'undefined' guard defuses that instance, but that protection is hand-maintained rather than ratcheted — a future renderer-reachable module reading process.x at module scope would pass this test silently. Noting for awareness, not as a change request; regex-detecting bare process reads across ~6,361 modules would be noisy and isn't obviously worth the false-positive cost.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 0bbf86b into main Sep 5, 2026
29 checks passed
@nwparker

nwparker commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

ha - just encountered this as well. will close my pr 😝

Thanks for making the PR though!

@nwparker
nwparker deleted the fix/e2e-workspace-session-ready branch September 5, 2026 10:50
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Sep 5, 2026
… at boot (stablyai#18814)

Every Electron E2E spec that boots the app has been failing on
`workspaceSessionReady did not become true`, and the app itself has been
launching to a blank white window: the renderer threw
`ReferenceError: process is not defined` while evaluating a shared chunk,
so React never mounted and no startup step ever ran.

`agent-completion-poll-interval.ts` (renderer) imported one constant,
`PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS`, out of
`shared/process-table-snapshot-reader.ts` — a `node:child_process` /
`node:fs/promises` module whose dependency evaluates `process.platform` at
module scope to pick `ps` columns. The renderer runs sandboxed with
contextIsolation, where `process` is undefined, so that module-scope read
threw and took the whole chunk with it. Introduced by stablyai#18742; stablyai#18780 added a
second module-scope read next to the first.

The constant now lives in `shared/process-table-snapshot.ts`, the
environment-neutral half of the pair, and the reader re-exports it so host
callers are unchanged. The two `ps` column sets read the platform behind a
`typeof process` guard, which defuses the same landmine for any future
renderer import of that module — only hosts ever run the argv.

The regression test walks the renderer import graph (lazy routes included)
from all three entries and refuses any module that reaches a `node:` builtin.
It fails on the pre-fix import with the full 10-hop chain from `main.tsx`.

Mirror-Of: 0bbf86b
andremohrmann pushed a commit to andremohrmann/orca that referenced this pull request Sep 6, 2026
… at boot (stablyai#18814)

Every Electron E2E spec that boots the app has been failing on
`workspaceSessionReady did not become true`, and the app itself has been
launching to a blank white window: the renderer threw
`ReferenceError: process is not defined` while evaluating a shared chunk,
so React never mounted and no startup step ever ran.

`agent-completion-poll-interval.ts` (renderer) imported one constant,
`PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS`, out of
`shared/process-table-snapshot-reader.ts` — a `node:child_process` /
`node:fs/promises` module whose dependency evaluates `process.platform` at
module scope to pick `ps` columns. The renderer runs sandboxed with
contextIsolation, where `process` is undefined, so that module-scope read
threw and took the whole chunk with it. Introduced by stablyai#18742; stablyai#18780 added a
second module-scope read next to the first.

The constant now lives in `shared/process-table-snapshot.ts`, the
environment-neutral half of the pair, and the reader re-exports it so host
callers are unchanged. The two `ps` column sets read the platform behind a
`typeof process` guard, which defuses the same landmine for any future
renderer import of that module — only hosts ever run the argv.

The regression test walks the renderer import graph (lazy routes included)
from all three entries and refuses any module that reaches a `node:` builtin.
It fails on the pre-fix import with the full 10-hop chain from `main.tsx`.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… at boot (stablyai#18814)

Every Electron E2E spec that boots the app has been failing on
`workspaceSessionReady did not become true`, and the app itself has been
launching to a blank white window: the renderer threw
`ReferenceError: process is not defined` while evaluating a shared chunk,
so React never mounted and no startup step ever ran.

`agent-completion-poll-interval.ts` (renderer) imported one constant,
`PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS`, out of
`shared/process-table-snapshot-reader.ts` — a `node:child_process` /
`node:fs/promises` module whose dependency evaluates `process.platform` at
module scope to pick `ps` columns. The renderer runs sandboxed with
contextIsolation, where `process` is undefined, so that module-scope read
threw and took the whole chunk with it. Introduced by stablyai#18742; stablyai#18780 added a
second module-scope read next to the first.

The constant now lives in `shared/process-table-snapshot.ts`, the
environment-neutral half of the pair, and the reader re-exports it so host
callers are unchanged. The two `ps` column sets read the platform behind a
`typeof process` guard, which defuses the same landmine for any future
renderer import of that module — only hosts ever run the argv.

The regression test walks the renderer import graph (lazy routes included)
from all three entries and refuses any module that reaches a `node:` builtin.
It fails on the pre-fix import with the full 10-hop chain from `main.tsx`.
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.

2 participants