Repository navigation
fix(renderer): stop a Node-only process-table module blanking the app at boot - #18814
Conversation
… 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`.
|
ha - just encountered this as well. will close my pr 😝 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe shared process-table module now safely evaluates platform-specific arguments without requiring Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (3 passed)
Full details: Description checkExplanation 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
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Constant relocated to the renderer-safe module —
PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MSmoves out of thenode:child_process-importing reader intoprocess-table-snapshot.ts; the reader re-exports it, so every host caller keeps the identical value (500). - Platform read guarded —
PS_ARGS/CHEAP_PS_ARGSnow take theirdarwinbranch from atypeof process !== 'undefined'-guardedHOST_IS_DARWIN, defusing the module-scopeprocess.platformevaluation that threwReferenceErrorin the sandboxed renderer. - Renderer import pointed at the neutral module —
agent-completion-poll-interval.tsimports the constant fromprocess-table-snapshotinstead of the reader. - Ratchet test —
renderer-node-builtin-boundary.test.tswalks the full import graph (static and lazyimport()) from all three renderer entries and fails on any reachable module importing anode: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.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Thanks for making the PR though! |
… 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
… 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`.
… 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`.

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 plainorigin/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;e1599c94b8bonward fails.e95d247be1e(#18780) later added a second copy of the same landmine.Root cause
agent-completion-poll-interval.tsvalue-imported one constant,PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS, fromsrc/shared/process-table-snapshot-reader.ts— anode:child_process/node:fs/promisesmodule. Its dependencyprocess-table-snapshot.tsevaluatesprocess.platformat module scope to choosepscolumns. The renderer runs sandboxed with contextIsolation, whereprocessis undefined, so evaluating that chunk threwReferenceError: process is not definedand 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:Evidence: with
ORCA_STARTUP_DIAGNOSTICS=1, main reachesdid-finish-loadat t=1323ms then idles for 40s with zerorenderer-*diagnostics. CDPRuntime.exceptionThrownpins it to the emittedPS_ARGSinitializer.Fix
src/shared/process-table-snapshot.ts:88— constant moved to the environment-neutral half of the pair;process-table-snapshot-reader.ts:14re-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 nonode:builtin.src/shared/process-table-snapshot.ts:19— bothpscolumn sets read the platform through onetypeof process-guardedHOST_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.tswalks the import graph (including lazyimport()routes) from all three renderer entries and fails on any reachable module importing anode: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.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.pnpm tc, oxlint, oxfmt and the changed-code quality gate all clean.