Skip to content

fix(github): send a paired server its own repo id when an SSH row shares the path - #33257

Merged
nwparker merged 2 commits into
mainfrom
nwparker/integration-host-routing
Oct 24, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/integration-host-routing

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32

ELI5

One folder can be known to Orca twice: once as an SSH repo and once as a repo on a paired Orca server. Each registration has its own id. When Orca asked the server for that repo's PR status, it could send the SSH registration's id, which the server has never seen. The request failed quietly and PR status never appeared. Now Orca sends the server's own id.

What Changed

  • Before: for a repo on a paired server, PR status, checks, work items, comments and review threads did not load if the same path was also registered over SSH. Removing the SSH registration made them appear.
  • After: they load, whether or not an SSH registration shares the path.

Mechanism: getRuntimeRepoTarget (src/renderer/src/store/github/repository-routing.ts) used to look the repo up by path alone, where the first registration wins. It now takes the caller's repo id as a required argument. It picks the row that lives on the target server: first the row with that id and path, then any row with that path on that server. A new findOnHost in the existing repo lookup index (github-repo-lookup-index.ts) does this lookup, so the refresh sweep's repo reads stay linear. Rows with no host stamp (legacy) still fall back to the id-or-path lookup.

This builds on @Ethereal49's #33194; their commit is kept with their authorship. Added on top:

  • the lookup prefers the caller's repo id;
  • an indexed lookup replaces the per-call list scan, which broke main's existing ratchet "keeps runtime issue dispatch repo identity reads linear" (9152 reads against a limit of 1920);
  • the test that pinned sending another host's repo id to the server is dropped.

Why

GitLab, hosted reviews and the other providers already resolve the repo row first and then route by that row's host, sending its id. GitHub was the outlier: it chose the server from the row, then looked the repo up again by path alone. Making the repo identity a required parameter at this one choke point fixes every GitHub caller (PR refresh, work items, counts, checks, comments, review threads). A per-call-site patch would have missed some.

Linked Issue

Fixes #32997

Thanks to the reporter for the precise root-cause analysis in #32997, and to @Ethereal49 for #33194.

Related, not fixed here: #33219 (GitLab tab listMRs fails for paired-server repos) is already fixed on main by #27247. That change merged after the v1.4.224 cut the reporter was running, and ships in v1.4.235 and later. The existing test in use-task-page-gitlab-loading.test.tsx covers it.

Visual Proof

N/A: this changes only which repo id is sent to the paired server. The visible effect, PR status appearing, is checked in a live run (see Testing).

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Unit tests: two regression tests (from fix(github): route runtime repo paths by execution host #33194), one for PR refresh and one for work items. With an SSH row and a runtime row sharing one path, they assert the runtime RPC receives the runtime repo id. Both fail on origin/main, where the SSH id is sent, and pass with this change.

  • All test files in src/renderer/src/store/slices/github*, src/renderer/src/store/github/ and hosted-review* pass, run single-worker (51 files, 596 tests).

  • Live run on macOS (local only, not checked in). A headless paired runtime host from the e2e harness, with an isolated profile and ORCA_BACKGROUND_LAUNCH=1, plus a stub gh on the server's PATH (no real GitHub, no tokens). A paired desktop client with an SSH row injected for the same path, listed first. Then fetchPRForBranch with a unique probe branch.

    • On origin/main the server never ran gh for the probe branch (the request was rejected for the unknown SSH id).
    • With this change the server ran gh api repos/acme/repo/pulls?head=acme:repro-32997-probe.
  • pnpm tc:web and the full local static job pass. The one exception is orcad-terminal-smoke, which ran only because the change-scope check couldn't read the dependency graph here, and then failed because it needs an out/mobile-web build. This PR touches only renderer store files.

  • Not tested: Windows or WSL hosts live, or a real SSH host. The SSH row was injected into the store.

Review

Focus: findOnHost in github-repo-lookup-index.ts, and the fallback order in getRuntimeRepoTarget.

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

  • Local, SSH and WSL repos are untouched: those targets return before the lookup.
  • Folder workspaces use the same row lookup.
  • Mixed versions: the wire shape is unchanged. Only the id value changes, to one the server already knows.
  • Performance: the lookup is indexed, lazy and cached per repo list.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Ethereal49 and others added 2 commits October 24, 2026 13:35
When a repo path is registered on both SSH and a paired runtime, path-only lookup could send the SSH-side repo ID to the runtime. Prefer the row owned by the target runtime, then retain the original first-path fallback.

AI-Assisted: OpenAI Codex

Signed-off-by: ethereal49 <hongyeluo49@gmail.com>
…r's repo id

getRuntimeRepoTarget now takes the caller's repo identity and resolves the
row through the repo lookup index, preferring the row on the target runtime
with that id, then the row on that runtime for the path. This keeps the
refresh sweep's repo reads linear (a per-call list scan broke that ratchet).
Legacy rows with no host stamp still fall back to id-or-path lookup.

Removes the test that pinned the off-host fallback; it asserted sending
another host's repo id to the server.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b8642fa-f9ec-4b85-8f13-6912eec1d666
Commits

Reviewing files that changed from the base of the PR and between c90d0f9 and 3d92daf.

Files selected for processing: 6
  • src/renderer/src/store/github/pull-request-execution.ts
  • src/renderer/src/store/github/repository-routing.ts
  • src/renderer/src/store/github/work-item-routing.ts
  • src/renderer/src/store/slices/github-pr-refresh-owner-routing.test.ts
  • src/renderer/src/store/slices/github-repo-lookup-index.ts
  • src/renderer/src/store/slices/github-work-items-runtime-routing.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

Repository lookup now distinguishes repositories by execution host, repository ID, and path. Pull request and work-item routing pass both the repository ID and path when resolving a runtime target. Tests cover pull request refresh and work-item retrieval when SSH and runtime repositories share a path.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 3d92d

The changed GitHub routing has no established merge-blocking defect. Gitea and live-host behavior remain unvalidated.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check Inconclusive For #32997, the reviewed changes address the GitHub path. getRuntimeRepoTarget now receives the caller repo ID and path, uses findOnHost, and routes PR refresh and work-item requests to the runtim… Provide reviewable evidence that the duplicate-path case in #32997 already works for Gitea, including the relevant routing implementation and regression coverage. Without that evidence, Gitea compliance cannot be determined.
Passed Passed checks: 3 passed
Check name Status Explanation
Description check Passed The description is complete and follows the repository template. It explains the problem, user-visible behavior, implementation, rationale, linked issue, testing, known test exception, untested enviro…
Title check Passed The title is concise, specific, and accurately describes the primary fix: sending the paired server its own repository ID when SSH and runtime registrations share a path.
Out of Scope Changes check Passed The changed production files update GitHub repository routing and lookup. The added tests cover PR refresh and work-item routing for the reported duplicate-path case. These changes support #32997 and …
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the problem, user-visible behavior, implementation, rationale, linked issue, testing, known test exception, untested environments, and checklist status.

Full details: Out of Scope Changes check

Explanation

The changed production files update GitHub repository routing and lookup. The added tests cover PR refresh and work-item routing for the reported duplicate-path case. These changes support #32997 and no unrelated change is demonstrated.

Full details: Linked Issues check

Explanation

For #32997, the reviewed changes address the GitHub path. getRuntimeRepoTarget now receives the caller repo ID and path, uses findOnHost, and routes PR refresh and work-item requests to the runtime repo ID. The added tests cover both request types. #32997 also states that the bug affects Gitea. The reviewed changes and reported tests provide no Gitea-specific evidence. Existing Gitea behavior is not established by the available evidence.

Resolution

Provide reviewable evidence that the duplicate-path case in #32997 already works for Gitea, including the relevant routing implementation and regression coverage. Without that evidence, Gitea compliance cannot be determined.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@nwparker
nwparker merged commit 976fa11 into main Oct 24, 2026
32 checks passed
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.

[Bug]: PR status is missing when a repo path is registered on both an SSH host and a paired runtime

2 participants