-
Notifications
You must be signed in to change notification settings - Fork 490
feat: add per-project default model override for new features #640
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
feat: add per-project default model override for new features #640
Conversation
- Add defaultFeatureModel to ProjectSettings type for project-level override - Add defaultFeatureModel to Project interface for UI state - Display Default Feature Model in Model Defaults section alongside phase models - Include Default Feature Model in global Bulk Replace dialog - Add Default Feature Model override section to Project Settings - Add setProjectDefaultFeatureModel store action for project-level overrides - Update clearAllProjectPhaseModelOverrides to also clear defaultFeatureModel - Update add-feature-dialog to use project override when available - Include Default Feature Model in Project Bulk Replace dialog This allows projects with different complexity levels to use different default models (e.g., Haiku for simple tasks, Opus for complex projects).
- Add handler in settings-service.ts to properly delete defaultFeatureModel when '__CLEAR__' marker is sent from the UI - Fix bulk-replace-dialog.tsx to correctly return claude-opus when resetting default feature model to Anthropic Direct (was incorrectly using enhancementModel's settings which default to sonnet) These fixes ensure: 1. Clearing project default model override properly removes the setting instead of storing literal '__CLEAR__' string 2. Global bulk replace correctly resets default feature model to opus
- Updated resetPhaseModels to also reset defaultFeatureModel to claude-opus - Fixed initial state to use canonical 'claude-opus' instead of 'opus'
Summary of ChangesHello @stefandevo, 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 enhances the application's flexibility by introducing a new configuration option that allows users to define a default model for new features on a per-project basis. This provides finer-grained control over AI model usage, ensuring that new features within a specific project can consistently use a preferred model without manual selection, while still respecting a global default. The changes span across UI components for display and interaction, state management for data handling, and backend services for persistence, ensuring a cohesive and robust implementation. Highlights
🧠 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 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
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds per-project defaultFeatureModel support: new ProjectSettings field, server handling for a "CLEAR" sentinel, store actions to set/clear project defaults, and UI surfaces (model defaults, project models, bulk-replace, add-feature dialog) that respect project-level overrides with global fallback. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as "Project Settings / Dialog"
participant Store as "App Store"
participant Server as "Settings Service"
User->>UI: Set or clear project defaultFeatureModel
UI->>Store: setProjectDefaultFeatureModel(projectId, entry|null)
Store->>Server: updateProject({ defaultFeatureModel: entry || "__CLEAR__" })
Server-->>Store: Persist confirmation
Store->>Store: update project.defaultFeatureModel
User->>UI: Open Add Feature dialog
UI->>Store: read currentProject.defaultFeatureModel & global default
Store-->>UI: effectiveDefaultFeatureModel (project ?? global)
UI->>UI: initialize dialog with effectiveDefaultFeatureModel
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.
Code Review
This pull request introduces a per-project override for the default feature model, which is a great enhancement for flexibility. The changes are comprehensive, touching the settings service, UI components for settings, the new feature dialog, and the state management store. The implementation is solid, with consistent use of patterns like the __CLEAR__ marker for resetting settings.
I have a couple of suggestions to improve maintainability:
- Refactor duplicated logic: A function to get a model's display name is implemented in a few different places. Consolidating this into a shared utility would reduce code duplication.
- Avoid hardcoded defaults: The default feature model (
claude-opus) is hardcoded in several places as a fallback. Using a shared constant would make it easier to manage this default value in the future.
apps/ui/src/components/views/project-settings-view/project-bulk-replace-dialog.tsx
Show resolved
Hide resolved
apps/ui/src/components/views/project-settings-view/project-bulk-replace-dialog.tsx
Outdated
Show resolved
Hide resolved
apps/ui/src/components/views/project-settings-view/project-models-section.tsx
Outdated
Show resolved
Hide resolved
apps/ui/src/components/views/project-settings-view/project-models-section.tsx
Show resolved
Hide resolved
apps/ui/src/components/views/settings-view/model-defaults/bulk-replace-dialog.tsx
Show resolved
Hide resolved
apps/ui/src/components/views/settings-view/model-defaults/bulk-replace-dialog.tsx
Outdated
Show resolved
Hide resolved
apps/ui/src/components/views/settings-view/model-defaults/model-defaults-section.tsx
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@apps/ui/src/components/views/board-view/dialogs/add-feature-dialog.tsx`:
- Around line 197-203: Run Prettier to fix formatting: break the long
destructuring from useAppStore() across multiple lines so it fits the project's
formatter rules and reformat the file; update the block that defines const {
defaultPlanningMode, defaultRequirePlanApproval, useWorktrees,
defaultFeatureModel, currentProject } = useAppStore() into a multi-line
destructure and ensure the subsequent effectiveDefaultFeatureModel calculation
(using currentProject?.defaultFeatureModel ?? defaultFeatureModel) remains
unchanged, then save and re-run the formatter to satisfy the lint/format check.
In
`@apps/ui/src/components/views/project-settings-view/project-bulk-replace-dialog.tsx`:
- Around line 69-75: The long destructuring from useAppStore is triggering
Prettier; split the single-line const into multiple lines so each identifier is
on its own line (or grouped sensibly) to satisfy line-length rules — update the
declaration where useAppStore() is destructured (the const that assigns
phaseModels, setProjectPhaseModelOverride, claudeCompatibleProviders,
defaultFeatureModel, setProjectDefaultFeatureModel) to a multi-line destructure
and ensure proper trailing commas and spacing to pass formatting.
In
`@apps/ui/src/components/views/settings-view/model-defaults/model-defaults-section.tsx`:
- Around line 116-152: The new FeatureDefaultModelSection contains an overlong
JSX line with the PhaseModelSelector that Prettier couldn't format; open the
FeatureDefaultModelSection function and break the JSX props for
PhaseModelSelector onto multiple lines (e.g., place <PhaseModelSelector on its
own line and put compact, value={defaultValue},
onChange={setDefaultFeatureModel}, align="end" each on their own indented lines)
so the formatter can wrap it, then run Prettier (or your repo format script) to
reformat the file; target the PhaseModelSelector element inside
FeatureDefaultModelSection to fix this.
🧹 Nitpick comments (1)
apps/ui/src/components/views/project-settings-view/project-models-section.tsx (1)
91-209: Consider extracting a sharedgetModelDisplayNamehelper.
The new section duplicates logic already present inPhaseOverrideItem; a shared utility would avoid drift.
apps/ui/src/components/views/project-settings-view/project-bulk-replace-dialog.tsx
Outdated
Show resolved
Hide resolved
apps/ui/src/components/views/settings-view/model-defaults/model-defaults-section.tsx
Show resolved
Hide resolved
Address PR review feedback:
- Replace hardcoded { model: 'claude-opus' } with DEFAULT_GLOBAL_SETTINGS.defaultFeatureModel
- Fix Prettier formatting for long destructuring lines
- Import DEFAULT_GLOBAL_SETTINGS from @automaker/types where needed
This improves maintainability by centralizing the default value.
Summary
defaultFeatureModelsetting that can be overridden at the project levelChanges
defaultFeatureModeltoProjectSettingsinterfacesetDefaultFeatureModel,setProjectDefaultFeatureModelactions, updated reset/clear functions__CLEAR__handler for project-level override deletionFeatureDefaultModelSectioncomponentFeatureDefaultModelOverrideSectioncomponentTest plan
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.