Repository navigation
fix(github): route PR merges through repo owner - #7590
Conversation
📝 WalkthroughWalkthroughChanges
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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: 1
🧹 Nitpick comments (1)
src/renderer/src/components/github-item-dialog-source-boundary.test.ts (1)
193-194: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy liftSubstring assertions don't verify merge precedence.
These checks only confirm that
getSettingsForRepoRuntimeOwner(...)and...repoOwnerSettingsappear somewhere in the actions section — they don't assert thatrepoOwnerSettingsis spread aftergetTaskSourceRuntimeSettings(sourceContext). This means the precedence bug flagged inGitHubItemDialog.tsx(source-context settings unconditionally overriding repo-owner settings) would pass these assertions unnoticed.Consider a behavioral test (rendering
PRActionsPanelwith a mocked store where repo-owner settings resolve to a runtime environment butsourceContext.hostIdis non-runtime) that asserts the merge/mergePR call routes to runtime RPC, not localgh:mergePR.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ebd3cb3d-0ba0-40a0-847f-7dc8e04c5520
📒 Files selected for processing (2)
src/renderer/src/components/GitHubItemDialog.tsxsrc/renderer/src/components/github-item-dialog-source-boundary.test.ts
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks @siddqamar — this is a clean, well-scoped fix.
Verified the repro and the fix end to end: on main, PRActionsPanel routed merges using only the source context, so a runtime-owned (headless) repo whose source view resolved local fell back to local gh:mergePR → Access denied: unknown repository path (#6957). Routing repo-owner-first, with the guard that only lets a source override when it actually points at a runtime, fixes that and brings the merge panel in line with the sibling read-path panels already on main.
Notes:
- The
activeRuntimeEnvironmentIdtruthiness guard is the right call — it avoids clobbering a runtime-owned repo's routing with a null local source (the unconditional-spread siblings have that latent gap on their read RPCs; tracking separately). - No GitLab impact (GitLab uses a separate dialog); SSH-owned repos still route to local IPC as before.
- I pushed one extra commit: a behavioral regression test that exercises the routing decision through the real helpers and fails if the fix is reverted.
Rebased onto current main; typecheck + lint + targeted tests green.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/github-item-dialog-merge-routing.test.ts (1)
14-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftConsider extracting the routing decision into a shared, importable helper.
resolveMergeTargetre-implements the exact merge/source-override decision that presumably lives inline inPRActionsPanel(per the stack summary). Since this test's entire purpose is to guard against a regression to source-only routing, if the real component's logic changes independently, this mirrored copy won't catch the drift — defeating the regression guard.Consider extracting this decision (lines 19-29) into an exported helper in a shared module (e.g., alongside
repo-runtime-owner.ts) that bothPRActionsPaneland this test import, so the test always exercises the real code path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1bc85f3c-9278-4d0a-a35a-3ad16078311b
📒 Files selected for processing (1)
src/renderer/src/components/github-item-dialog-merge-routing.test.ts
- Use repo-owner runtime settings before source-context overrides in PR actions - Keep headless/runtime repos on runtime RPC instead of local gh:mergePR - Add source-boundary coverage for merge routing and Windows-safe newline matching
- Apply task-source runtime overrides only when they resolve to a runtime host - Keep runtime-owned repos from being downgraded to local gh:mergePR - Guard the routing contract with source-boundary coverage - Important because non-runtime source contexts could recreate the issue stablyai#6957 access-denied path
…ting Mirrors PRActionsPanel's merge-routing decision through the real repo-runtime-owner/task-source helpers so a revert to source-only routing (issue stablyai#6957) fails here. Covers the runtime-owned repo with a local GitHub source view and the local-repo-while-runtime-focused case. Co-authored-by: Orca <[email protected]>
|
Thanks @siddqamar — right root cause, and owner-first precedence was the correct call. While reviewing this we found the same source-only routing on the standalone PR page ( |
* fix(github): route PR merges through repo owner - Use repo-owner runtime settings before source-context overrides in PR actions - Keep headless/runtime repos on runtime RPC instead of local gh:mergePR - Add source-boundary coverage for merge routing and Windows-safe newline matching * fix(github): preserve repo-owner merge routing - Apply task-source runtime overrides only when they resolve to a runtime host - Keep runtime-owned repos from being downgraded to local gh:mergePR - Guard the routing contract with source-boundary coverage - Important because non-runtime source contexts could recreate the issue stablyai#6957 access-denied path * test(github): add behavioral regression test for repo-owner merge routing Mirrors PRActionsPanel's merge-routing decision through the real repo-runtime-owner/task-source helpers so a revert to source-only routing (issue stablyai#6957) fails here. Covers the runtime-owned repo with a local GitHub source view and the local-repo-while-runtime-focused case. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Jinwoo-H <[email protected]> Co-authored-by: Orca <[email protected]>
Summary
Fixes PR merge and auto-merge routing for headless/runtime-owned GitHub repositories. These actions now use the repository owner's runtime settings before applying source-context overrides, ensuring runtime repository paths stay on runtime RPC instead of incorrectly falling back to local
gh:mergePR. Fixes #6957No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAdded focused regression coverage for GitHub item dialog merge routing.
AI Review Report
AI review traced the failure from
GitHubItemDialogPR actions through local IPC and runtime RPC. It identified that merge routing relied onsourceContextalone, which could incorrectly route runtime-owned repositories to local IPC and triggerAccess denied: unknown repository path.The routing now prefers the repository owner's runtime settings before applying GitHub source-context overrides. Cross-platform review covered macOS, Linux, and Windows. This PR does not modify shortcuts, labels, shell behavior, paths, or platform-specific Electron APIs.
Security Audit
Reviewed IPC, path handling, command execution, authentication, dependencies, and runtime-routing risks.
No additional security follow-up identified.
Notes
This is a non-visual routing fix. Local and SSH behavior remain unchanged, while runtime-owned repositories now correctly stay on runtime RPC.