[GH-ISSUE #201] Git-AI Rebase Authorship Bug #77

Closed
opened 2026-03-02 04:11:40 +03:00 by kerem · 1 comment
Owner

Originally created by @AtnesNess on GitHub (Nov 7, 2025).
Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/201

Issue Summary

When rebasing a feature branch with mixed AI/Human authorship onto a main branch that has also modified the same file, git-ai loses the detailed line-level AI attribution.

Test Case

The test "rebase feature branch with mixed authorship onto diverged main" in tests/e2e/user-scenarios.bats demonstrates this issue.

Scenario

  1. Initial state: Both main and feature branches start at the same commit
  2. Feature branch: Creates a commit with mixed authorship
    • Human adds 3 lines (function signature + comment)
    • AI adds 4 lines (implementation logic)
    • Both modify app.py in the "Data processing section"
  3. Main branch: Creates 3 commits modifying the same file (app.py)
    • All 3 commits add utility functions in the "Utility functions section"
  4. Rebase: Feature branch is rebased onto updated main branch

Expected Behavior

After rebase, the authorship stats should remain identical:

{
  "human_additions": 3,
  "ai_additions": 4,
  "ai_accepted": 4,
  "total_ai_additions": 4
}

Actual Behavior

After rebase, AI contributions are misattributed as human:

{
  "human_additions": 7,  // ❌ Should be 3
  "ai_additions": 0,     // ❌ Should be 4
  "ai_accepted": 0,      // ❌ Should be 4
  "total_ai_additions": 4  // ✅ Correctly preserved in tool_model_breakdown
}

Analysis

What's Working

  • The rebase completes successfully without conflicts
  • All code changes are correctly applied to the final file
  • total_ai_additions is preserved in tool_model_breakdown
  • Git-ai detects that a rebase occurred

What's Broken

  • Line-level AI attribution is lost
  • All 7 added lines are attributed to human instead of split 3/4
  • ai_additions and ai_accepted become 0

Reproducing the Bug

Fetch code from https://github.com/acunniffe/git-ai/pull/200

bats tests/e2e/user-scenarios.bats -f "rebase feature branch with mixed authorship onto diverged main"
Originally created by @AtnesNess on GitHub (Nov 7, 2025). Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/201 ## Issue Summary When rebasing a feature branch with mixed AI/Human authorship onto a main branch that has also modified the same file, **git-ai loses the detailed line-level AI attribution**. ## Test Case The test `"rebase feature branch with mixed authorship onto diverged main"` in `tests/e2e/user-scenarios.bats` demonstrates this issue. ## Scenario 1. **Initial state**: Both `main` and `feature` branches start at the same commit 2. **Feature branch**: Creates a commit with mixed authorship - Human adds 3 lines (function signature + comment) - AI adds 4 lines (implementation logic) - Both modify `app.py` in the "Data processing section" 3. **Main branch**: Creates 3 commits modifying the same file (`app.py`) - All 3 commits add utility functions in the "Utility functions section" 4. **Rebase**: Feature branch is rebased onto updated main branch ## Expected Behavior After rebase, the authorship stats should remain identical: ```json { "human_additions": 3, "ai_additions": 4, "ai_accepted": 4, "total_ai_additions": 4 } ``` ## Actual Behavior After rebase, AI contributions are misattributed as human: ```json { "human_additions": 7, // ❌ Should be 3 "ai_additions": 0, // ❌ Should be 4 "ai_accepted": 0, // ❌ Should be 4 "total_ai_additions": 4 // ✅ Correctly preserved in tool_model_breakdown } ``` ## Analysis ### What's Working - ✅ The rebase completes successfully without conflicts - ✅ All code changes are correctly applied to the final file - ✅ `total_ai_additions` is preserved in `tool_model_breakdown` - ✅ Git-ai detects that a rebase occurred ### What's Broken - ❌ Line-level AI attribution is lost - ❌ All 7 added lines are attributed to human instead of split 3/4 - ❌ `ai_additions` and `ai_accepted` become 0 ## Reproducing the Bug Fetch code from https://github.com/acunniffe/git-ai/pull/200 ```bash bats tests/e2e/user-scenarios.bats -f "rebase feature branch with mixed authorship onto diverged main" ```
kerem closed this issue 2026-03-02 04:11:41 +03:00
Author
Owner

@acunniffe commented on GitHub (Nov 8, 2025):

Great find. Fixed

<!-- gh-comment-id:3506786109 --> @acunniffe commented on GitHub (Nov 8, 2025): Great find. Fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#77
No description provided.