-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: prefer source backend over stale settings path in dev mode #1389
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: develop
Are you sure you want to change the base?
fix: prefer source backend over stale settings path in dev mode #1389
Conversation
When running `npm run dev` after having previously used the packaged DMG app, settings.json may contain an `autoBuildPath` pointing to the packaged app's backend instead of the source code backend. This causes confusing errors like "require is not defined" in the Graphiti setup wizard because the wrong Python venv is used. This fix detects dev mode (`!app.isPackaged`) and automatically prefers the source backend when it exists, overriding stale settings paths. Packaged app behavior is unchanged. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
Summary of ChangesHello @hbruceweaver, 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 resolves a common development environment problem where a user's Highlights
Using Gemini Code AssistThe 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
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 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
|
📝 WalkthroughWalkthroughA development mode fix is added to override the saved backend path with the source backend path when running in development mode. The code checks for spec_runner.py existence and updates the path if it differs from the current configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
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.
🎉 Thanks for your first PR!
A maintainer will review it soon. Please make sure:
- Your branch is synced with
develop - CI checks pass
- You've followed our contribution guide
Welcome to the Auto Claude community!
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.
Code Review
The pull request effectively resolves a common development issue where a stale autoBuildPath in settings.json could lead to incorrect Python virtual environment usage during npm run dev. The introduced logic correctly detects development mode and prioritizes the source backend path, significantly improving the developer experience by preventing cryptic dependency errors. The changes are well-placed and include informative logging for debugging purposes.
| let sourceBackendExists = false; | ||
| try { | ||
| accessSync(sourceSpecRunnerPath); | ||
| sourceBackendExists = true; | ||
| } catch { | ||
| // Source backend doesn't exist | ||
| } | ||
|
|
||
| if (sourceBackendExists && validAutoBuildPath !== sourceBackendPath) { | ||
| console.log('[main] Dev mode detected - preferring source backend over settings'); | ||
| console.log('[main] Settings path:', validAutoBuildPath); | ||
| console.log('[main] Source path:', sourceBackendPath); | ||
| validAutoBuildPath = sourceBackendPath; | ||
| } |
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.
The sourceBackendExists boolean variable is redundant. The logic can be simplified by directly performing the if condition check inside the try block, leveraging the EAFP (Easier to Ask for Forgiveness than Permission) pattern more directly. This makes the code slightly more concise and easier to follow.
try {
accessSync(sourceSpecRunnerPath); // If this succeeds, the file exists
if (validAutoBuildPath !== sourceBackendPath) {
console.log('[main] Dev mode detected - preferring source backend over settings');
console.log('[main] Settings path:', validAutoBuildPath);
console.log('[main] Source path:', sourceBackendPath);
validAutoBuildPath = sourceBackendPath;
}
} catch {
// Source backend doesn't exist or isn't accessible, so we don't override.
// No action needed, validAutoBuildPath retains its original value.
}
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
67a743f to
e83e445
Compare
Summary
npm run devafter previously using the packaged DMG,settings.jsonmay retainautoBuildPathpointing to the packaged app's backendThe Problem
npm run devsettings.jsonstill points to/Applications/Auto-Claude.app/Contents/Resources/backendThe Fix
Added dev-mode detection in
apps/frontend/src/main/index.ts:!app.isPackagedto detect dev mode../../../backendNo changes to packaged app behavior.
Test plan
npm run dev🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.