Repository navigation
Keep the what and why in generated commit messages - #44
Open
rafaeelricco wants to merge 6 commits into
Open
rafaeelricco wants to merge 6 commits into
rafaeelricco wants to merge 6 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 `low`, or Gemini's first level. - Drop the unused `withMinEffort` import from `src/domain/llm/router.ts` and list split plans under `withDefaultMinEffort` in its header. - Assert a configured `high` reaches the provider and an unset effort defaults to `low` in the split-plan router tests.
- Add `renderWithinBudget`, which gives leftover budget back to files `fitToBudget` reduced, so a 19,945-token diff now sends about 12,000 tokens instead of 225. - Cut long files at a `# ... N more changed lines cut` marker, taking lines round-robin so every hunk is represented before any hunk gets more. - Serve source files first, then tests, then deleted files, so a deleted body only takes what the others leave over. - Hand a share to the other files when a file's lines are too long to use it. - Rewrite the legend to describe the cut marker and tell the model not to infer changes from line counts. - Cover Markdown files, many hunks, many files, huge single lines, deleted files, and the budget limit with unit tests.
- Pass `context.diff` to `refineCommitMessage` from `Commit.refine`, so an adjustment like "explain why" can see the code. - Rename the refine input to `diff` and wrap it in `<diff>` in `getRefinePrompt`. - Update the module headers and the `pnpm measure` label that described Adjust as manifest-only. - Assert the diff reaches the provider in the commit, prompt, and router tests.
- Tell the split prompt to describe behavior, cover each distinct change, give the reason when the diff shows it, and not list files or quote line counts. - State the multi-bullet message shape for the built-in conventions and leave the shape to a custom template. - Add a detailed multi-bullet example, and keep the one-line example for custom templates. - Ask for line breaks as `\n` inside the JSON string. - Assert the guidance, the custom template case, and that the examples parse as JSON.
- Edit only the title in the split plan, because `p.text` keeps just the last line of a multi-line value once you type, which lost the body. - Show titles in the commit picker and indent bodies under their number in the plan note. - Cover the picker, the note, and the edit flow with unit tests.
- Retry `JSON.parse` with line breaks inside strings escaped, so a multi-line message written with raw newlines no longer fails the whole `commit` run with "Split plan: invalid JSON". - Cover escaped and raw line breaks, and a reply that is still not JSON, with unit tests.
rafaeelricco
marked this pull request as ready for review
November 4, 2026 23:07
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. |
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
Since the compression work landed, generated commit messages have been losing their meaning: they read more like a list of the files that changed than an account of what changed and why.
What's New
Compression Budget
renderWithinBudgetgives leftover budget back to filesfitToBudgetreduced.fitToBudgetcould drop a whole file to a stat line and leave most of the budget unused, as when6b6e2d9inpov-studio-prowent from 19,945 tokens to 225 against a 12,000 budget. That commit now sends about 12,000 tokens.# ... N more changed lines cutmarker. Lines are taken round-robin, so every hunk is represented before any hunk gets more.Split Plan Messages
low, or Gemini's first level.commitrun.Adjust
refineCommitMessagereceivescontext.diffinstead of the file list, so an adjustment such as "explain why" can see the code. Each adjust can resend up to about 12,000 tokens.Split Review
p.textkeeps just the last line of a multi-line value once you type, which lost the body.Compressed Context Flow
flowchart TB A["Staged diff"] --> B{"Fits 12,000 tokens?"} B -->|Yes| C["Send the exact diff"] B -->|No| D["fitToBudget: lower detail per file"] D --> E["Leftover budget"] E --> F["Source files"] F --> G["Test files"] G --> H["Deleted files"] H --> I["Send with cut markers"]Changed Files
src/domain/context/compress.tsrenderWithinBudget, round-robin cuts, fair sharessrc/domain/context/context.tsrenderWithinBudget, rewrite the legendsrc/domain/commit/prompts.tssrc/domain/llm/router.tssrc/domain/split/plan.tssrc/cli/split.tssrc/cli/commit.tscontext.diffto refinescripts/measure-context.tstest/domain/context/,test/domain/commit/,test/domain/llm/,test/domain/split/,test/cli/Testing & Feedback
Typecheck, Prettier,
lint:ci, the build, and all 413 tests pass. I also ran the real split review in a pseudo-terminal with real git commits, and replayed 1,002 commits from 7 repos throughbuildStagedContext. Commits sending under half the budget fell from 24 to 3: two with huge single-line changes, and one with an identical edit across 98 files. One commit stays over budget, because its 527 renames make the file list alone about 23,000 tokens.No real provider call has gone through the tool yet. Message comparisons used Haiku on the generated prompts by hand, one sample per case. Please look closely at:
\\nfrom a model still commits a literal\nin the message.fast-commit-modelwill conflict with this branch inprompts.tsandrouter.ts.fc4a7d6is already covered here.If you find any bugs or have recommendations for improvements, please open an issue and assign it to me.