Repository navigation
fix(github): route all PR mutations through the repo's owner host - #7739
Conversation
Extends the owner-first routing from the original fix into the shared github-source-runtime-context module and applies it to every PR action seam hit by #6957: both PRActionsPanel copies (GitHubItemDialog and PullRequestPage) and both runPullRequestStateUpdate runners, so merge, auto-merge, close, and reopen all run on the owner runtime instead of falling back to local gh IPC. Replaces the logic-mirror regression test with unit coverage of the real resolver. Co-authored-by: Orca <[email protected]>
…lver unit tests Co-authored-by: Orca <[email protected]>
Review finding: getSettingsForRepoRuntimeOwner falls back to the global activeRuntimeEnvironmentId for repos without an explicit owner, so a plain local repo's merge/close/reopen would follow a focused runtime. Resolve PR mutation routing from the repo's explicit owner only (source-runtime override preserved), matching the Checks panel's getGitHubActionTarget precedent, and add the no-owner regression tests. Co-authored-by: Orca <[email protected]>
getGitHubMutationRoutingSettings returned a spread of all GlobalSettings while its type and only consumers (getActiveRuntimeTarget) read solely activeRuntimeEnvironmentId; under useShallow the spread widened the PR actions panel's re-render trigger to every settings field. Return only the routing field. Also pin getExplicitRuntimeOwnerEnvironmentId's contract with direct unit tests (no-owner/SSH/duplicate-id cases) and restore an unrelated exact-string test pin loosened in this branch. Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThis change introduces repo-owner-based runtime routing for GitHub pull request mutations. Two new exported helpers are added: Changes
Sequence Diagram(s)See hidden artifact for detailed sequence diagram of PR state update routing. Related PRs: None specified. Suggested labels: routing, github-integration, tests Suggested reviewers: None specified. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
…ablyai#7739) Co-authored-by: Orca <[email protected]>
Summary
Completes the headless-server PR-mutation routing fix started in
#7590(thanks @siddqamar for the root-cause direction).#7590covered merge/auto-merge inGitHubItemDialogonly; the same source-only routing is still onmaininPullRequestPage's actions panel and in both close/reopen paths, so merging or closing a PR on a headless-server project from those surfaces still fails withAccess denied: unknown repository path(#6957).getGitHubMutationRoutingSettings(github-source-runtime-context.ts), matching the Checks panel's existinggetGitHubActionTargetprecedent: a GitHub source that explicitly names a runtime host wins; otherwise the repo's explicit owner host; otherwise local.PRActionsPanelin bothGitHubItemDialogandPullRequestPage, plus both duplicatedrunPullRequestStateUpdateclose/reopen runners. Both panels are rendered withrepoId={item.repoId}, so merge and close/reopen always resolve to the same host — no divergence.#7590, a repo with no explicitexecutionHostId/connectionIdwould send its PR mutations to whatever runtime happens to be focused. The newgetExplicitRuntimeOwnerEnvironmentIdguards that, with regression tests. This also removes the no-owner→global-focus fallback that#7590left live in the dialog.#7590with unit tests of the real exported resolver (the mirror existed because barepnpm vitestdoesn't resolve the@/alias;--config config/vitest.config.tsdoes).Addresses the first (HIGH) item of
#7623; the read-path sibling seams listed there (plus TaskPage row-merge and GitLab parity) remain follow-ups.No visual change.
Testing
pnpm typecheck(web + node)pnpm lint(changed files clean;mainhas a pre-existing switch-exhaustiveness failure insource-control-manual-review-url.ts)pnpm test— resolver + boundary suites green (49 tests acrossgithub-source-runtime-context,repo-runtime-owner, and both component boundary suites); the only full-suite failures are the two already red onmainat the merge-base (worktrees.test.tspurge cases,serve-sim-state-watcher.test.ts)#6957); explicitly-local repo stays local even with a runtime globally focused; no-owner repo never routes to the focused runtime; runtime source overrides owner; direct contract tests forgetExplicitRuntimeOwnerEnvironmentIdEnd-to-end validation against a real headless runtime
Validated against a real headless
orca serveruntime (paired desktop, serve store seeded so the scratch repo is runtime-owned):#6957failure —Access denied: unknown repository path— when merging the runtime-owned repo's PR from a local source view.Made with Orca 🐋