Skip to content

attempt_ci_fix cannot handle commit message formatting failures #248

Description

@abhiramnarayana

Problem

When CI fails due to commit message validation (e.g., title too long, missing topic prefix, missing Signed-off-by trailer), the attempt_ci_fix mechanism in ci_evaluator.py is unable to resolve the failure. It correctly identifies the issue from CI logs but can only modify files and create new commits — it cannot amend or squash existing commit messages.

This results in:

  1. Agent analyzes CI log → correctly identifies commit message formatting is the problem
  2. Agent attempts to fix → but there are no file changes to make
  3. git commit fails with: nothing added to commit but untracked files present
  4. CI fix exhausts its attempts → workflow escalates to forge:blocked
  5. Manual intervention required (squash commits, reformat message, force-push)

Reproduction

  1. Target a repository with a check-commits CI gate that enforces:
    • Title length ≤ 72 characters
    • Lowercase topic prefix (e.g., ipv6:, openflow:)
    • Signed-off-by trailer
  2. Run the bug workflow through implementation → PR creation
  3. Forge generates commits with messages like: [OSPRH-33668] Fix EPIPE errors in openstack-network-exporter OpenFlow stats collection (too long, no topic prefix, no Signed-off-by)
  4. CI git-commits check fails
  5. attempt_ci_fix analyzes the failure, recognizes it's a commit message issue, but cannot fix it
  6. Workflow blocks after exhausting attempts

Observed CI errors

./check-commits 9013baa..e438ab0
error [1/2] title is longer than 72 characters, please make it shorter
error [1/2] title lacks a lowercase topic prefix (e.g. 'ipv6:')
error [1/2] 'Signed-off-by: Forge <forge@example.com>' trailer is missing
0/2 valid commits
make: *** [Makefile:47: check-commits] Error 1

Worker log

forge.workflow.nodes.ci_evaluator - ERROR - CI fix failed for OSPRH-32382: Git command failed: git commit -m [OSPRH-32382] fix: address CI failures (attempt 1) --author Forge <forge@example.com>
On branch forge/osprh-32382
nothing added to commit but untracked files present

Expected Behavior

attempt_ci_fix should be able to handle commit message formatting failures by:

  • Amending the last commit with a corrected message (if safe to do so)
  • Or squashing and rewriting commits with properly formatted messages
  • Or at minimum, detecting that the failure is a commit message issue (not a code issue) and providing a clear actionable error message to the user instead of exhausting retry attempts

Suggested Approaches

  1. Detect commit-message-only failures early: If CI log analysis determines the failure is purely about commit formatting (no code changes needed), use git commit --amend or git rebase to fix messages directly.

  2. Teach the container agent commit conventions: Include the target repo's commit message rules (from CI config or .commitlintrc) in the implementation prompt so Forge generates compliant messages from the start.

  3. Graceful degradation: If the fix requires commit amendment and the agent can't do it, immediately escalate with a specific message like "CI failed due to commit message format — please amend the commit message to match repository conventions" rather than exhausting all retry attempts with empty commits.

Context

Encountered while running the bug workflow on OSPRH-32382 against openstack-k8s-operators/openstack-network-exporter (PR #53). The repository's check-commits Makefile target enforces conventional commit format. Manual fix required squashing 2 commits into 1 with a compliant message and force-pushing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions