Merged
Conversation
Add a per-worktree dev startup path so developers can run an isolated CodeMux instance without interrupting the normal app session. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds an “isolated dev mode” intended to let multiple CodeMux worktrees run concurrently by isolating Electron persistence paths under .codemux-dev/ and by centralizing service port selection (with a global offset + per-port overrides) across Electron, Vite, and Playwright.
Changes:
- Introduces isolated dev launcher (
bun run dev:isolated) that allocates/persists a per-worktree port offset and sets isolation env vars. - Splits Electron main entry into an early bootstrap (
electron/main/index.ts) plus the lifecycle/app wiring (electron/main/app-main.ts) so path overrides are applied before modules like logging load. - Centralizes persistence paths (
app-paths.ts) and port configuration (shared/ports.ts), and updates configs/proxies accordingly.
Reviewed changes
Copilot reviewed 29 out of 31 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Excludes app-main.ts from unit runs (Electron lifecycle needs real app). |
| vite.config.ts | Uses centralized ports for standalone dev server + proxies. |
| tests/unit/shared/ports.test.ts | Adds unit tests for offset + per-port override behavior. |
| tests/unit/scripts/dev-isolated.test.ts | Adds unit tests for isolated port plan construction. |
| tests/unit/electron/services/app-paths.test.ts | Tests isolated path redirection under .codemux-dev/. |
| tests/unit/electron/ipc-handlers.test.ts | Updates mocks to reflect app-main split. |
| src/lib/gateway-client.ts | Updates comments about dev/prod WS URL behavior. |
| shared/ports.ts | Implements env-driven ports with global offset + per-port overrides. |
| scripts/dev-isolated.ts | Implements isolated dev port allocation + spawn of bun run dev. |
| playwright.config.ts | Uses centralized WEB_PORT for baseURL default. |
| package.json | Adds dev:isolated script and cross-env dev dependency. |
| electron/main/services/worktree-store.ts | Uses centralized worktree persistence path. |
| electron/main/services/worktree-manager.ts | Uses centralized worktree persistence path. |
| electron/main/services/tunnel-manager.ts | Writes cloudflared config under centralized userData path. |
| electron/main/services/scheduled-task-service.ts | Uses centralized scheduled tasks persistence path. |
| electron/main/services/orchestrator-service.ts | Uses centralized orchestrations persistence path. |
| electron/main/services/logger.ts | Uses centralized logs + settings paths; supports isolated logs dir. |
| electron/main/services/device-store.ts | Uses centralized devices path + shared-vs-isolated dev behavior. |
| electron/main/services/default-workspace.ts | Re-exports centralized default workspace path helper. |
| electron/main/services/conversation-store.ts | Uses centralized conversations persistence path. |
| electron/main/services/app-paths.ts | New: centralized persistence path helpers + isolated dev path setup. |
| electron/main/ipc-handlers.ts | Imports startup/channel exports from app-main; reports isolated userData. |
| electron/main/index.ts | New early bootstrap: configure isolated paths before importing app-main. |
| electron/main/gateway/ws-server.ts | Reads settings via centralized settings path. |
| electron/main/channels/feishu/feishu-session-mapper.ts | Uses centralized channel bindings path. |
| electron/main/channels/channel-manager.ts | Uses centralized channel config paths. |
| electron/main/channels/base-session-mapper.ts | Uses centralized channel bindings path. |
| electron/main/app-main.ts | New: main-process lifecycle wiring moved from index.ts. |
| electron.vite.config.ts | Uses centralized ports for dev server + proxy targets. |
| bun.lock | Locks new cross-env dependency and transitive updates. |
| .gitignore | Ignores .codemux-dev/ workspace-local isolated state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Very good update, I've always want it. |
…/dev-isolated-worktree-appdata
realDuang
commented
Apr 30, 2026
Tighten port validation and reservation behavior so isolated dev startup fails early on invalid or conflicting plans, and document the worktree workflow for contributors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add targeted Electron device-store tests and keep the incremental coverage source filter aligned with the existing app-main lifecycle exclusion. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bun run dev:isolatedto launch per-worktree isolated dev instances using.codemux-dev/for app data, session data, logs, and persisted port allocation.app-mainso isolated paths are configured before logger/store modules load.CODEMUX_PORT_OFFSETand per-port overrides for Vite, Electron, and Playwright config.Test plan
bun run typecheckbun run test:unitbun run buildgit diff --checkCloses #137
🤖 Generated with Claude Code