Skip to content

fix(git_app): add retry mechanism for commit message generation#2772

Merged
tusharmath merged 1 commit intomainfrom
retry-commit-message
Apr 1, 2026
Merged

fix(git_app): add retry mechanism for commit message generation#2772
tusharmath merged 1 commit intomainfrom
retry-commit-message

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Apr 1, 2026

Summary

Add a retry mechanism to commit message generation so that transient LLM failures or empty responses are automatically retried instead of surfacing as errors to the user.

Context

Commit message generation relies on an LLM call, which can occasionally fail transiently or return an empty message due to model hiccups, rate limits, or network blips. Previously these failures would propagate immediately as errors, forcing the user to manually re-invoke the command. This change wraps the generation call in the project's existing retry_with_config infrastructure, providing automatic resilience.

Changes

  • Derived Clone on DiffContext so it can be passed into the retry closure on each attempt
  • Wrapped generate_message_from_diff with retry_with_config, pulling retry settings from the project config (services.get_config().retry)
  • Added an empty-message guard that returns a Retryable error when the LLM produces an empty commit message, triggering a retry rather than silently returning a blank string

Key Implementation Details

The retry configuration is sourced from get_config().retry, falling back to RetryConfig::default() when not set. The empty-message check is placed after parsing the LLM response so only the generation + parse step is retried — not the diff truncation or context-building logic.

Testing

# Run the forge_app crate tests
cargo insta test --accept -p forge_app

# Verify the build
cargo check -p forge_app

Links

  • No related issues

@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 1, 2026
@tusharmath tusharmath changed the title fix(git_app): add retry mechanism for message generation fix(git_app): add retry mechanism for commit message generation Apr 1, 2026
@tusharmath tusharmath merged commit 86d9778 into main Apr 1, 2026
13 checks passed
@tusharmath tusharmath deleted the retry-commit-message branch April 1, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant