pub fn generate_commit_message(
diff: &str,
registry: &AgentRegistry,
runtime: &mut PipelineRuntime<'_>,
commit_agent: &str,
template_context: &TemplateContext,
workspace: &dyn Workspace,
prompt_history: &HashMap<String, String>,
) -> Result<CommitMessageResult>Expand description
Generate a commit message using the standard agent pipeline with fallback.
This function uses the standard agent pipeline with fallback, which provides:
- Proper stdout/stderr logging
- Configurable fallback chains
- Retry logic with exponential backoff
- Agent error classification
Multi-stage retry logic:
- Try initial prompt
- On fallback/empty result, try strict JSON prompt
- On failure, try V2 strict prompt (with negative examples)
- On failure, try ultra-minimal prompt
- On failure, try emergency prompt
- Only use hardcoded fallback after all prompt variants exhausted
§Agent Cycling Behavior
This function implements proper strategy-first cycling by trying each strategy with all agents before moving to the next strategy:
- Strategy 1 (initial): Agent 1 → Agent 2 → Agent 3
- Strategy 2 (strict JSON): Agent 1 → Agent 2 → Agent 3
- Strategy 3 (strict JSON V2): Agent 1 → Agent 2 → Agent 3
- etc.
This approach is more efficient because if a particular strategy works well with any agent, we succeed quickly rather than exhausting all strategies on the first agent before trying others.
§Arguments
diff- The git diff to generate a commit message forregistry- The agent registry for resolving agents and fallbacksruntime- The pipeline runtime for execution servicescommit_agent- The primary agent to use for commit generationtemplate_context- Template context for user template overridesworkspace- Workspace filesystem for file operationsprompt_history- Prompt history for checkpoint/resume determinism
§Returns
Returns Ok(CommitMessageResult) with the generated message and metadata.