Skip to content

feat(importer): add repository attribution from session metadata#7

Open
jmelloy wants to merge 1 commit into
tobilg:mainfrom
jmelloy:pr-repository-attribution
Open

feat(importer): add repository attribution from session metadata#7
jmelloy wants to merge 1 commit into
tobilg:mainfrom
jmelloy:pr-repository-attribution

Conversation

@jmelloy

@jmelloy jmelloy commented Jun 12, 2026

Copy link
Copy Markdown

Summary

Adds repository attribution for imported Claude Code and Codex sessions.

  • Resolve repositories from structured Claude pr-link metadata, Codex session_meta.git.repository_url, on-disk git remotes, cwd/worktree paths, and mined GitHub references.
  • Attach repository, git_branch, and PR metadata to existing Claude transcript/API logs and token/cost metrics.
  • Add shared repository resolution helpers and focused importer coverage.

Impact

Imported telemetry can now be grouped by repository more reliably, including worktree sessions and directories whose local name differs from the remote repository.

Validation

  • GOROOT=/opt/homebrew/Cellar/go/1.26.1/libexec go test ./internal/importer

Note: plain go test currently fails locally because go reports 1.26.1 while GOROOT is set to a mise 1.24.0 install.

@jmelloy jmelloy marked this pull request as ready for review June 12, 2026 20:17
@tobilg

tobilg commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Hey, thanks for the PR! I pushed some changes on main today, could you eventually rebase?

@jmelloy jmelloy force-pushed the pr-repository-attribution branch from b980196 to da54339 Compare June 16, 2026 03:04
@tobilg

tobilg commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Thanks for putting this together. The direction makes sense to me: repository attribution would be valuable for AI Observer because it enables repo-level filtering, reporting, and analysis for imported Claude/Codex sessions.

I reviewed the current diff and I don’t think it’s quite merge-ready yet. A few things I’d like to see addressed first:

  • The branch is currently behind main, and the latest CI run is action_required, so this should be rebased and validated with a green CI run before merge.
  • The PR description mentions mining GitHub references, and extractRefs implements parsing for that, but I couldn’t find it wired into the Claude or Codex import flow. As-is, free-text GitHub URLs or gh pr --repo style references won’t affect attribution. Either wiring that in or narrowing the stated behavior would make this clearer.
  • Repository attribution appears to apply to historical/full imports only. The exported helper functions used by incremental/watch flows still pass empty repository metadata, so users may see inconsistent data depending on whether records came from import or watch mode. If that’s intentional, I think we should call it out; otherwise the watch path should be included too.
  • The new repository resolver logic is substantial and could use more direct test coverage. I’d especially like tests for Codex session_meta.git.repository_url, SSH/HTTPS GitHub URLs, PR URLs, --repo parsing if supported, cwd fallback, worktree paths, and missing/failing git remotes.

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.

2 participants