Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Conduit's git adapter cannot see commits that arrive via merge: a wall-clock cursor outruns the dates git filters on

Open schmetti-dev opened this issue 3 months ago • 1 comments

Conduit's git adapter gates on a wall-clock cursor and hands that cursor to git log --since, which filters on the commit's own dates. Those are two different clocks, and on any merge-based workflow they diverge permanently: a commit becomes reachable well after it was made, and by then the cursor has moved past its timestamp.

LIFEOS/PULSE/Conduit/adapters/git.ts:

const since =
  (state.lastGitPollTs as string) ||
  new Date(Date.now() - config.pollIntervalSec * 2000).toISOString();
...
execFileSync("git", ["-C", repo, "log", `--since=${since}`, "--no-merges", ...])
...
if (allOk) writeState({ lastGitPollTs: new Date().toISOString() });

The sequence

  1. A commit is made on a branch at T. git log in the checked-out repo cannot see it — the scan has no --all, so it only walks the current branch.
  2. A poll runs at T+1min, finds nothing, and advances the cursor to T+1min.
  3. The branch merges at T+2min. The commit is now reachable.
  4. The next poll asks --since=T+1min. The commit's own timestamp is T, which is behind the cursor. It is never seen again.

Under a PR-based workflow this is not an edge case, it's the normal path — every commit arrives through a merge. Observed effect on one install: one real commit in a day, zero git-commit events captured; over a week, dozens of commits across several repos counted as 0, while the Conduit tab reported "0 commits today" as a fact.

Committer date does not fix it

The obvious patch is to filter on %cI instead of %aI. It changes nothing: --since already filters the committer date, and for a commit created normally on a branch both fields hold the same instant. Checked on the commit above — %aI and %cI both read 09:28:19Z while the merge landed at 09:30:28Z.

Reproducible without any of this project:

git init -q -b main repo && cd repo
git commit -q --allow-empty -m base
GIT_AUTHOR_DATE=2026-08-27T09:28:19Z GIT_COMMITTER_DATE=2026-08-27T09:28:19Z \
  git checkout -q -b feature && git commit -q --allow-empty -m "branch work"
git checkout -q main && git merge -q --no-ff -m merge feature
git log --since=2026-08-27T09:29:00Z --no-merges --pretty=%s   # empty

Suggested shape

Two changes, both needed:

  • Scan --all. Work on a branch — including a branch checked out in a linked worktree, which shares the object database — is then visible while it is in flight, instead of only after a merge that immediately hides it.
  • Gate on a persisted set of emitted SHAs, not on time. The window becomes a cheap bound on how far back to look, and re-scanning is free because rollup.ts already de-dupes by SHA (seenSha, lines 58 and 71-73).

Two things that bit while implementing it, worth building in:

  • Seed the SHA set on first run, emitting nothing. Otherwise the first poll after the change treats the whole window as new and files weeks of history as today's work. That happened: 641 historical commits filed into a day that had 8.
  • Drop a commit whose day is already rolled up rather than clamping it to now. lazyRollUnrolledDays never re-rolls a closed day, and a tag like lateDays on the event does not stop the day's count from being wrong.

Verified on 7.40.4.

schmetti-dev avatar Aug 27 '26 20:08 schmetti-dev

Withdrawing this — the fix exists and belongs in a PR rather than a report. Sorry for the noise.

schmetti-dev avatar Aug 27 '26 20:08 schmetti-dev