Problem
The single-owner commit attribution shipped in #692 enforces "each commit is credited to at most one session" per launch-directory string, not per repository. Two facts combine:
attributeCommits groups sessions into repo groups keyed by the raw project.projectPath string, and isGitRepo uses git rev-parse --is-inside-work-tree, which is true for ANY subdirectory of a repo (src/yield.ts, grouping block).
getCommitsInRange runs git log --all --since --until with no pathspec, so from any subdirectory it returns the identical repo-wide commit list.
So in a monorepo (sessions launched from repo/packages/a and repo/packages/b) or with git worktrees, the same underlying repository forms two independent groups, each pulls the full commit history, and the same commit is independently awarded once per group.
Repro (verified on the merged code)
Two sessions in one temp repo, launched from two subdirectories, one commit inside both windows: the commit is credited to a session in EACH group — one commit, two productive sessions, commitCount totals 2. The second "owner" is not even ambiguous, since it is the sole candidate within its own group. Three scenario variants reproduced; every existing test stays green because each test uses a single repo path per group.
Suggested fix
Key the repo groups by the canonical repository root — git rev-parse --show-toplevel (and --git-common-dir if worktrees should unify) — instead of the raw projectPath string. A regression test with two sessions launched from two subdirectories of one repo pins it.
Found during an independent review pass with adversarial verification; happy to provide the full repro scripts.
Problem
The single-owner commit attribution shipped in #692 enforces "each commit is credited to at most one session" per launch-directory string, not per repository. Two facts combine:
attributeCommitsgroups sessions into repo groups keyed by the rawproject.projectPathstring, andisGitRepousesgit rev-parse --is-inside-work-tree, which is true for ANY subdirectory of a repo (src/yield.ts, grouping block).getCommitsInRangerunsgit log --all --since --untilwith no pathspec, so from any subdirectory it returns the identical repo-wide commit list.So in a monorepo (sessions launched from
repo/packages/aandrepo/packages/b) or with git worktrees, the same underlying repository forms two independent groups, each pulls the full commit history, and the same commit is independently awarded once per group.Repro (verified on the merged code)
Two sessions in one temp repo, launched from two subdirectories, one commit inside both windows: the commit is credited to a session in EACH group — one commit, two
productivesessions,commitCounttotals 2. The second "owner" is not evenambiguous, since it is the sole candidate within its own group. Three scenario variants reproduced; every existing test stays green because each test uses a single repo path per group.Suggested fix
Key the repo groups by the canonical repository root —
git rev-parse --show-toplevel(and--git-common-dirif worktrees should unify) — instead of the rawprojectPathstring. A regression test with two sessions launched from two subdirectories of one repo pins it.Found during an independent review pass with adversarial verification; happy to provide the full repro scripts.