Skip to content

fix(ai): support main branch diffing and base resolution in review branch #220

Closed

Description

@dan-petty

Problem Statement

When running devops ai review branch on the main branch, or when executing devops ai review branch main from another branch (e.g. release/v0.2.19), the CLI resolves branch_name="main" and effective_base="main". This causes git diff main...main to run, producing zero differences and immediately exiting with No differences found between branches.

Root Cause

_prepare_branch_content does not account for:

  1. Running devops review branch <base> from a different active branch where the positional argument specifies the base to compare against.
  2. Running review directly on the primary main branch, where comparison against main is a no-op instead of comparing uncommitted working tree changes against HEAD or comparing against the latest release tag / parent commit (main~1).

Proposed Fix

  1. Detect when target_branch == effective_base:
    • If current active branch differs from target_branch, interpret the argument as the target base and review the active branch against it.
    • If current active branch is main (or matching base), inspect uncommitted working tree changes (git diff HEAD).
    • If working tree is clean, fallback to comparing against the latest release tag or HEAD~1.
  2. Add comprehensive unit tests in tests/test_review_runner.py covering all branch resolution permutations.

Activity

  1. added this to the v0.2.19 milestone on Sep 16, 2026
  2. added
    type/bug
    scope/ai
    priority/p1-high
    on Sep 16, 2026
  3. added a commit that references this issue on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions