Repository navigation
Add a fast model for commit messages and split plans - #42
Closed
rafaeelricco wants to merge 3 commits into
Closed
rafaeelricco wants to merge 3 commits into
rafaeelricco wants to merge 3 commits into
Conversation
- Call `generateContent` with `withDefaultMinEffort(config)` in `generateSplitPlan`, so an explicit effort reaches the provider and an unset one still falls back to the lowest level. - Drop the unused `withMinEffort` import from `src/domain/llm/router.ts` and update the module header to list split plan under `withDefaultMinEffort`. - Assert a configured `high` effort reaches the provider and an unset effort defaults to `low` in the split-plan router tests.
- Replace the "internally decide" and stacked "ONLY / Do NOT" output lines in the conventional, imperative, and custom prompts with one line explaining that the reply becomes the commit message verbatim. - Capitalize the imperative prompt's style examples and negative example so they match its capital-letter rule, and make the example body bullets complete imperative sentences. - Label the split-plan examples as illustrative so their imperative messages do not override the active convention. - Limit the branch-name "forbidden anywhere" list to words from the instructions, so area prefixes like `cli` stay usable, and drop the `<synthesis_protocol>` steps while keeping the no-subset rule. - Pass `commit_convention` and `custom_template` through `refineCommitMessage` into `getRefinePrompt`, which now states the configured convention and the size-based format instead of inferring the convention from the current message. - Cover the refine prompt's use of a custom template with a unit test and update the refine call sites in the router tests.
- Add an optional `fast_model` to the config; files without it load as `Nothing` and keep using the main model, and `commit setup` resets it. - Swap `fast_model` into `Commit.create` at the provider's lowest effort, so messages, Regenerate, Adjust and split plans (including split Regenerate) use it while `commit branch` keeps the main model. - Add `commit fast-model` to pick a model from the provider's list or go back to the main model, saving the sign-in refreshed by `resolveProvider`. - List the command in `commit --help`, the README and the dispatcher, and show the fast model in `commit doctor`. - Retry an Anthropic request once without adaptive thinking and `effort` when the model rejects them, as Claude Haiku 4.5 does, and report its effort as "provider default". - Cover the config default, the fast model reaching the commit and split-plan calls, the command's pick, clear, cancel and refreshed-sign-in cases, and the Anthropic retry with unit tests.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
Closing: keeping only the prompt updates, which are in #37. The fast-model config isn't wanted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Make commit generation faster. Every message and split plan waits on the main model at its configured effort, even though writing a commit message is simple summarization that a smaller model handles well.
What's New
Fast Model Config
fast_modelconfig field (a model id from the same provider and sign-in asai). Older config files without it load asNothingand behave exactly as before;commit modelkeeps it andcommit setupresets it.Commit.createswaps it in withwithModel+withMinEffort, so the plain message, Regenerate, Adjust and split plans (including split-plan Regenerate inSplit) all run on it at the provider's lowest effort.commit branchkeeps the main model.commit fast-modelCommandresolveProviderjust refreshed, so running it never writes stale OAuth tokens back.commit --help, the README and the dispatcher inindex.ts;commit doctorshows it after the main model (claude-sonnet-5 (medium effort), fast: claude-haiku-4-5).Anthropic Reasoning Retry
effort, which the Anthropic path always sent. A 400 whose message mentions either now gets one retry without both, on the API-key and setup-token paths alike, and the commit note reports "provider default" effort. Other 400s are not retried. This mirrors the retry-without-effort that the OpenAI and xAI paths already have.Model Selection Flow
flowchart TB A["Commit.create()"] --> B["resolveProvider(config)"] B --> C{"fast_model set?"} C -->|no| D["main ai, configured effort"] C -->|yes| E["withModel + withMinEffort"] D --> F["messages, Adjust, split plans"] E --> F F --> G{"Anthropic rejects thinking/effort?"} G -->|no| H["reply"] G -->|yes| I["retry once without them"] I --> HChanged Files
src/domain/config/config.tsfast_modelfield.src/cli/commit.tsCommit.createswaps in the fast model at lowest effort.src/cli/fast-model.tscommit fast-modelpick / clear command.src/cli/parser.ts,index.tsfast-modelcommand, help text, dispatch, header notes.src/cli/doctor.tssrc/cli/setup.tssrc/infra/llm/anthropic.tssrc/domain/llm/auth-resolver.tsREADME.mdcommit fast-modelusage and table row.test/**fast_model: Nothing().Testing & Feedback
Check
Commit.createinsrc/cli/commit.ts: every router call incommitandsplitshould see the fast config, andcommit branchshould not. Insrc/infra/llm/anthropic.ts, check that the retry only fires on 400s that mention effort or thinking. The new commit, split and Anthropic-retry tests fail on the pre-change code.Not verified: the exact wording Anthropic returns when Haiku 4.5 gets
effortor adaptive thinking. To try it for real:commit fast-modeland pickclaude-haiku-4-5, then runcommiton a staged change. The commit note should showclaude-haiku-4-5 with provider default effort.split_commitson and confirm the split plan also comes from the fast model.commit fast-modelagain, choose "Use the main model", and confirmcommit doctorno longer shows a fast model.If you find any bugs or have recommendations for improvements, please open an issue and assign it to me.