Skip to content

fix(checks): show a PR found by Refresh, not "already exists" - #29231

Merged
AmoabaKelvin merged 4 commits into
stablyai:mainfrom
AmoabaKelvin:show-open-pr-for-branch
Oct 16, 2026
Merged

AmoabaKelvin merged 4 commits into
stablyai:mainfrom
AmoabaKelvin:show-open-pr-for-branch

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​125 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​124
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

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 applyCachedChecksStatus gives 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:

Before After
Refresh drops the discovered PR Refresh keeps the discovered PR visible

Testing

  • I manually tested these changes locally. The original panel bug was reproduced and checked in hidden Orca on macOS. The checks-status race was reproduced with the production store and controlled responses over real Electron IPC, rather than through a live GitHub click flow.
  • Automated tests added/updated. Store coverage includes duplicate delivery, a newer lookup finding no review, the same PR, or another repository's PR with the same number, and success/failure/pending checks in both delivery orders. A coordinator assertion verifies that the reply equals the broadcast outcome.

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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Linux, Windows, and live SSH were not run locally. Build and the full test suite are left to CI.

Checklist

  • This PR is small and focused
  • I explained what changed and why, including the user-facing before/after and the mechanism
  • Before/after screenshots attached for the panel behavior change
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Build and the full test suite pass in CI on the current commit

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 3d0c6eb6b6e1acee97565b91f80acaa2153cae97
  • Latest commit, not reviewed: 1c95318

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 2a8d37e8-83c0-48ab-a3da-c8c24e0540bf
📥 Commits

Reviewing files that changed from the base of the PR and between 7ab399115ee36b1836060e0d6a746b3d7885a866 and 3d0c6eb6b6e1acee97565b91f80acaa2153cae97.

📒 Files selected for processing: 3
  • src/renderer/src/store/github/pr-result-cache.ts
  • src/renderer/src/store/github/pull-request-execution.ts
  • 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; 8 remain after this review.

📝 Walkthrough

The GitHub PR result cache now skips reapplying a result when the cached fetch time, PR number, and URL match, and the hosted-review cache entry matches the PR. Locally handled PR results now receive cached check status. Tests cover manual refresh broadcasts before replies, newer hosted-review lookups, check-status updates, and agreement between the refresh return value and its emitted outcome.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 3d0c6

The previously identified missing-review path is addressed, and the supplied evidence establishes no remaining issue that should block merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 20 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description explains the user impact, implementation, rationale, testing, visual proof, and compatibility considerations. However, the required Linked Issue section does not include an actual issu… Add the actual linked issue URL or issue number to the Linked Issue section, such as a valid "Fixes #" reference. Update the CI checklist item if the build and full test suite complete.
Passed Passed checks: 3 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 fix: keeping a pull request found by Refresh visible instead of showing "already exists".
Full details: Description check

Explanation

The description explains the user impact, implementation, rationale, testing, visual proof, and compatibility considerations. However, the required Linked Issue section does not include an actual issue link or issue number.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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: 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.ts
  • src/main/bitbucket/client.ts
  • src/main/bitbucket/pull-request-mappers.ts
  • src/main/gitea/client.test.ts
  • src/main/gitea/client.ts
  • src/main/gitea/pull-request-mappers.ts
  • src/main/github/client-pr-branch-discovery.test.ts
  • src/main/github/client-pr-fallback-number.test.ts
  • src/main/github/client-tracked-upstream-fork-owner.test.ts
  • src/main/github/client-tracked-upstream-snapshot.test.ts
  • src/main/github/client/lookup/pr-branch-lookup.ts
  • src/main/github/default-branch-stale-pr.test.ts
  • src/main/github/pr-refresh-coordinator-refresh-events.test.ts
  • src/main/gitlab/client-mr-branch-lookup.test.ts
  • src/main/gitlab/mappers.ts
  • src/main/gitlab/merge-request-lookup.ts
  • src/main/source-control/branch-review-selection.ts
  • src/renderer/src/store/github/pr-result-cache.ts
  • 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; 8 remain after this review.

@AmoabaKelvin AmoabaKelvin changed the title fix(pr): show a branch's open PR and keep it after Refresh fix(checks): show a PR found by Refresh, not "already exists" Oct 15, 2026
@AmoabaKelvin
AmoabaKelvin force-pushed the show-open-pr-for-branch branch from c77cc9e to 723819c Compare October 15, 2026 21:56
@AmoabaKelvin
AmoabaKelvin force-pushed the show-open-pr-for-branch branch from 723819c to 4801474 Compare October 16, 2026 01:31

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 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 win

Preserve 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 the webContents.send() event and the ipcRenderer.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 projected checksStatus.

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.

@AmoabaKelvin
AmoabaKelvin force-pushed the show-open-pr-for-branch branch 3 times, most recently from c2fc807 to 3492c09 Compare October 16, 2026 04:01
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.
@AmoabaKelvin
AmoabaKelvin force-pushed the show-open-pr-for-branch branch from 3492c09 to 1c95318 Compare October 16, 2026 18:12
@AmoabaKelvin
AmoabaKelvin merged commit 5c0ab96 into stablyai:main Oct 16, 2026
31 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the show-open-pr-for-branch branch October 16, 2026 21:38
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