Skip to content

Repos deleted, renamed or transferred on GitHub are never pruned; a rename leaves a ghost entry and offers to clone a second copy #469

Description

@matt-edmondson

What's wrong

SyncGitHubRepoInfoForOwner (ProjectDirector/ProjectDirector.cs ~L997-1035) only ever adds or overwrites entries in Options.Repos (~L1020). Nothing removes an entry once GitHub stops returning it. The only removal in the codebase is RejectUnsupportedRepos, which handles non-GitHub repo types.

Failure scenarios

  • Rename: owner/Foo is cloned at <dev>/owner/Foo and then renamed upstream to Bar. On the next Scan > GitHub Owners, owner.Bar is added with LocalPath = <dev>/owner/Bar. That path isn't cloned, so its panel offers Clone. Meanwhile the old owner.Foo entry stays, still holds the clone, and is still auto-fetched. The owner now lists both. Clicking Clone on Bar makes a second full copy of the same repo, and from then on Similar Repos and file propagation compare and propagate against both copies.
  • Delete or transfer: the repo stays listed under its old owner, shows up in every Similar Repos table and as a propagation target, and Clone fails with Repository not found every time.

Suggested fix

  1. After an owner's listing fully succeeds (never on an ApiException or a partial result), find the Options.Repos entries for that OwnerName that the listing didn't return.
    • Remove the ones that aren't cloned.
    • Keep the ones that are cloned, and log "<name> is no longer on GitHub (deleted, renamed or transferred); local clone at <path> kept". Optionally pair a kept clone with its renamed entry by comparing git remote get-url origin to the new CloneUrl, since GitHub redirects old URLs.
  2. Clear BaseRepo/CompareRepo if either names a removed entry. ClearSelectionIfRejected can be reused for this.

Acceptance criteria

  • Rescanning after an upstream delete removes the uncloned entry.
  • After an upstream rename, no stale uncloned entry remains, and any cloned entry that was kept is reported in the log.
  • A failed or partial listing prunes nothing.
  • A test covers pruning, keeping a cloned entry, and the failed-listing case.

Activity

  1. matt-edmondson commented on Oct 6, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    • Category: Bug
    • Priority: Medium. A stale entry offers to clone a duplicate copy and gets included in Similar Repos and file propagation. Nothing is corrupted, but it only happens after a repo upstream is renamed, deleted or transferred, so it is occasional.
    • Area / suggested owner: GitHub owner sync (SyncGitHubRepoInfoForOwner in ProjectDirector/ProjectDirector.cs).
    • Duplicates / in progress: Not a duplicate. No open PR covers it.

    Generated by Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions