Skip to content

feat(bump): add retry_bump_after_failure config option - #2100

Open
EkinDeveci1907 wants to merge 4 commits into
commitizen-tools:masterfrom
EkinDeveci1907:feat/retry-bump-after-failure
Open

EkinDeveci1907 wants to merge 4 commits into
commitizen-tools:masterfrom
EkinDeveci1907:feat/retry-bump-after-failure

Conversation

@EkinDeveci1907

@EkinDeveci1907 EkinDeveci1907 commented Oct 4, 2026 •

Copy link
Copy Markdown

Description

adds a 'retry_bump_after_failure' config option so 'cz bump' can retry a failed commit without passing '--retry' everytime. This is the same idea as 'retry_after_failure' for 'cz commit'.

this covers action item 2 from #1302. Action item 1 (deprecating 'retry_after_failure' in favour of 'retry_commit_after_failure') is not part of this PR.

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Generated-by: Claude following the guidelines

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Expected Behavior

with 'retry_bump_after_failure = true' in the config, 'cz bump --changelog' retries the commit once if the first attempt fails (for example when a pre-commit hook reformats the changelog), the same as running 'cz bump --changelog --retry'. the option defaults to 'false', so nothing changes for existing users.

Steps to Test This Pull Request

  1. run 'uv run pytest tests/commands/test_bump_command.py -k retry_bump_after_failure'
  2. the test turns the option on, makes the first 'git commit' fail and the second one pass, then checks that 'cz bump' tried to commit twice

Additional Context

part of #1302

i ran 'uv run poe lint' and 'uv run poe test' locally and everything passes (1328 passed).

@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.28%. Comparing base (b2eb0cb) to head (f334325).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2100   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files          61       61           
  Lines        2862     2865    +3     
=======================================
+ Hits         2813     2816    +3     
  Misses         49       49           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new option is missing from default settings and user documentation.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds configurable retry behavior for failed cz bump commits.

Changes:

  • Adds retry_bump_after_failure.
  • Combines the setting with --retry.
  • Tests configured retry behavior.
File Description
commitizen/​defaults.py Declares the new setting.
commitizen/​commands/​bump.py Applies configured retry behavior.
tests/​commands/​test_bump_command.py Tests a failed commit retry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread commitizen/defaults.py
Comment thread commitizen/defaults.py
Comment thread docs/config/bump.md Outdated

@bearomorphism bearomorphism left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved with documentation suggestions. I didn't validate the new config option on my machine, but the code looks good to me.

cc @woile @Lee-W

@bearomorphism
bearomorphism requested review from Lee-W and woile October 6, 2026 04:57
Co-authored-by: Tim Hsiung <bear890707@gmail.com>

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants