feat: add configurable Git writing settings#4204
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces a new feature with configurable Git writing settings, PR template detection, and a dedicated Git writer model option spanning multiple packages. There is also an unresolved review comment about a potential bug in provider availability validation that could cause runtime issues. You can customize Macroscope's approvability policy. Learn more. |
90e3450 to
8cead8e
Compare
8cead8e to
263976b
Compare
263976b to
afab9d6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit afab9d6. Configure here.
Co-Authored-By: Claude <noreply@anthropic.com>
afab9d6 to
4c5f401
Compare
| ): LegacyProviderSettings | undefined => | ||
| (settings.providers as Record<string, LegacyProviderSettings | undefined>)[provider]; | ||
|
|
||
| export function isModelSelectionProviderEnabled( |
There was a problem hiding this comment.
🟡 Medium src/serverSettings.ts:25
isModelSelectionProviderEnabled returns true for any providerInstances entry whose enabled field is omitted or true, without checking whether the instance's driver is actually available. When a persisted gitWriterModelSelection references an instance whose driver is not installed in this build, this function returns true and resolveGitWriterModelSelection keeps the unavailable writer model instead of falling back to the global text-generation model — so Git text generation targets a provider that cannot run. Consider validating the instance's driver against the available driver set before treating the instance as enabled.
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/shared/src/serverSettings.ts around line 25:
`isModelSelectionProviderEnabled` returns `true` for any `providerInstances` entry whose `enabled` field is omitted or `true`, without checking whether the instance's `driver` is actually available. When a persisted `gitWriterModelSelection` references an instance whose driver is not installed in this build, this function returns `true` and `resolveGitWriterModelSelection` keeps the unavailable writer model instead of falling back to the global text-generation model — so Git text generation targets a provider that cannot run. Consider validating the instance's `driver` against the available driver set before treating the instance as enabled.

What Changed
Why
Generated commit messages and pull request content currently use one generic style across repositories.
These settings let generated Git text follow repository conventions or explicit user instructions while still allowing a separate model to be selected for Git-writing tasks. Pull request descriptions can also follow each repository's existing template instead of always using a fixed body structure.
UI Changes
The Source Control settings page now includes a Text Generation section for:
Checklist
Closes #264
Closes #656
Closes #989
Note
Medium Risk
Touches commit/PR generation and new git-tree template reads; bounded and tested, but behavior changes affect all stacked git actions and persisted settings.
Overview
Adds server settings for how AI-generated Git text is written:
textGenerationStyle(repository conventions, Conventional Commits, or custom instructions), optional follow PR templates, and an optionalgitWriterModelSelectionthat overrides the global text-generation model for commits, PRs, and branch names.GitManagernow resolves style into aTextGenerationPolicy(including recent commit subjects for repo conventions), passespolicyand detectedprTemplateinto text generation, and usesresolveGitWriterModelSelectionfor model choice. NewdetectPrTemplatereads templates from the committed base tree viagit ls-tree/cat-file(size limits, no ambiguous multi-template guesses, symlink/path safety).Prompt builders and all provider backends accept
policyandprTemplate; PR bodies follow the repo template when present instead of fixed Summary/Testing headings.UI: Source Control settings gain a Text generation section (style, PR templates toggle, optional Git writer model). Shared
isModelSelectionProviderEnabled/resolveGitWriterModelSelectionpreserve the dedicated selection when its provider is disabled while falling back at runtime.Reviewed by Cursor Bugbot for commit 4c5f401. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add configurable Git writing style, PR template detection, and dedicated Git writer model selection
textGenerationStylesetting with three modes (repo_conventions,conventional_commits,custom) and agitWriterModelSelectionfield to server settings, exposed in a new TextGenerationSettings.tsx section on the Source Control settings page.resolveStylePolicyin GitManager.ts that maps the configured style to a text generation policy, optionally including recent commit subjects as examples forrepo_conventionsmode.Claude,Codex,Cursor,Grok,OpenCode) now forwardpolicyandprTemplatefields to prompt builders, so commit and PR prompts reflect the configured style.Macroscope summarized 4c5f401.