Skip to content

fix(agents): resolve repository from git remote origin for accurate metrics#231

Open
BolotnyaBoss wants to merge 1 commit intocodemie-ai:mainfrom
BolotnyaBoss:fix-remote-repository-usage
Open

fix(agents): resolve repository from git remote origin for accurate metrics#231
BolotnyaBoss wants to merge 1 commit intocodemie-ai:mainfrom
BolotnyaBoss:fix-remote-repository-usage

Conversation

@BolotnyaBoss
Copy link
Contributor

Summary

  • Add detectGitRemoteRepo() utility to extract canonical owner/repo from git remote origin URL (supports HTTPS and SSH formats)
  • Store the resolved repository in session.repository (set only when a remote is detected; undefined otherwise)
  • Use session.repository in metrics sender and aggregator, falling back to filesystem-derived path when not set

Why

Repository names derived from filesystem paths (e.g. /Users/name/myorg/my-repomyorg/my-repo) can be inaccurate when the directory structure doesn't match the actual GitHub/GitLab owner and repo name. Using git remote get-url origin provides the canonical identifier.

Test plan

  • Start a session in a repo with a git remote — verify metrics report the correct owner/repo
  • Start a session in a directory with no git remote — verify fallback to filesystem derivation works and no errors occur
  • Verify SSH remotes (git@github.com:owner/repo.git) parse correctly

…etrics

Detect canonical owner/repo from git remote origin URL (HTTPS and SSH)
instead of deriving it from the filesystem path. Stores the result in
session.repository and uses it in metrics, falling back to filesystem
derivation when no remote is configured.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
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