Skip to content

fix(projects): refresh stale automatic GitHub icons during enrichment - #22421

Merged
nwparker merged 4 commits into
mainfrom
nwparker/external-21881-project-identity
Sep 26, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/external-21881-project-identity

Conversation

@nwparker

@nwparker nwparker commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​328 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​314
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​75 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​56

ELI5

A confirmed GitHub remote refresh also repairs an old automatically selected project icon.

What Changed

The existing identity enrichment producer updates GitHub-source automatic icons after a resolved GitHub probe, including when the canonical key is already current. It preserves explicit upstream, custom/cleared icons, unresolved SSH aliases, provider-neutral remotes, folder workspaces and host/path ownership.

Why

Repair stored automatic metadata through the existing producer. Reordering project identity precedence would change IDs across mixed client/host versions and regress unresolved SSH aliases. This patch keeps that projection unchanged and adds no new polling.

Linked Issue

Related to #21515, #21881 and #21890. Reported by @mmarabel; @bbingz supplied the alternative proposals evaluated here. This does not follow GitHub redirects, rewrite origin, or claim to solve every transfer/rename case. Moving a remote from GitHub to another provider deliberately leaves its stored icon unchanged; that transition is outside this bounded repair.

Visual Proof

N/A — this is a host metadata enrichment change with no renderer, layout or interaction change. Controlled producer/projection fixtures prove that corrected automatic metadata groups consistently under the existing projection. No live SSH/paired runtime, rendered full-app run or automatic GitHub transfer/rename behavior is claimed.

Testing

96 enrichment, provider identity and projection tests pass against the reviewed main baseline. The ownership review reproduced two peer-write failures first, then five probe/write-boundary failures before the final correction. The suite also covers a pending local probe whose row becomes peer-owned. Node typecheck and changed-code quality pass. Executed on macOS with controlled probes only.

  • Native end-to-end flow manually tested
  • Focused automated regression tests added and run with ORCA_BACKGROUND_LAUNCH=1

AI Disclosure

Review

Independent review confirms the accepted producer update avoids the rejected projection reorder and its demonstrated version-skew failure. Follow-up review caught three ownership gaps. All metadata writes now enforce the snapshot’s host, local writes explicitly pass the local host ID, and peer-owned rows are excluded before probing. The write-side guard and stale-row check remain for in-flight ownership changes. Local and direct-SSH probes keep their existing routes; startup delay, bounded sweeps and six-hour refresh interval remain unchanged.

Agent skill upstream boundary

  • Not applicable; no upstream skill source is copied.

Notes

All current CI checks pass. An initial shard hit an unchanged palette-search timing budget (190.6 ms against 180 ms); all nine palette performance tests passed locally and the single targeted CI retry passed. No palette source or timing limit was changed.

Checklist

  • Small and focused
  • Before/after, mechanism and rationale explained
  • Visual proof attached or N/A explained
  • Reviewed for correctness, security and performance
  • Cross-platform, SSH/remote and compatibility impact considered
  • Required CI checks pass, including the verify aggregate

@nwparker
nwparker marked this pull request as ready for review September 23, 2026 05:54
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

Repository identity enrichment now scopes repository lookups and updates by execution host. After a successful probe, it can refresh a repository’s existing GitHub image icon when the repository has no complete upstream and its provider identity resolves to a supported GitHub host. Added tests cover refresh timing, icon preservation, host ownership, and other eligibility conditions.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 1450c

Automatic GitHub icon refresh works for normal repositories. However, when a local project shares an ID with a remote-host project, a local refresh can overwrite the remote project's identity or icon. Projects owned by a peer machine are also still probed with local git before being skipped. Both issues have small fixes: pass the host on every update, and skip peer-owned rows before probing. They should be addressed before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: refreshing stale automatic GitHub project icons during enrichment.
Description check ✅ Passed The description explains the user impact, implementation, rationale, limitations, testing, review findings, and compatibility considerations. It includes issue references, but it does not provide the …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@nwparker

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent review of the new ownership guard: it now prevents peer-owned metadata writes, but the same rows still reach probeGitRemoteIdentity because selectEnrichmentCandidates accepts runtime: rows and getRepoProbeHostId maps them to local. The execution-boundary contract forbids that local fallback for a remote path. Skip peer-owned rows before probing, retain the write-side guard for ownership changes in flight, and assert that the peer fixture never invokes the probe. Local and direct-SSH enrichment should retain their existing paths.

@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.

Important

The host-scoped read added in getCurrentRepo is not matched by a host-scoped write for local rows, so a client-local probe can land its identity/icon on a same-id SSH sibling row. One inline fix suggested.

Reviewed changes

  • Automatic GitHub icon repair in the enrichment producer — writeIdentity now recomputes an automatic repoIcon from a resolved probe and writes it alongside gitRemoteIdentity; the new getAutomaticGitHubIconRefresh bails out for peer (runtime:) hosts, explicit upstream, non-github icons, non-GitHub probes, and unresolved SSH aliases.
  • Host-scoped current-row lookup — getCurrentRepo now resolves by (id, hostId) and RepoIdentityStore.getRepo/updateRepo accept an optional hostId; non-local writes pass it.
  • New regression test file — repo-git-remote-avatar-refresh.test.ts covers the repair, custom/cleared icons, upstream preservation, provider-neutral remotes, the pending-probe race, folder workspaces, and cross-host id/path collisions.

ℹ️ A remote that leaves GitHub keeps its stale automatic icon

The repair only fires when the probed remote is still GitHub. If origin is re-pointed to a non-GitHub provider, getAutomaticGitHubIconRefresh returns undefined and the old github icon survives. Because getProjectProviderIdentity reads the github icon ahead of gitRemoteIdentity, the repo then keeps projecting under the old GitHub id even though the canonical key was updated. This looks intentional per the PR body ("preserves provider-neutral remotes"), but it is the same stale-automatic-metadata class the PR targets, so it is worth stating explicitly as out of scope (or clearing the automatic icon when a probe resolves to a non-GitHub provider).

Technical details
# Non-GitHub probe leaves the automatic github icon in place

## Affected sites
- `src/main/repo-git-remote-identity-enrichment.ts:143-145` — `icon` is `undefined` whenever the probed identity is not GitHub.
- `src/shared/project-host-setup-projection.ts:40-61` — `getProjectProviderIdentity` returns the github-icon identity before falling back to `gitRemoteIdentity`.

## Required outcome
- Either confirm GitHub→non-GitHub transitions are explicitly out of scope, or clear/refresh the automatic icon so the projection stops deriving the old GitHub project id.

## Open questions for the human
- Is the linked issue scoped to GitHub→GitHub only, or should an origin move off GitHub also detach the project id?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 52cffde9-dfef-4b70-b574-a68d44f442ba

📥 Commits

Reviewing files that changed from the base of the PR and between 0b16a31 and 1450c89.

📒 Files selected for processing (2)
  • src/main/repo-git-remote-avatar-refresh.test.ts
  • src/main/repo-git-remote-identity-enrichment.ts

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

@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.

ℹ️ Delta is clean — the peer guard now covers all metadata writes. One item from the earlier review (unscoped local write) remains open and this commit does not touch it.

Reviewed changes (since a452dd4)

  • Peer-owned metadata is now fully guarded — the host check moved out of getAutomaticGitHubIconRefresh into writeIdentity, so a runtime: (or any non-SSH, non-local) row can no longer have either gitRemoteIdentity or repoIcon written from a client-local probe. This closes the identity-write half that the earlier icon-only guard left open.
  • Parametrized regression test — does not write peer-owned metadata from a client-local probe when identity is same/different/missing asserts both fields are untouched and no write occurs; the different and missing cases are the ones the new guard fixes.

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

@nwparker

Copy link
Copy Markdown
Contributor Author

The host-boundary findings are fixed in 56cd66f: peer-owned rows are never probed here, and all metadata writes carry their execution host, including local. The 96 focused tests, Node typecheck and changed-code quality pass.

The non-GitHub transition note is intentionally outside this bounded repair. A GitHub-to-other-provider remote change leaves the stored icon unchanged; the PR body now states that limitation explicitly. This change does not alter provider precedence or clear user-visible metadata across mixed client/host versions.

@nwparker
nwparker merged commit 18d00cc into main Sep 26, 2026
55 of 57 checks passed
nwparker added a commit that referenced this pull request Sep 27, 2026
…rows (#23300)

A repo row stamped `executionHostId: runtime:<env>` is how a paired client
addresses a project registered in *this* process, so its files are local
(`runtime-repository-registration-controller.ts`, and the helper #23184 added in
`repo-execution-host.ts`). #22421 reclassified those rows as peer-owned and
dropped them from the identity sweep, so `gitRemoteIdentity` never settled on
remote-runtime and paired-web setups: the project stayed pending, fell back to a
host-local `repo:<id>` that never grouped across hosts, and a stale automatic
avatar never repaired.

Reuse `getStoredRepoExecutionHostId` instead of a second host classifier, and
keep skipping only a `runtime:` row that also names a nested SSH target — that
target lives in the peer's dispatch table and the same path here is a different
checkout. The store matches a write against the row's own stamp, so address
`updateRepo` by that stamp rather than the probe host, which is `local` for these
rows and would match no row at all.
nwparker added a commit that referenced this pull request Sep 27, 2026
…f failing silently (#23379)

`Store.updateRepo` takes an optional `hostId` that must be the row's own
`executionHostId` stamp. When it is anything else the lookup matches no row and
the method returns `null` — the same value a deleted row returns — so the write
is dropped with no error, no log, and no failing test. #22421 shipped exactly
that: identity enrichment addressed the probe host (`local`) instead of a
`runtime:` row's stamp, and every write was discarded for a full release.

Resolve the row through `findRepoRowForHostScopedWrite`, which logs once when the
id exists but only under other host stamps, naming the requested host and the
stored ones. The guard itself is unchanged: a matching host still writes, and a
client-local probe still cannot repair a peer's row.
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