[GH-ISSUE #612] Cursor v2.5.26 edits show 0% AI attribution despite hooks completing successfully #196

Closed
opened 2026-03-02 04:12:48 +03:00 by kerem · 4 comments
Owner

Originally created by @abhinavn on GitHub (Feb 28, 2026).
Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/612

Summary

Edits made by Cursor (both Agent/Composer and Tab completion) are attributed as 100% human in git-ai stats, even when:

  • Cursor hooks fire and log "Checkpoint completed"
  • The git-ai wrapped git binary is used for commits
  • git-ai install-hooks has been run

Environment

  • OS: macOS
  • Cursor: 2.5.26
  • git-ai: 1.1.7
  • Git binary: ~/.git-ai/bin/git (verified via which git)

Steps to Reproduce

  1. Open a repo in Cursor with git-ai installed
  2. Run git-ai install-hooks
  3. Make edits via either:
    • Agent/Composer (Cmd+I) — accept AI-generated code
    • Tab completion — accept inline suggestions
  4. Commit via terminal: git add . && git commit -m "Test"
  5. Run git-ai stats HEAD --json

Expected

ai_additions > 0 and tool_model_breakdown populated for AI-generated edits.

Actual

{"human_additions":4,"mixed_additions":0,"ai_additions":0,"ai_accepted":0,"total_ai_additions":0,"total_ai_deletions":0,"time_waiting_for_ai":0,"git_diff_deleted_lines":0,"git_diff_added_lines":4,"tool_model_breakdown":{}}

All added lines are attributed to human.

What Works

  • Hooks fire: Cursor Output → Hooks shows afterFileEdit running and logging "Checkpoint completed"

Sanitized Hooks Log (Cmd+Shift+P → Output → Hooks)

afterFileEdit — success (Checkpoint completed)
Command: ~/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin (566ms) exit code: 0

INPUT:
{
  "conversation_id": "[uuid]",
  "generation_id": "[uuid]",
  "model": "composer-1.5",
  "file_path": "/Users/[user]/Git/git-ai-demo/src/sections/time_trends.py",
  "edits": [{"old_string": "...", "new_string": "..."}],
  "hook_event_name": "afterFileEdit",
  "cursor_version": "2.5.26",
  "workspace_roots": ["/Users/[user]/Git/git-ai-demo"]
}

STDERR:
ai_agent cursor changed 1 of the 2 file(s) that have changed since the last commit (1 already checkpointed)
Checkpoint completed in 289.78225ms
preToolUse — Claude preset error (cwd not found)
STDERR: Claude preset error: cwd not found in hook_input
  • Correct git: which git returns ~/.git-ai/bin/git
  • Hook config: ~/.cursor/hooks.json contains:
    {
      "hooks": {
        "afterFileEdit": [{"command": "/Users/<user>/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin"}],
        "beforeSubmitPrompt": [{"command": "/Users/<user>/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin"}]
      },
      "version": 1
    }
    

Additional Context

  • Both flows fail: Agent edits and Tab completion edits both show 0% AI
  • v1.1.7: Upgraded from 1.1.6 to test the UTF-8 BOM fix; issue persists
  • Claude preset: preToolUse/postToolUse hooks (from ~/.claude/settings.json) error with "cwd not found in hook_input" — those were disabled; Cursor hooks run without error
Originally created by @abhinavn on GitHub (Feb 28, 2026). Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/612 ## Summary Edits made by Cursor (both Agent/Composer and Tab completion) are attributed as 100% human in `git-ai stats`, even when: - Cursor hooks fire and log "Checkpoint completed" - The git-ai wrapped `git` binary is used for commits - `git-ai install-hooks` has been run ## Environment - **OS:** macOS - **Cursor:** 2.5.26 - **git-ai:** 1.1.7 - **Git binary:** `~/.git-ai/bin/git` (verified via `which git`) ## Steps to Reproduce 1. Open a repo in Cursor with git-ai installed 2. Run `git-ai install-hooks` 3. Make edits via either: - **Agent/Composer** (Cmd+I) — accept AI-generated code - **Tab completion** — accept inline suggestions 4. Commit via terminal: `git add . && git commit -m "Test"` 5. Run `git-ai stats HEAD --json` ## Expected `ai_additions > 0` and `tool_model_breakdown` populated for AI-generated edits. ## Actual ```json {"human_additions":4,"mixed_additions":0,"ai_additions":0,"ai_accepted":0,"total_ai_additions":0,"total_ai_deletions":0,"time_waiting_for_ai":0,"git_diff_deleted_lines":0,"git_diff_added_lines":4,"tool_model_breakdown":{}} ``` All added lines are attributed to human. ## What Works - **Hooks fire:** Cursor Output → Hooks shows `afterFileEdit` running and logging "Checkpoint completed" ### Sanitized Hooks Log (Cmd+Shift+P → Output → Hooks) <details> <summary>afterFileEdit — success (Checkpoint completed)</summary> ``` Command: ~/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin (566ms) exit code: 0 INPUT: { "conversation_id": "[uuid]", "generation_id": "[uuid]", "model": "composer-1.5", "file_path": "/Users/[user]/Git/git-ai-demo/src/sections/time_trends.py", "edits": [{"old_string": "...", "new_string": "..."}], "hook_event_name": "afterFileEdit", "cursor_version": "2.5.26", "workspace_roots": ["/Users/[user]/Git/git-ai-demo"] } STDERR: ai_agent cursor changed 1 of the 2 file(s) that have changed since the last commit (1 already checkpointed) Checkpoint completed in 289.78225ms ``` </details> <details> <summary>preToolUse — Claude preset error (cwd not found)</summary> ``` STDERR: Claude preset error: cwd not found in hook_input ``` </details> - **Correct git:** `which git` returns `~/.git-ai/bin/git` - **Hook config:** `~/.cursor/hooks.json` contains: ```json { "hooks": { "afterFileEdit": [{"command": "/Users/<user>/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin"}], "beforeSubmitPrompt": [{"command": "/Users/<user>/.git-ai/bin/git-ai checkpoint cursor --hook-input stdin"}] }, "version": 1 } ``` ## Additional Context - **Both flows fail:** Agent edits and Tab completion edits both show 0% AI - **v1.1.7:** Upgraded from 1.1.6 to test the UTF-8 BOM fix; issue persists - **Claude preset:** `preToolUse`/`postToolUse` hooks (from `~/.claude/settings.json`) error with "cwd not found in hook_input" — those were disabled; Cursor hooks run without error
kerem closed this issue 2026-03-02 04:12:48 +03:00
Author
Owner

@abhinavn commented on GitHub (Feb 28, 2026):

I have a reproducible data-loss case: checkpoint AI lines are present, but git-ai stats reports zero AI for the same commit SHA.

Repro Environment

  • Cursor: 2.5.26
  • macOS
  • Commits made during Cursor editing sessions
  • Checkpoint logs exist under .git/ai/working_logs/<sha>/checkpoints.jsonl

Validation Method

For each SHA, I compared:

  1. cp_ai_additions = sum of line_stats.additions from AI checkpoints in .git/ai/working_logs/<sha>/checkpoints.jsonl
  2. git-ai stats <sha> --json

Output

{'sha': '93f68032', 'commit_exists': True, 'cp_ai_checkpoints': 2, 'cp_ai_additions': 2, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2}
{'sha': '922102fe', 'commit_exists': True, 'cp_ai_checkpoints': 2, 'cp_ai_additions': 2, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2}
{'sha': 'bb4b30c5', 'commit_exists': True, 'cp_ai_checkpoints': 0, 'cp_ai_additions': 0, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2}
{'sha': '7273a8ce', 'commit_exists': True, 'cp_ai_checkpoints': 3, 'cp_ai_additions': 6, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 4}
{'sha': '1a9845d0', 'commit_exists': True, 'cp_ai_checkpoints': 6, 'cp_ai_additions': 168, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 6}

Expected

If checkpoint logs for the same SHA contain AI additions, git-ai stats <sha> should not report all-zero AI.

Actual

git-ai stats reports zero AI even when checkpoint logs contain non-zero AI additions.

Interpretation

AI attribution appears to be lost between checkpoint capture and commit-level authorship attachment/condensing.

<!-- gh-comment-id:3976553132 --> @abhinavn commented on GitHub (Feb 28, 2026): I have a reproducible data-loss case: checkpoint AI lines are present, but `git-ai stats` reports zero AI for the same commit SHA. ### Repro Environment - Cursor: `2.5.26` - macOS - Commits made during Cursor editing sessions - Checkpoint logs exist under `.git/ai/working_logs/<sha>/checkpoints.jsonl` ### Validation Method For each SHA, I compared: 1. `cp_ai_additions` = sum of `line_stats.additions` from AI checkpoints in `.git/ai/working_logs/<sha>/checkpoints.jsonl` 2. `git-ai stats <sha> --json` ### Output ```python {'sha': '93f68032', 'commit_exists': True, 'cp_ai_checkpoints': 2, 'cp_ai_additions': 2, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2} {'sha': '922102fe', 'commit_exists': True, 'cp_ai_checkpoints': 2, 'cp_ai_additions': 2, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2} {'sha': 'bb4b30c5', 'commit_exists': True, 'cp_ai_checkpoints': 0, 'cp_ai_additions': 0, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 2} {'sha': '7273a8ce', 'commit_exists': True, 'cp_ai_checkpoints': 3, 'cp_ai_additions': 6, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 4} {'sha': '1a9845d0', 'commit_exists': True, 'cp_ai_checkpoints': 6, 'cp_ai_additions': 168, 'stats_total_ai_additions': 0, 'stats_ai_additions': 0, 'stats_ai_accepted': 0, 'stats_human_additions': 6} ``` ### Expected If checkpoint logs for the same SHA contain AI additions, `git-ai stats <sha>` should not report all-zero AI. ### Actual `git-ai stats` reports zero AI even when checkpoint logs contain non-zero AI additions. ### Interpretation AI attribution appears to be lost between checkpoint capture and commit-level authorship attachment/condensing.
Author
Owner

@abhinavn commented on GitHub (Feb 28, 2026):

@svarlamov Appreciate your thoughts on this, thanks!

<!-- gh-comment-id:3976553976 --> @abhinavn commented on GitHub (Feb 28, 2026): @svarlamov Appreciate your thoughts on this, thanks!
Author
Owner

@svarlamov commented on GitHub (Feb 28, 2026):

Hey @abhinavn sorry to hear you're running into this issue! I just tested with the latest Cursor on Mac OS, and wasn't able to replicate. Since it looks like you're getting correct working logs, I don't think this is Cursor-related.

Could you try out the following and share the output?

  1. git ai show <sha> - Can you please share this for each commit that you believe has incorrect data?
  2. git ai diff <sha> - Can you please share this for each commit that you believe has incorrect data?
  3. Once you've made some changes, set export GIT_AI_DEBUG=1 and then share the output you see when you run git commit after making some changes in Cursor
  4. If you have some working logs, could you zip them up and share them? Happy to receive over email if you'd prefer to share privately (sasha at usegitai dot com)
<!-- gh-comment-id:3977434906 --> @svarlamov commented on GitHub (Feb 28, 2026): Hey @abhinavn sorry to hear you're running into this issue! I just tested with the latest Cursor on Mac OS, and wasn't able to replicate. Since it looks like you're getting correct working logs, I don't think this is Cursor-related. Could you try out the following and share the output? 1. `git ai show <sha>` - Can you please share this for each commit that you believe has incorrect data? 2. `git ai diff <sha>` - Can you please share this for each commit that you believe has incorrect data? 3. Once you've made some changes, set `export GIT_AI_DEBUG=1` and then share the output you see when you run `git commit` after making some changes in Cursor 4. If you have some working logs, could you zip them up and share them? Happy to receive over email if you'd prefer to share privately (sasha at usegitai dot com)
Author
Owner

@abhinavn commented on GitHub (Mar 1, 2026):

hey @svarlamov, sorry for not posting update. I was able to figure out the cause. This was a local hook/config issue (conflicting/broken hook paths causing missing refs/notes/ai), not a git-ai core bug; after clean hook reinstall and hook cleanup, new commits correctly report AI attribution. I am going to close this as NOT ISSUE. thanks for your attention!

<!-- gh-comment-id:3978770529 --> @abhinavn commented on GitHub (Mar 1, 2026): hey @svarlamov, sorry for not posting update. I was able to figure out the cause. This was a local hook/config issue (conflicting/broken hook paths causing missing refs/notes/ai), not a git-ai core bug; after clean hook reinstall and hook cleanup, new commits correctly report AI attribution. I am going to close this as NOT ISSUE. thanks for your attention!
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#196
No description provided.