Skip to content

Conversation

@firstfloris
Copy link
Contributor

@firstfloris firstfloris commented Dec 28, 2025

Summary

  • Fix "Server failed to start" error in packaged Electron app caused by broken symlinks

Problem

The @automaker/* packages in server-bundle/node_modules are symlinks pointing to ../../libs/.... The libs directory was being prepared by prepare-server.mjs but wasn't included in the extraResources configuration, so the symlinks were broken in the packaged app.

Solution

Add the server-bundle/libs directory to extraResources in apps/ui/package.json so the symlink targets are available in the packaged app.

Testing

  • Built with npm run build:electron:mac
  • Verified libs/ directory is present in packaged app at Contents/Resources/server/libs/
  • App launches successfully without "Server failed to start" error

Summary by CodeRabbit

  • Chores

    • Packaging updated to include additional server runtime resources in distributed builds.
  • Bug Fixes

    • Sandbox mode now automatically disables for projects stored in cloud-sync locations (avoids sandbox-related failures there).
  • Tests

    • Added unit tests covering cloud-sync path detection and sandbox auto-disable behavior across scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

The @automaker/* packages in server-bundle/node_modules are symlinks
pointing to ../../libs/. Without including the libs directory in
extraResources, these symlinks are broken in the packaged app,
causing 'Server failed to start' error on launch.
@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

📝 Walkthrough

Walkthrough

Adds a packaging resource mapping to the UI app and implements sandbox compatibility checks in the server SDK that auto-disable sandbox mode for cloud-storage paths, plus unit tests covering cloud-path detection and sandbox behavior.

Changes

Cohort / File(s) Summary
UI packaging
apps/ui/package.json
Added a build.extraResources entry: {"from": "server-bundle/libs", "to": "server/libs"} to include server bundle libraries in the packaged app.
Server SDK — sandbox checks
apps/server/src/lib/sdk-options.ts
Added CLOUD_STORAGE_PATH_PATTERNS, isCloudStoragePath(cwd: string): boolean, SandboxCheckResult interface, and checkSandboxCompatibility(cwd, enableSandboxMode?) which auto-disables sandbox for cloud-storage paths and returns a descriptive message. Integrated checkSandboxCompatibility into createChatOptions and createAutoModeOptions to use returned sandboxCheck.enabled.
Tests
apps/server/tests/unit/lib/sdk-options.test.ts
Added unit tests covering isCloudStoragePath (Dropbox, Google Drive, OneDrive, iCloud, negatives) and checkSandboxCompatibility behaviors, plus tests asserting option creators disable sandbox on cloud paths.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

Enhancement, Testers-Requested

Poem

🐰 I sniffed the paths both near and far,
Found clouds where sandboxes can't spar,
I hopped and marked what should be spared,
Bundled libs tucked safe and prepared,
A quiet build, a cheerful jar 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding the libs directory to Electron build extraResources in apps/ui/package.json. This matches the core problem being fixed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @firstfloris, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request rectifies a critical issue preventing the Electron application from launching correctly after being packaged. Specifically, it fixes a "Server failed to start" error that occurred because symbolic links within the server-bundle/node_modules directory, which pointed to shared library files, were broken. The change ensures that these essential libs directories are properly included in the Electron build's extraResources, allowing the symlinks to resolve successfully and the server to initialize as intended within the packaged application.

Highlights

  • Electron Build Fix: Resolves a "Server failed to start" error encountered in the packaged Electron application.
  • Symlink Resolution: Addresses the issue of broken symlinks within server-bundle/node_modules that pointed to the libs directory, which was not being included in the packaged app.
  • Configuration Update: Modifies apps/ui/package.json to explicitly include the server-bundle/libs directory in the extraResources configuration for the Electron build.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a bug that caused the packaged Electron app to fail on startup. The issue was due to broken symlinks for local packages because their target directory (libs) was not being included in the final build. By adding the server-bundle/libs directory to the extraResources in apps/ui/package.json, you've ensured that these necessary files are present in the packaged application, resolving the problem. The change is concise, well-targeted, and the pull request description clearly explains the problem and solution. The fix appears correct and complete.

@firstfloris firstfloris force-pushed the fix/electron-build-missing-libs branch from 551c462 to 927ce91 Compare December 28, 2025 19:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/server/tests/unit/lib/sdk-options.test.ts (1)

315-324: LGTM!

The new tests verify that sandbox mode is correctly auto-disabled when the working directory is in a cloud storage location. Good coverage of the integration between checkSandboxCompatibility and the option creation functions.

For consistency, consider adding an iCloud path test to createChatOptions as well, since createAutoModeOptions tests both Dropbox and iCloud paths.

Also applies to: 387-407

apps/server/src/lib/sdk-options.ts (2)

66-72: Windows path compatibility gap.

The patterns use forward slashes, but on Windows, path.resolve() returns backslash-separated paths. For example, C:\Users\test\Dropbox\project won't match '/Dropbox/'.

Consider normalizing the resolved path to use forward slashes before pattern matching:

🔎 Proposed fix
 export function isCloudStoragePath(cwd: string): boolean {
   const resolvedPath = path.resolve(cwd);
-  return CLOUD_STORAGE_PATH_PATTERNS.some((pattern) => resolvedPath.includes(pattern));
+  // Normalize to forward slashes for cross-platform pattern matching
+  const normalizedPath = resolvedPath.replace(/\\/g, '/');
+  return CLOUD_STORAGE_PATH_PATTERNS.some((pattern) => normalizedPath.includes(pattern));
 }

64-64: Address TODO: File upstream issue.

The TODO references filing an issue with the Claude CLI project. Consider tracking this to ensure it's not forgotten.

Would you like me to open an issue to track filing this upstream report?

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 927ce91 and 551c462.

📒 Files selected for processing (2)
  • apps/server/src/lib/sdk-options.ts
  • apps/server/tests/unit/lib/sdk-options.test.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always import from shared packages (@automaker/*), never from old relative paths

Files:

  • apps/server/tests/unit/lib/sdk-options.test.ts
  • apps/server/src/lib/sdk-options.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use resolveModelString() from @automaker/model-resolver to convert model aliases (haiku, sonnet, opus) to full model names

Files:

  • apps/server/tests/unit/lib/sdk-options.test.ts
  • apps/server/src/lib/sdk-options.ts
apps/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use createEventEmitter() from lib/events.ts for all server operations to emit events that stream to frontend via WebSocket

Files:

  • apps/server/src/lib/sdk-options.ts
🧬 Code graph analysis (1)
apps/server/tests/unit/lib/sdk-options.test.ts (1)
apps/server/src/lib/sdk-options.ts (4)
  • isCloudStoragePath (83-86)
  • checkSandboxCompatibility (111-143)
  • createChatOptions (418-446)
  • createAutoModeOptions (458-483)
🔇 Additional comments (7)
apps/server/tests/unit/lib/sdk-options.test.ts (2)

15-57: Good test coverage for macOS cloud storage paths.

The tests comprehensively cover macOS cloud storage detection for Dropbox, Google Drive, OneDrive, and iCloud Drive. The negative test cases for local and relative paths are also well-structured.

Consider adding Windows path coverage if Windows is a supported platform:

  • C:\Users\test\Dropbox\project
  • C:\Users\test\OneDrive\project
  • C:\Users\test\Google Drive\project

59-91: LGTM!

The checkSandboxCompatibility tests cover all code paths: user-disabled, cloud storage auto-disabled, enabled for local paths, and the undefined parameter edge case. The assertions appropriately verify both the enabled state and disabledReason.

apps/server/src/lib/sdk-options.ts (5)

83-86: LGTM!

The function correctly resolves relative paths and checks against known cloud storage patterns. The substring matching approach is pragmatic—false positives (detecting non-cloud paths as cloud) are low-risk since they only result in sandbox being disabled, which is a safer default.


91-98: LGTM!

The SandboxCheckResult interface is well-designed with a discriminated disabledReason field that makes the return values self-documenting.


111-143: LGTM!

The function correctly prioritizes user settings over cloud storage detection and provides meaningful context in the return value. The early return for falsy enableSandboxMode ensures explicit opt-out always takes precedence.

The console.warn at line 130 is appropriate here since this is a warning for operators/developers rather than an event to stream to the frontend.


428-442: LGTM!

Clean refactoring that centralizes sandbox compatibility logic. The conditional spread pattern ...(sandboxCheck.enabled && { sandbox: {...} }) is idiomatic and maintains the same behavior while adding cloud storage awareness.


465-479: LGTM!

Consistent implementation with createChatOptions. The shared checkSandboxCompatibility function eliminates duplication and ensures uniform behavior across both option creators.

@Shironex Shironex added Testers-Requested Request for others to test an enhancement or bug fix/etc. Do Not Merge Use this label if something should not be merged. labels Dec 28, 2025
@webdevcody
Copy link
Collaborator

can merge after test is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Use this label if something should not be merged. Testers-Requested Request for others to test an enhancement or bug fix/etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants