-
Notifications
You must be signed in to change notification settings - Fork 411
fix(desktop): bundle tsx and use bundled Node for MCP servers #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c35d81fedf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "node_modules/esbuild/**", | ||
| "node_modules/tsx/**", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unpack tsx runtime deps with bundled tsx
In packaged builds you run tsx from app.asar.unpacked/.../node_modules/tsx/dist/cli.mjs, but only tsx and esbuild are listed in asarUnpack here. tsx has a runtime dependency on get-tsconfig; because module resolution from an unpacked path does not traverse into the packed app.asar sibling, get-tsconfig will be MODULE_NOT_FOUND at runtime unless it is also unpacked alongside tsx. This will prevent MCP servers from starting in packaged apps when the bundled tsx path is used.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Added
get-tsconfigto the ElectronasarUnpacklist so bundledtsxcan resolve its runtime dependency in packaged builds. apps/desktop/package.jsonL130-L142
Testing
- Not run (not requested).
|
@codex review |
|
@codex fix the CI failures |
|
Summary
Testing
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c35d81fedf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "node_modules/esbuild/**", | ||
| "node_modules/tsx/**", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unpack get-tsconfig with tsx for bundled Node
In packaged builds the MCP servers are started via bundled Node executing app.asar.unpacked/node_modules/tsx/dist/cli.mjs, which runs under a standalone Node process that cannot read modules from app.asar. tsx depends on get-tsconfig (see pnpm-lock.yaml entry for tsx@4.21.0), but only tsx and esbuild are unpacked here, leaving get-tsconfig inside app.asar. That will make the bundled Node process fail to resolve get-tsconfig at runtime (e.g., Cannot find module 'get-tsconfig'), preventing MCP servers from starting in packaged builds. Consider adding node_modules/get-tsconfig/** to asarUnpack or otherwise colocating it with the unpacked tsx tree.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Added
get-tsconfigto the ElectronasarUnpacklist so bundledtsxcan resolve its runtime dependency in packaged builds. apps/desktop/package.jsonL127-L137
Testing
- Not run (not requested).
Motivation
tsxruntime files with the app.NODE_BIN_PATHand a bundled-NodePATHavailable to MCP child processes so tools likenpx/tsxand Playwright install run without requiring a host Node installation.Description
getBundledTsxPath(),getMcpEnvironment(), andgetMcpCommand()toapps/desktop/src/main/opencode/config-generator.tsand use them to construct MCP servercommandandenvironmentso packaged apps run MCP servers with the bundled Node and bundledtsxwhen available and fall back to['npx','tsx', ...]otherwise.getNodePath/getBundledNodePathsand exposeNODE_BIN_PATHand prepend bundled NodebintoPATHfor MCP processes so CLI tools work without system Node.tsxas a runtime dependency inapps/desktop/package.jsonand includednode_modules/tsx,node_modules/esbuild, andnode_modules/get-tsconfigin the packagingfilesandasarUnpacklists sotsxand its runtime deps are present inside packaged releases.pnpm-lock.yamlto reflect the addedtsxdependency.Testing
unit,integration, andtypecheckjobs per.github/workflows/ci.yml.Codex Task