Repository navigation
Add FORK_MODE support to ProcessTransport for Electron IPC integration - #1719
Merged
tanzhenxin merged 2 commits intoFeb 5, 2026
Merged
Conversation
- Rename USE_FORK_FOR_ELECTRON to FORK_MODE - Add fork mode in ProcessTransport for Electron IPC support - Add comprehensive unit tests for fork mode Co-authored-by: Qwen-Coder <[email protected]>
Contributor
📋 Review SummaryThis PR introduces a valuable 🔍 General Feedback
🎯 Specific Feedback🔴 Critical
🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
…native type Co-authored-by: Qwen-Coder <[email protected]>
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
…-transport-for-electron Add FORK_MODE support to ProcessTransport for Electron IPC integration
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.
TLDR
Add
FORK_MODEenvironment variable support to ProcessTransport to enable IPC communication for Electron integration. WhenFORK_MODE=1is set, the SDK useschild_process.forkinstead ofspawn, allowing Electron main process to communicate with Claude Code subprocess via Node.js IPC channels.Dive Deeper
This PR introduces an opt-in fork mode for the TypeScript SDK's ProcessTransport:
FORK_MODE=1triggers fork mode instead of spawn'ipc'to stdio configuration, enabling bidirectional communication between parent and child processesprocess.versions.electronand adjusts module path resolution when running JS files through Electron's executableThe implementation handles two scenarios:
spawnInfo.commandas the fork module pathReviewer Test Plan
Test fork mode with environment variable:
FORK_MODE=1 npm test -- packages/sdk-typescript/test/unit/ProcessTransport.test.tsVerify spawn mode still works (default behavior):
npm test -- packages/sdk-typescript/test/unit/ProcessTransport.test.tsRun the new fork mode tests specifically:
For Electron integration testing (if applicable):
FORK_MODE=1in your Electron app's environmentTesting Matrix
Note: Unit tests were run and passed on macOS. Other platforms need validation.
Linked issues / bugs
Fixes #1699