Skip to content

fix(projects): rank git remote identity above cached avatar icon (#21515) - #21881

Closed
bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/21515-stale-repo-icon-git-remote-identity
Closed

bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/21515-stale-repo-icon-git-remote-identity

Conversation

@bbingz

@bbingz bbingz commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

ELI5

When a repository is renamed or transferred to an organization on GitHub, Orca's periodic remote probe updates the git remote identity, but project grouping still preferred a stale cached avatar icon from when the repository was first added. This caused different machines to group the same codebase under different project names in the sidebar. Now, the live git remote identity takes precedence over the cached avatar icon.

What Changed

  • Before: In getProjectProviderIdentity, a cached GitHub avatar icon (repo.repoIcon.label) was checked before gitRemoteIdentity. If a repository was transferred or renamed on GitHub, the periodic remote probe updated gitRemoteIdentity correctly, but repo.repoIcon was never refreshed. The stale cached label won the precedence check, locking the project identity to the old repository slug and splitting worktrees across hosts.
  • After: gitRemoteIdentity is evaluated before falling back to repo.repoIcon. Since gitRemoteIdentity is derived directly from the repository's git remotes and refreshed periodically, it accurately reflects renames and transfers. The avatar icon continues to serve as a reliable fallback for repositories without a probed remote.
  • Mechanism: Reordered the resolution in getProjectProviderIdentity (src/shared/project-host-setup-projection.ts) so that fromRemote is evaluated immediately after explicit repo.upstream, before falling back to repo.repoIcon.

Why

Fixes #21515. The avatar icon is a presentation artifact that was only ever intended as a fallback when upstream or gitRemoteIdentity had not yet been backfilled. Prioritizing the authoritative, probed git remote prevents projects from permanently fragmenting across hosts after a repository rename or organization transfer.

Linked Issue

Fixes #21515

Visual Proof

N/A - Project identity and catalog projection logic with no layout or CSS changes.

Testing

  • Added unit test in src/shared/project-host-setup-projection.test.ts verifying that gitRemoteIdentity outranks a stale cached avatar icon.

  • Verified all 33 tests in src/shared/project-host-setup-projection.test.ts and cross-host project collision test suites pass.

  • Verified all quality gates and typechecks (check-changed-code-quality.mjs, check-max-lines-ratchet.mjs, tc:cli, tc:node, tc:web).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

  • Antigravity 2.0 (Gemini 2.5 Pro)

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No breaking changes or API alterations. Fully backwards-compatible.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f03d96d5-3a29-41e3-8a65-14b05785133a

📥 Commits

Reviewing files that changed from the base of the PR and between e476193 and e311013.

📒 Files selected for processing (2)
  • src/shared/project-host-setup-projection.test.ts
  • src/shared/project-host-setup-projection.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

getProjectProviderIdentity now checks gitRemoteIdentity before repoIcon. It parses the remote URL or canonical key and returns that GitHub identity when available. The previous final remote-identity fallback is replaced with return null. A test verifies that a refreshed remote for github.com/org-b/app overrides a cached owner-a/app icon label.

Priority: ➖ Normal

Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: prioritizing git remote identity over a cached avatar icon.
Description check ✅ Passed The description is complete and focused. It explains the problem, behavior before and after, implementation, rationale, linked issue, testing, visual proof, and checklist status.
Linked Issues check ✅ Passed The change satisfies #21515. getProjectProviderIdentity now parses gitRemoteIdentity.remoteUrl, then canonicalKey, before the cached GitHub repoIcon label. This makes the refreshed remote iden…
Out of Scope Changes check ✅ Passed The changes stay within #21515. They modify project identity precedence and add focused regression coverage. No unrelated behavior or API changes are shown.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — reviewed the full 2-file diff at e311013.

  • Remote-over-avatar precedence (src/shared/project-host-setup-projection.ts): getProjectProviderIdentity now evaluates the probed gitRemoteIdentity (remoteUrl, then canonicalKey) immediately after explicit repo.upstream, and only then falls back to the cached GitHub avatar label. A renamed or transferred repo therefore resolves to the live remote slug instead of the stale repoIcon.label. Non-GitHub remotes still fall through to the icon, and the remoteUrl-before-canonicalKey ordering that preserves GHES HTTP ports is unchanged.
  • Regression test (src/shared/project-host-setup-projection.test.ts): a repo carrying a pre-transfer avatar label (owner-a/app) plus a post-transfer gitRemoteIdentity (github.com/org-b/app) must project to github:org-b/app. This genuinely fails under the old ordering, so it pins the fix rather than restating it.

I verified the precedence interactions: repo.upstream (the fork parent) still wins first, so forks with a resolved upstream are unaffected; for repos without one, gitRemoteIdentity derives from the same remote topology (deriveGitRemoteIdentity prefers the upstream remote, matching the upstream rule). Ran vitest run src/shared/project-host-setup-projection.test.ts — 33 passed.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Closing as superseded by merged #22421, which carries the reviewed fix and regression coverage. Thank you for the original contribution. The merged approach repairs automatic metadata at its owning host rather than changing identity precedence across mixed client/host versions.

@nwparker nwparker closed this Sep 26, 2026
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.

[Bug]: Stale repoIcon label outranks the re-probed git remote in project identity — renames and transfers permanently split one project across hosts

2 participants