Repository navigation
fix(checks): show a PR found by Refresh, not "already exists" - #29231
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
becbfc88-47e2-47dd-83af-0a2a16c1f99a
📥 Commits
Reviewing files that changed from the base of the PR and between 36e36f2 and c77cc9ea7283068bcdb35fc6a696612ff083d2a9.
📒 Files selected for processing: 19
src/main/bitbucket/client.test.tssrc/main/bitbucket/client.tssrc/main/bitbucket/pull-request-mappers.tssrc/main/gitea/client.test.tssrc/main/gitea/client.tssrc/main/gitea/pull-request-mappers.tssrc/main/github/client-pr-branch-discovery.test.tssrc/main/github/client-pr-fallback-number.test.tssrc/main/github/client-tracked-upstream-fork-owner.test.tssrc/main/github/client-tracked-upstream-snapshot.test.tssrc/main/github/client/lookup/pr-branch-lookup.tssrc/main/github/default-branch-stale-pr.test.tssrc/main/github/pr-refresh-coordinator-refresh-events.test.tssrc/main/gitlab/client-mr-branch-lookup.test.tssrc/main/gitlab/mappers.tssrc/main/gitlab/merge-request-lookup.tssrc/main/source-control/branch-review-selection.tssrc/renderer/src/store/github/pr-result-cache.tssrc/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
c77cc9e to
723819c
Compare
723819c to
4801474
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Preserve the checks projection when deduplicating refresh results. · pr-result-cache.ts:120-140
src/renderer/src/store/github/pr-result-cache.ts:120-140
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPreserve the checks projection when deduplicating refresh results.
The IPC reply writes the raw PR result. The broadcast applies
applyCachedChecksStatus, then reaches this duplicate guard. Electron does not guarantee ordering between thewebContents.send()event and theipcRenderer.invoke()reply, so the IPC reply can write first. When the hosted-review identity also matches, the broadcast returns the unchanged PR cache and drops the projectedchecksStatus.When the duplicate branch receives a PR with
checksStatus, merge that field into the existing PR entry. Preserve the existing value when the incoming result has no checks projection. This keeps the duplicate-delivery protection without losing cached checks status.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e690d170-f563-40ee-b1a0-0235b5a17c2d
📥 Commits
Reviewing files that changed from the base of the PR and between 48014747f0d66784de2d71b2e39b588f1692552d and 7ab399115ee36b1836060e0d6a746b3d7885a866.
📒 Files selected for processing: 1
src/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
c2fc807 to
3492c09
Compare
Refresh applied its result twice and the second copy deleted the cached PR, so the panel fell back to "Pull request already exists" until the next background refresh.
3492c09 to
1c95318
Compare
ELI5
Refresh now keeps a PR opened from the terminal visible in the Checks panel, instead of replacing it with "Pull request already exists". It also preserves applicable checks details when the refresh result arrives twice.
What Changed
Before, Refresh could find a PR and immediately drop it from the panel until a later refresh. The same result reaches the renderer as both a broadcast and an IPC reply. The second delivery treated the first delivery's cache write as a newer result and deleted the PR.
The shared cache writer now skips duplicate results when the fetch time, PR number, and PR URL match and the hosted-review cache still identifies that PR. A newer lookup that finds no review or a different PR still takes the existing freshness path. Comparing URLs also distinguishes equal PR numbers in a fork and its upstream.
Both native deliveries now apply the existing cached-checks policy before writing. Previously, a reply that arrived first could overwrite checks details with its older PR snapshot, after which the duplicate guard discarded the broadcast's corrected status.
Why
Duplicate handling belongs in the writer used by both deliveries. Keeping the reply write supports clients that receive only a reply. Reusing
applyCachedChecksStatusgives both native deliveries the same head, freshness, and owner checks without adding another status-merging rule. Copying the incoming status inside the duplicate guard would also copy raw, older status from the reply.Linked Issue
Reported directly by a user: "Why does the app show 'Pull request already exists' instead of showing me the actual pull request?"
Visual Proof
Original disappearing-PR reproduction and fix in a hidden macOS Orca dev build:
Testing
On the current commit, 252 tests passed across 26 focused suites. Removing reply normalization makes the three reply-first status cases fail. Removing the URL comparison makes the different-repository case fail. Full typecheck, full lint including the focus-read gate, changed-file formatting, and the changed-code quality gate passed.
The real Electron/store probe observed reply-first delivery with stale status before the repair, and reply-first delivery without stale status with the repair. This confirms the ordering is reachable under the probe's conditions; it does not measure its frequency with live GitHub. A later successful checks fetch can repair the stale status.
Review
Native local and SSH lookups share the repaired path. Runtime RPC has no paired native broadcast and retains its existing behavior. Other review providers retain their existing reconciliation. Pure folder workspaces remain subject to the existing non-git rules. No wire format, saved-state schema, UI strings, or platform-specific behavior changed.
Agent skill upstream boundary
Notes
Linux, Windows, and live SSH were not run locally. Build and the full test suite are left to CI.
Checklist