Skip to content

fix(importer): preserve repository attribution across import and watch - #11

Merged
tobilg merged 1 commit into
mainfrom
fix/session-repository-attribution
Sep 15, 2026
Merged

tobilg merged 1 commit into
mainfrom
fix/session-repository-attribution

Conversation

@tobilg

@tobilg tobilg commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Claude Code and Codex watch records currently lose repository attribution that full imports provide, and Codex transcript/tool logs omit the repository carried by their token metrics. Share session attribution between both paths so logs and usage metrics carry repository and the recorded git_branch when available. This follows up on #7 and #8.

Changes

  • Persist repository context with watcher state, including discovered local remotes. Recover context from the committed file prefix when upgrading old state or starting after a full import/without backfill; preserve offsets, message indices, and usage baselines without emitting old records.
  • Enrich every Codex log category, including user/agent events, transcript messages, tool calls/results, and reasoning logs, alongside token/cost metrics.
  • Connect repository-reference mining to supported message/result text and shell inputs. Recognize GitHub URLs and literal gh pr --repo/-R arguments using shell parsing without executing commands. Recorded Git URLs and local remotes retain precedence; ambiguous candidates fall back to the directory name or remain unset. References do not create activity metrics.
  • Document supported evidence, exclusions, precedence, restart behavior, and historical-data limits in the README and import guide. Remove the unused PR-action/number extraction fields from the reference helper.

Validation

  • GitHub CI passed for 7b3a9ad: tests, Linux/macOS/Windows builds, and the full backend race suite on macOS.
  • Local Go 1.26.8 on macOS arm64: go vet ./... and the importer/watcher race suites passed.
  • Regression coverage includes full-import/watch parity, state round-trips and restarts, legacy/no-backfill recovery without duplicate usage, cancellation, partial JSON writes, late references, all seven Codex log categories, Git worktrees, missing Git, persisted local remotes, credential stripping, reference syntax, precedence, ambiguous owners, and excluded evidence.

Behavior to review

Full imports can use evidence anywhere in a file. Watch mode enriches each new batch using evidence available through that batch and saves context for later batches. Existing database records are not rewritten when a later reference improves attribution. Claude activity metrics remain full-import-only.

@tobilg
tobilg merged commit 41ae247 into main Sep 15, 2026
8 checks passed
@tobilg
tobilg deleted the fix/session-repository-attribution branch September 15, 2026 09:31
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