Skip to content

implement_review creates new commits instead of amending existing ones #253

Description

@abhiramnarayana

Problem

When Forge addresses PR review feedback via the implement_review node, it creates a new commit (e.g., [TICKET] review: address PR feedback) rather than amending the existing commit or squashing before push.

This breaks repositories that validate every commit in a PR individually (e.g., requiring topic prefixes, character limits, Signed-off-by on each commit). The review-fix commit:

  1. Uses [TICKET] review: address PR feedback format — violates topic prefix requirements
  2. Lacks Signed-off-by trailer
  3. Has no relation to the project's commit message conventions

Observed Behavior

  1. Forge creates PR with properly formatted commit (e.g., openflow: fix multi-part reply and drain pending msgs)
  2. Reviewer requests minor changes (e.g., "remove unnecessary empty line")
  3. Forge's implement_review correctly fixes the code but pushes as a second commit: [OSPRH-32382] review: address PR feedback
  4. CI git-commits check fails because the new commit violates formatting rules
  5. Manual intervention required to squash and force-push

Root Cause

The implement-review-fix.md prompt explicitly instructs the container agent to create a new commit:

git commit -m "[{ticket_key}] review: address PR feedback"

There is no mechanism to amend the existing commit or squash before push.

Expected Behavior

Forge should either:

  1. Amend the existing commit (git commit --amend) to incorporate review fixes, preserving the original commit message format
  2. Or squash all commits into one before pushing, using the original commit's message
  3. Or at minimum, follow the target repo's commit message conventions for the new commit (read from CONTRIBUTING.md, check-commits script, etc.)

Related

Files Involved

  • src/forge/prompts/v1/implement-review-fix.md (line 15: hardcoded commit format)
  • src/forge/workflow/nodes/implement_review.py (orchestrates the review fix flow)

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