Show merged PR status from merge commits#6470
Conversation
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
|
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:
📝 WalkthroughWalkthroughThe PR adds merge-commit-based PR lookup in the GitHub client and forwards current head OIDs through runtime, IPC, preload, and renderer refresh paths. Renderer cache keys now use worktree head data for detached worktrees, and the worktree card and checks panel update pending hosted-review behavior. Tests were added and updated for merge-commit lookup, head-OID propagation, refresh coordination, tracked-upstream probing, and detached-head UI/cache behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsx (1)
147-157: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a pathname-based paired-web case.
This suite only covers
window.__ORCA_WEB_CLIENT__. The shared web-client contract also treats/web-index.htmlas web, so this test won't catch future drift from the common detector.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9047182a-2f15-43b5-87dc-2ed05de16e0f
📒 Files selected for processing (8)
src/main/github/client.test.tssrc/main/github/client.tssrc/main/github/pr-refresh-coordinator.test.tssrc/main/github/pr-refresh-coordinator.tssrc/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsxsrc/renderer/src/components/sidebar/WorktreeCard.tsxsrc/renderer/src/store/slices/github.tssrc/shared/types.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/github/pr-refresh-coordinator.ts (1)
239-244: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a short why-comment for the worktree-head fallback.
Letting a branchless candidate pass validation is non-obvious here; a one-line comment would make it clear this exists for detached/merge-commit PR resolution.
Suggested change
function validateCandidate( candidate: GitHubPRRefreshCandidate ): GitHubPRRefreshSkippedReason | null { @@ + // Why: detached worktrees can still resolve a PR from the checked-out merge commit. if ( !candidate.branch && typeof candidate.linkedPRNumber !== 'number' && typeof candidate.fallbackPRNumber !== 'number' && !candidate.worktreeHead ) {As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 730cfb1e-3cc0-4a50-bec9-9c34c2ca6025
📒 Files selected for processing (4)
src/main/github/pr-refresh-coordinator.test.tssrc/main/github/pr-refresh-coordinator.tssrc/renderer/src/store/slices/github.test.tssrc/renderer/src/store/slices/github.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/store/slices/github.ts
Co-authored-by: Orca <help@stably.ai>
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/main/runtime/rpc/methods/github.ts (1)
57-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why
branchmay be empty.
requiredStringAllowingEmpty('Missing branch')is intentionally unusual here; add a short why-comment so the detached/merge-commit lookup path is preserved.As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”
Proposed comment
const PrForBranch = RepoSelector.extend({ + // Why: detached/merge-commit worktrees have no branch; currentHeadOid can still resolve PR context. branch: requiredStringAllowingEmpty('Missing branch'),Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c7ee72b4-b528-486d-a178-3cf55766ef03
📒 Files selected for processing (20)
src/main/github/client.test.tssrc/main/github/client.tssrc/main/github/pr-refresh-coordinator.test.tssrc/main/github/pr-refresh-coordinator.tssrc/main/ipc/github.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/github.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/components/right-sidebar/active-checks-status.test.tssrc/renderer/src/components/right-sidebar/active-checks-status.tssrc/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsxsrc/renderer/src/components/sidebar/WorktreeCard.tsxsrc/renderer/src/store/slices/github-cache-key.tssrc/renderer/src/store/slices/github-pr-refresh-owner-routing.test.tssrc/renderer/src/store/slices/github.test.tssrc/renderer/src/store/slices/github.tssrc/renderer/src/web/web-preload-api.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsx
- src/renderer/src/components/sidebar/WorktreeCard.tsx
- src/main/github/client.ts
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/sidebar/WorktreeCard.tsx (1)
639-649: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick winDon’t start hosted-review polling for branchless detached cards.
For detached cards,
hostedReviewCacheKeyis now truthy via__detached_head__, so the polling effect below can callfetchHostedReviewForBranch(repo.path, branch, ...)withbranch === ''. Gate this pending state/effects to real branches and let the head-scoped PR refresh path own detached lookup.Suggested fix
const hostedReviewLookupPending = newCardStyle && + branch.length > 0 && shouldRefreshHostedReview && canPassivelyRefreshHostedReview && @@ !repo || isFolder || worktree.isBare || + !branch || !hostedReviewCacheKey || @@ !repo || isFolder || worktree.isBare || + !branch || !hostedReviewCacheKey ||
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fe4f2eb1-4cf2-44bd-acea-b2edefcb6f8d
📒 Files selected for processing (12)
src/main/github/client.test.tssrc/main/github/client.tssrc/main/github/pr-refresh-coordinator.test.tssrc/main/github/pr-refresh-coordinator.tssrc/main/ipc/github.test.tssrc/main/ipc/github.tssrc/main/runtime/rpc/methods/github.tssrc/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/components/sidebar/WorktreeCard.merged-pr-display.test.tsxsrc/renderer/src/components/sidebar/WorktreeCard.tsxsrc/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.tssrc/renderer/src/components/sidebar/folder-workspace-card-pr-display.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- src/main/github/pr-refresh-coordinator.test.ts
- src/main/runtime/rpc/methods/github.ts
- src/main/ipc/github.ts
- src/main/github/client.test.ts
- src/main/github/pr-refresh-coordinator.ts
- src/main/github/client.ts
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Summary
currentHeadOid/worktreeHeadthrough renderer, IPC, runtime RPC, refresh coordinator aliases, queued/manual refreshes, right-sidebar refreshes, entry refreshes, and async cache keys so detached merged worktrees refresh under the same identity everywhere.linkedPR, a hosted review entry withlinkedReviewHintKey: github:<n>, and a matching detached PR-cache entry, the card now shows the PR instead of the raw detached badge.headis present; branch worktrees remain branch-scoped so ordinary HEAD movement does not trigger extra visible PR refresh churn.Manual validation
stablyai/demo-project, merged it, then opened a detached worktree at the resulting merged commit.1b3961128confirmed no crash and correct right-sidebar/cache behavior, but the active left sidebar detached card still rendered raw detached status.9a2d8b6a7fb0190c8890894d7c0bdb30e4285962passed for both repro shapes:Linked PR #24in the active left sidebar card, notDetached HEAD @ 67c9b95;Linked PR #24on the active detached child row;stablyai/demo-project#24, titleValidate Orca PR status fallback 20260626214121, merged state, and check status;head, which could cause extra refresh churn; now branch rows use branch identity and detached rows use head identity;!branchguard;9a2d8b6a7changes GitHub entry refresh to use detachedheadidentity while keeping GitLab branch-scoped.perfskill review found the hosted-review suffix fallback could scan the whole cache per detached card on unrelated store updates;9a2d8b6a7removes that scan and relies on exact hosted-review keys plus the detached PR-cache fallback.Performance notes
headis present; normal branch cards remain branch-scoped.Automated validation
pnpm vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/ChecksPanel.review-header.test.tsx src/renderer/src/components/right-sidebar/active-checks-status.test.ts src/renderer/src/components/sidebar/worktree-list-visible-refresh.test.ts src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts src/renderer/src/components/sidebar/WorktreeCard.merged-pr-display.test.tsx src/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsx src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx— 7 files / 58 tests passedpnpm vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/ChecksPanel.review-header.test.tsx src/renderer/src/components/right-sidebar/active-checks-status.test.ts src/renderer/src/store/slices/github.test.ts src/renderer/src/store/slices/github-pr-refresh-owner-routing.test.ts src/renderer/src/components/sidebar/WorktreeCard.branch-review-pending.test.tsx src/renderer/src/components/sidebar/WorktreeCard.merged-pr-display.test.tsx src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts src/renderer/src/components/sidebar/worktree-list-visible-refresh.test.ts src/main/github/client.test.ts src/main/github/pr-refresh-coordinator.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/rpc/methods/github.test.ts src/main/ipc/github.test.ts src/renderer/src/web/web-preload-api.test.ts— 14 files / 894 tests passedpnpm run typecheck— passedpnpm run typecheck— passedpnpm run lint— passed with the existinguseGitStatusPolling.tswarninggit diff --check— passedLinked PR #24and the Checks panel stayed on demo-project PR Add Ghostty-style drag-to-reorder terminal panes #24; 2 tests passed.9a2d8b6a7fb0190c8890894d7c0bdb30e4285962passed both sidebar shapes: direct imported detached folder and parent repo with external worktrees visible both rendered PR-aware left sidebar rows (PR: Merged...in the fresh default UI), notDetached HEAD @ 67c9b95; backing cache and Checks panel identified demo-project PR Add Ghostty-style drag-to-reorder terminal panes #24, Checks showed#24,MERGED, titleValidate Orca PR status fallback 20260626214121, and 1 failing check; closing/reopening Checks and switching away/back stayed stable; stdout/stderr scans found no crash, stack traces, fatal errors, unhandled exceptions, or git/worktree/HEAD/path errors. Focused tests/typecheck were not rerun in this final smoke. Screenshots were left untracked under.visual-evidence/on the Windows machine.$git-crash-perfaudit at9a2d8b6a7fb0190c8890894d7c0bdb30e4285962: no new spawn/exec/shell: true/git status/git worktreescan path in the PR diff; detached refresh carriesworktreeHeadthrough the existing PR refresh coordinator; refresh remains bounded by coordinator concurrency (MAX_CONCURRENT = 4), OrcaghExecFileAsynctimeout/retry behavior, commit-associated PR TTL caches capped at 256 entries, and in-flight coalescing; detached renderer suffix fallback scans only boundedprCacheafter exact detached-key misses and does not scanhostedReviewCache; no lingeringgit.exe/gh.exeafter tests/typecheck; focused regression/perf-ish suite passed (8 files / 163 tests) and Windowspnpm run typecheckpassed. Caveats: inactive-workspace cleanup/delete smoke and live SSH/WSL smoke were not rerun because PR Show merged PR status from merge commits #6470 does not touch those paths; the fallbackgit rev-parse HEADhelper uses the safegitExecFileAsyncwrapper but lacks an explicit timeout, and the detached repro path should not hit it because renderer providescurrentHeadOid.