Skip to content

Conversation

@mm-zacharydavison
Copy link
Contributor

@mm-zacharydavison mm-zacharydavison commented Nov 25, 2025

I'm not 100% sure how this occurred in our repo, but I've got cases whereby we have attestations in a git-ai note for a commit, but no prompts, which causes git-ai stats to give the wrong stats:

❯ git notes --ref=ai show f7dea7ffa83838d774e4deaac0bb653e16ff5f8a                                                                                11:02:23
apps/server/src/mcp/mcp-jwt.guard.spec.ts
  10d7219 24,83,90
apps/server/src/mcp/mcp-jwt.guard.ts
  10d7219 62
---
{
  "schema_version": "authorship/3.0.0",
  "git_ai_version": "1.0.21",
  "base_commit_sha": "f7dea7ffa83838d774e4deaac0bb653e16ff5f8a",
  "prompts": {}
}

❯ git-ai stats f7dea7ffa83838d774e4deaac0bb653e16ff5f8a                                                                                           11:02:30
you  ████████████████████████████████████████ ai
     100%                                   0%

This PR fixes this bug by trying to resolve foreign prompts (inspired by how virtual_attestations.rs does it).

I'm not entirely sure if this shouldn't be root-cause fixed elsewhere, i'm not sure how this could happen (but most likely it's squash flow, this came from a Github PR that was squashed).

However, since the performance impact only hits if this situation happens, and only in the git-ai stats workflow, I think it's a safe precaution to add.

after fix:

apps/server/src/mcp/mcp-jwt.guard.spec.ts
  10d7219 24,83,90
apps/server/src/mcp/mcp-jwt.guard.ts
  10d7219 62
---
{
  "schema_version": "authorship/3.0.0",
  "git_ai_version": "1.0.21",
  "base_commit_sha": "f7dea7ffa83838d774e4deaac0bb653e16ff5f8a",
  "prompts": {}
}

❯ git-ai stats f7dea7ffa8                                                                                                                  12:14:15
[git-ai] Stats command found commit: f7dea7ffa83838d774e4deaac0bb653e16ff5f8a refname: f7dea7ffa8
[git-ai] Resolving 1 foreign prompts for stats calculation
[git-ai] Found foreign prompt 10d7219 in note path d3/5e2f2e862b8d7b4730263ee384936ee97b20a6
you  ██████████████████████████████████░░░░░░ ai
     86%                                  14%
     100% AI code accepted | waited 3m for ai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant