Skip to content

Enable automatic desktop main, preload and runtime reloads in development - #50

Merged
SYMBaiEX merged 2 commits into
mainfrom
sym/desktop-dev-reload
Oct 26, 2026
Merged

SYMBaiEX merged 2 commits into
mainfrom
sym/desktop-dev-reload

Conversation

@SYMBaiEX

@SYMBaiEX SYMBaiEX commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Desktop development built Electron and the agent once, so runtime/main/preload edits required restarting the command. nub run desktop:dev now serves the UI with Vite HMR and uses Vite/esbuild watch APIs for incremental main, preload and both CLI runtime entries. Shared workspace imports are watched by the bundlers; skill/character Markdown and JSON edits also request reloads. CLI release builds and dev watch share the same build options.

Successful builds coalesce into a serialized Electron restart. Private dev-only IPC asks Electron to quit through its existing runtime/data shutdown path and waits for process exit before replacement. Invalid builds preserve the current app; a nonzero Electron exit keeps watching for a fix. Startup cancellation closes late-created watchers, and terminal signals are handled without bypassing normal runtime shutdown. Main/runtime reloads stop active dev runs. UI-only edits retain the running app.

The default persistent dev profile lives in var/desktop-dev/profile; an explicit --user-data-dir and DOOLITTLE_DEV_PORT remain available. No packaging or reinstall is part of the editing loop. Packaged applications do not enable the dev control channel.

Validation: 4 focused reload-coordinator tests; 3 real Electron dev journeys (DOM CSS HMR, main/preload/shared/runtime reloads, old runtime exit, syntax-error and Electron-crash recovery, Ctrl+C during startup and ready state, watcher/server cleanup); desktop/tooling type checks; normal CLI build and built CLI help; formatting, dependency ownership, plugin boundaries, local links and unused-dependency checks. Native dev acceptance ran on macOS using isolated offline profiles. Its POSIX process-ownership probe explicitly skips Windows and the source-editing journey is opt-in via test:dev:desktop. No local release packaging/reinstall cycle was needed.

PR validation, Linux native/packaged acceptance and CodeQL all passed. Merged as 02b3e61; main is clean and pushed, with the same source tree as the tested feature head.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a25eaaeb-f052-4bad-ab1e-58e141949c92
Commits

Reviewing files that changed from the base of the PR and between 3739fbe and 1f03a2d.

Files selected for processing: 13
  • README.md
  • apps/cli/package.json
  • apps/desktop/scripts/dev-reload.ts
  • apps/desktop/scripts/dev.ts
  • apps/desktop/src/main/index.ts
  • apps/desktop/tsconfig.main.json
  • docs/engineering/fast-development.md
  • package.json
  • playwright.dev.config.ts
  • scripts/build-cli.ts
  • scripts/cli-build-options.ts
  • tests/boundary/desktop-dev-reload.test.ts
  • tests/e2e/desktop-dev.pw.ts

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

Walkthrough

The desktop development command now serves the renderer and watches desktop builds and selected content. Successful builds trigger serialized Electron restarts; failed builds leave the current app running. The change adds CLI build configuration, shutdown handling, workflow tests, and development documentation.

Changes: Desktop development workflow

Layer / File(s) Summary
CLI build options and wiring
scripts/cli-build-options.ts, scripts/build-cli.ts, apps/cli/package.json, apps/desktop/tsconfig.main.json
Shared esbuild options define the CLI entry points and output settings. The CLI build script uses these options, and the desktop TypeScript configuration includes them.
Build readiness and Electron lifecycle
apps/desktop/scripts/dev-reload.ts, apps/desktop/scripts/dev.ts, apps/desktop/src/main/index.ts
The development supervisor starts the renderer and watches main, preload, runtime, and selected content changes. It gates serialized restarts on build readiness and requests normal Electron shutdown through IPC. Development-only main-process handlers respond to supervisor messages, disconnects, and termination signals.
Development workflow tests and documentation
tests/boundary/desktop-dev-reload.test.ts, tests/e2e/desktop-dev.pw.ts, playwright.dev.config.ts, package.json, README.md, docs/engineering/fast-development.md
Tests cover build readiness, reloads, build failures, Electron exits, and shutdown. The Playwright configuration and package script run the end-to-end tests. The documentation describes the development workflow, profile, overrides, and test commands.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant DesktopDevSupervisor
  participant Vite
  participant esbuild
  participant DesktopDevReload
  participant Electron
  Developer->>DesktopDevSupervisor: Start desktop development
  DesktopDevSupervisor->>Vite: Start renderer server
  DesktopDevSupervisor->>esbuild: Start main, preload, and runtime builds
  esbuild-->>DesktopDevReload: Report build readiness
  DesktopDevReload->>DesktopDevSupervisor: Request restart when surfaces are ready
  DesktopDevSupervisor->>Electron: Launch with renderer URL
  Developer->>esbuild: Edit watched build source
  esbuild-->>DesktopDevReload: Report build status
  DesktopDevReload->>DesktopDevSupervisor: Request serialized restart
  DesktopDevSupervisor->>Electron: Request normal quit over IPC
  Electron-->>DesktopDevSupervisor: Exit
  DesktopDevSupervisor->>Electron: Launch updated app
Loading
Merge Risk: Minimal · up to 1f03a

The change adds a development-only reload supervisor, shared CLI build options, tests and documentation. Nothing in the supplied evidence shows a concrete failure that should block merging, and packaged apps do not register the dev control channel.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 10 functions across 8 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the outcome, scope, implementation behavior, validation coverage, platform limits, and development workflow. It does not use the template headings or list exact comman…
Title check Passed The title is concise, specific, and accurately describes the primary change: automatic development reloads for the desktop main, preload, and runtime components.
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 clearly explains the outcome, scope, implementation behavior, validation coverage, platform limits, and development workflow. It does not use the template headings or list exact commands and results, and it omits explicit risk and rollback details, but it is sufficiently complete and relevant.

Full details: Docstring Coverage

Explanation

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 10 functions across 8 files. (5 skipped: 5 unsupported.)

Resolution

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

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • 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.

@SYMBaiEX
SYMBaiEX merged commit 02b3e61 into main Oct 26, 2026
6 checks passed
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