Skip to content

fix(git): use user-selected model for auto-generated commit messages#1168

Closed
seifalmotaz wants to merge 1 commit intopingdotgg:mainfrom
seifalmotaz:fix/selected-model-commit
Closed

fix(git): use user-selected model for auto-generated commit messages#1168
seifalmotaz wants to merge 1 commit intopingdotgg:mainfrom
seifalmotaz:fix/selected-model-commit

Conversation

@seifalmotaz
Copy link
Copy Markdown
Contributor

@seifalmotaz seifalmotaz commented Mar 17, 2026

What Changed

This PR fixes the auto-generated commit messages, PR content, and branch names to use the model selected by the user in the chat UI model picker, instead of the hardcoded gpt-5.3-codex constant.

Changes:

  1. Contracts (packages/contracts/src/git.ts)

    • Added optional model field to GitRunStackedActionInput schema
  2. Server - TextGeneration (apps/server/src/git/Services/TextGeneration.ts)

    • Added optional model parameter to CommitMessageGenerationInput, PrContentGenerationInput, and BranchNameGenerationInput interfaces
  3. Server - CodexTextGeneration (apps/server/src/git/Layers/CodexTextGeneration.ts)

    • Renamed CODEX_MODEL to DEFAULT_CODEX_MODEL as fallback
    • Added model parameter to runCodexJson function
    • Uses provided model or falls back to default
  4. Server - GitManager (apps/server/src/git/Layers/GitManager.ts)

    • Wires model parameter through runFeatureBranchStep, runCommitStep, runPrStep, and resolveCommitAndBranchSuggestion
  5. Server - ProviderCommandReactor (apps/server/src/orchestration/Layers/ProviderCommandReactor.ts)

    • Passes model from thread.turn-start-requested event to branch name generation
  6. Web - gitReactQuery (apps/web/src/lib/gitReactQuery.ts)

    • Added model parameter to gitRunStackedActionMutationOptions
  7. Web - GitActionsControl (apps/web/src/components/GitActionsControl.tsx)

    • Added selectedModel prop and passes it to the mutation
  8. Web - ChatHeader (apps/web/src/components/chat/ChatHeader.tsx)

    • Added selectedModel prop and passes it to GitActionsControl
  9. Web - ChatView (apps/web/src/components/ChatView.tsx)

    • Supplies selectedModel to ChatHeader

Why

Previously, when a user selected a specific model (e.g., gpt-5.2-codex) in the chat UI model picker and then triggered a Git action like "Auto Commit" or "Commit & Push", the app would ignore that selection and use the hardcoded gpt-5.3-codex model. This was problematic because:

  • Users may not have access to the hardcoded model
  • The model selection should be respected consistently across all features
  • It caused unexpected errors when the hardcoded model wasn't available

The fix propagates the user-selected model through the entire chain from the UI to the Codex CLI text generation calls, while maintaining backward compatibility with a sensible default fallback.

UI Changes

No visible UI changes. The behavior is now consistent with user expectations - the selected model is used for all AI-powered operations including commit message generation.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable - no visible UI changes)
  • I included a video for animation/interaction changes (not applicable)

Fixes #1165

Note

Pass user-selected model to auto-generated commit messages, branch names, and PR content

  • Adds an optional model field to the GitRunStackedActionInput contract and threads it through GitManager into all text generation calls (generateCommitMessage, generateBranchName, generatePrContent).
  • CodexTextGeneration now accepts a model override in each generation handler and passes it to the codex --model flag, falling back to DEFAULT_CODEX_MODEL when not supplied.
  • The web UI reads the currently selected model from ChatView, passes it via ChatHeader to GitActionsControl, and includes it in the runImmediateGitActionMutation payload.
  • First-turn branch name generation in ProviderCommandReactor also receives the model from the event payload.

Macroscope summarized 5a884a7.

The auto-generated commit messages and PR content were using a hardcoded
model (gpt-5.3-codex) instead of respecting the model selected in the chat UI.

- Add optional model parameter to TextGeneration input interfaces
- Pass model from GitRunStackedActionInput through GitManager to text generation
- Wire model selection from ChatView through ChatHeader to GitActionsControl
- Propagate model for branch name generation in ProviderCommandReactor
- Fall back to default model when no model is specified

Fixes pingdotgg#1165
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 33bb314e-bda3-4b5f-b98f-0716e45803c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

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

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 17, 2026
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

i don't think this is the correct solution. i wouldn't wanna use gpt-5.4 xhigh to generate a commit message for me, way too slow and it will overthink it.

what we should fix:

  • not using a model the user doesn't have access to (same as we do for gpt 5.3 spark)
  • make it configurable (probably a knob in settings, we really need to do #1033 to have server authorative settings)

@seifalmotaz
Copy link
Copy Markdown
Contributor Author

seifalmotaz commented Mar 17, 2026

Thanks for the feedback! I understand now - my previous PR was wrong.
ou're right that using gpt-5.4-xhigh for commit messages would be overkill. The solution should:

. Sensible default: Use a fast, appropriate model (like gpt-5.3-codex) for commit messages, NOT the user's chat model selection
2. Configurable: Let users override this if they want
3. Access check: Fall back silently if user lacks access to the configured model
Question: Should I implement this as a client-side setting now (in localStorage), or is this blocked until #1033?
For the default, I'd use gpt-5.3-codex - sound good?

@juliusmarminge
Copy link
Copy Markdown
Member

Thanks for the feedback! I understand now - my previous PR was wrong. ou're right that using gpt-5.4-xhigh for commit messages would be overkill. The solution should:

. Sensible default: Use a fast, appropriate model (like gpt-5.3-codex) for commit messages, NOT the user's chat model selection 2. Configurable: Let users override this if they want 3. Access check: Fall back silently if user lacks access to the configured model Question: Should I implement this as a client-side setting now (in localStorage), or is this blocked until #1033? For the default, I'd use gpt-5.3-codex - sound good?

can be client side for now yes.

default can probably be the newly released gpt-5.4-mini now

@seifalmotaz
Copy link
Copy Markdown
Contributor Author

I will draft this PR as it's the wrong approach, and will create new PR with new approach, i will make it as soon as i test it and make sure it's in good place (very soon).
Thanks

@seifalmotaz
Copy link
Copy Markdown
Contributor Author

#1171

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Auto-generated commits fail when user lacks access to hardcoded gpt-5.3-codex model

2 participants