Skip to content

perf(electron): optionally unload renderer on close (4/8) - #10328

Merged
diegosouzapw merged 4 commits into
diegosouzapw:release/v3.8.50from
backryun:perf/electron-unload-on-close
Aug 20, 2026
Merged

perf(electron): optionally unload renderer on close (4/8)#10328
diegosouzapw merged 4 commits into
diegosouzapw:release/v3.8.50from
backryun:perf/electron-unload-on-close

Conversation

@backryun

Copy link
Copy Markdown
Contributor

Summary

  • add a persisted tray policy for keeping the dashboard loaded or unloading its renderer on close
  • keep the embedded/remote proxy server, tray, and main-process update flow alive in unload mode
  • recreate the renderer from tray open, tray double-click, a second app launch, or macOS activation
  • restore only same-origin dashboard URLs and rely on Electron's persistent default session for auth state
  • keep keep-loaded as the default, preserving the existing fast-reopen behavior

Closes the Stage 4 implementation slice tracked by #10321.

Measured behavior

Measured on macOS arm64 with an isolated Electron profile and a lightweight remote dashboard fixture:

State Electron processes RSS
Renderer loaded 5 531.4 MiB
Renderer unloaded 4 436.5 MiB
  • observed reduction while closed: 94.9 MiB and one renderer process
  • renderer recreation: 74 ms in the persisted-policy validation run
  • restored URL: /dashboard/settings?stage4=1
  • restored session: the second request retained stage4_session=preserved

These numbers isolate shell/renderer overhead with a lightweight page; production dashboard totals will vary. The active app has no custom deep-link protocol (omniroute:// was previously removed because no handler existed), so there is no deep-link state to restore. External-link handling is unchanged. Auto-update listeners remain in the main process and renderer notifications safely no-op while the window is absent.

Validation

  • node --import tsx/esm --test tests/unit/electron*.test.ts tests/unit/build/electron-release-latest-yml.repro.test.ts — 134 passed
  • npm run test:vitest — 357 passed
  • npm run check:file-size — passed
  • node --check electron/main.js electron/lib/remoteServerPreferences.js electron/lib/windowClosePolicy.js — passed
  • pre-commit formatting, ESLint, docs sync, artifact, and type-budget gates — passed

Full-repository npm run lint remains blocked by pre-existing errors in @omniroute/opencode-plugin/src/index.ts and tests/unit/cli-env-inline-comment-10100.test.ts; neither file is changed here.

@backryun
backryun requested a review from diegosouzapw as a code owner August 14, 2026 01:36
@backryun
backryun force-pushed the perf/electron-unload-on-close branch 4 times, most recently from be7eae4 to e161c60 Compare August 14, 2026 15:55
@backryun backryun changed the title perf(electron): optionally unload renderer on close perf(electron): optionally unload renderer on close (4/8) Aug 14, 2026
@backryun
backryun force-pushed the perf/electron-unload-on-close branch 6 times, most recently from 489e260 to 811244f Compare August 15, 2026 01:52
@mergify

mergify Bot commented Aug 15, 2026

Copy link
Copy Markdown

⚠️ The sha of the head commit of this PR conflicts with #10327. Mergify cannot evaluate rules on this PR. Once #10327 is merged or closed, Mergify will resume processing this PR. ⚠️

@backryun
backryun force-pushed the perf/electron-unload-on-close branch 9 times, most recently from c133dc4 to 3d7ee3e Compare August 16, 2026 09:34
@diegosouzapw

Copy link
Copy Markdown
Owner

IN-FLIGHT — deferido. O head desta PR está no checkout principal concorrente (perf/electron-unload-on-close). Não faço merge, rebase, push nem alteração nesse checkout.

@diegosouzapw diegosouzapw added the deferred-v3.8.50 Adiada para o ciclo v3.8.50 (validacao VPS, refactor, ou escopo grande) label Aug 17, 2026
@backryun
backryun force-pushed the perf/electron-unload-on-close branch 3 times, most recently from 3e2db74 to 280a4bc Compare August 17, 2026 17:42
@diegosouzapw diegosouzapw removed the deferred-v3.8.50 Adiada para o ciclo v3.8.50 (validacao VPS, refactor, ou escopo grande) label Aug 17, 2026
@backryun
backryun force-pushed the perf/electron-unload-on-close branch from 280a4bc to 6c19702 Compare August 18, 2026 04:54
@backryun
backryun force-pushed the perf/electron-unload-on-close branch 10 times, most recently from 607467c to 47f17a1 Compare August 20, 2026 13:23
@backryun
backryun force-pushed the perf/electron-unload-on-close branch from 47f17a1 to 2dd0e4e Compare August 20, 2026 13:39
backryun and others added 3 commits August 20, 2026 11:31
Merged — locally validated (123/123 focused chatgpt-web tests, typecheck:core clean, file-size/changelog gates green). Thanks!
)

Merged — locally validated (6/6 focused lazy-window tests, plus the wider electron suite, typecheck:core clean, gates green). Thanks!
@diegosouzapw
diegosouzapw merged commit 8122f6b into diegosouzapw:release/v3.8.50 Aug 20, 2026
2 of 5 checks passed
@backryun
backryun deleted the perf/electron-unload-on-close branch August 20, 2026 14:35
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.

3 participants