Skip to content

Make --repo mirror paths collision-safe for distinct owner/name pairs #184

Description

@AetherAI3

Problem

Two different valid GitHub repository names can resolve to the same local mirror directory. On main at 67cb640, localMirrorDir joins owner and repository with one -:

a-b/c   -> ~/.aether-agent/repos/a-b-c
a/b-c   -> ~/.aether-agent/repos/a-b-c

Both names pass parseRepoSpec. After the first is cloned, ensureLocalClone finds .git at the shared path. Its origin check correctly refuses to use the wrong repository, but the second repository can no longer be used through --repo on that machine.

Expected behavior

Every distinct valid owner/name pair has a distinct mirror location. An existing legacy mirror remains usable for its own repository, and a collision never overwrites or borrows it.

Acceptance criteria

  • Replace the ambiguous owner/name flattening with an injective, path-safe mapping for new mirrors; preserve repo identity across Windows and POSIX path semantics.
  • For a legacy owner-name directory, validate its origin before reuse. If it belongs to another repository with the same flattened name, use the new distinct location rather than failing or overwriting the legacy mirror.
  • Keep the existing wrong-origin refusal for any directory chosen for a repository. Do not delete, reset, or silently move a mirror with local work.
  • Add tests for a-b/c versus a/b-c in both access orders, same-repo legacy reuse, and a mismatched origin at the new location.

Scope

This fixes mirror identity for aether agent --repo. It does not add a general cache manager or alter the user's GitHub authentication.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions