Skip to content

fix(review): PR reads and actions follow the ownership table - #27248

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v3b
Oct 10, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v3b

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​110 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​101
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​127 $\color{#cf222e}{\Huge{\mathbf{−}}}$​258 $\color{#cf222e}{\Huge{\mathbf{−}}}$​131

ELI5

When you look at a pull request that belongs to a project living on another Orca server, every panel on that page should talk to that server. Some panels (assignees, reviewers, labels, status, merge and review cells on the task page, the new-issue form) instead asked this computer, because the "where is this list coming from" setting said "this computer" and that overwrote the project's real owner.

What Changed

Before: a pull request or issue for a repo owned by a remote Orca server, opened through a GitHub source that has no server attached (a "this computer" source), had its assignee / reviewer / label pickers, the PR page conversation and edit panels, and the task-page status, merge, review and assignee cells run their GitHub calls on this desktop. They showed empty or stale lists, and writes from the task-page cells could fail with "unknown repository path". The PR page's own merge button already went to the right server, so reads and actions on the same page disagreed.

After: all of those panels, plus the store paths that fetch issues, comments, checks and review threads for a source, route the same way the merge button does:

  1. A GitHub source that names a server wins.
  2. Otherwise the repo's own owner decides: a server-owned repo goes to that server; a local or SSH repo uses this desktop's GitHub login. When the same repo id exists on more than one host, a source with no server attached stays on its own host instead of guessing one.
  3. The server picked in the "Active Server" menu is never used as a fallback.

Mechanism: the ten components each had their own copy of { ...repoOwnerSettings, ...getTaskSourceRuntimeSettings(sourceContext) }. getTaskSourceRuntimeSettings always returns activeRuntimeEnvironmentId, set to null for a host-less source, so the spread replaced the owner with "local". Every copy now calls one helper, getGitHubRepoRoutingSettings (the existing merge helper, renamed because reads use it too). The store's getGitHubRepoSourceSettings / getGitHubWorkItemSourceSettings follow the same rule. For a source with no server attached, both use getHostlessSourceRepoOwnerEnvironmentId, which takes the owner only from the single repo row with that id.

Why

The issue's suggested direction was one shared helper so merge and read paths cannot drift. The merge helper already encoded exactly the right rule and was tested, so reusing it removes ten duplicated blocks (net −45 lines) instead of adding an eleventh variant. A guard test fails if anyone spreads a task source over owner settings again.

One deliberate behavior change: for a repo with no recorded owner, these panels used to follow the "Active Server" menu. They now treat it as local, the same as the merge button. Server rows are always stamped with their owner on arrival, so only genuinely local rows lack one.

Linked Issue

Fixes #7623

Visual Proof

N/A. This only changes which machine handles the request. Nothing on screen looks different, apart from the lists now loading.

Testing

  • src/renderer/src/store/github/work-item-routing.test.ts (new): a server-owned repo viewed through a host-less source stays on its owner, a server source still overrides, and a local source never follows the "Active Server" menu, and a repo id that exists on both a server and this computer stays local for a local source. The two owner tests fail on origin/main (they got null) and pass here.

  • src/renderer/src/lib/github-source-runtime-context.test.ts: added a guard that no renderer file spreads getTaskSourceRuntimeSettings(...). It fails on origin/main and lists the 12 files.

  • pnpm tc, oxlint, pnpm run check:code-quality:changed, the owner-routing ratchet, and the store/github, task-page, pull-request-page, github-item-dialog and github component test folders (756 files, 7551 tests).

  • Not tested by hand in the app. SSH: SSH-owned repos still use this desktop's credentials, as before.

  • I manually tested these changes locally

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

AI Disclosure

Review

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

No wire change. Renderer-only routing, the same on macOS, Linux and Windows. SSH repos and folder workspaces keep desktop credentials. GitHub Projects boards with no repo (the projectOrigin paths) are left to a later change that adds an explicit source picker.

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)

m4air added 2 commits October 10, 2026 06:09
…ess task source

A GitHub task source without a runtime host used to spread
activeRuntimeEnvironmentId: null over the repo owner's settings, so
assignee, reviewer, label, status and merge cells for a runtime-owned
repo ran on this desktop. Every PR read and action site now routes
through getGitHubRepoRoutingSettings (renamed from the merge-only
helper), and the store's source-scoped routing defers to the repo owner
the same way. Focus is never a fallback.

Fixes #7623
Duplicate repo ids across hosts made the host-less source fallback pick a
server owner by focus (UI) or by first row (store), so a local item could
read or write on a paired server. The owner is now inherited only from
the single row with that id; ambiguity stays on the source's own host.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 6d90a3b9-0926-48ff-96c0-1e16fbe6813b

📥 Commits

Reviewing files that changed from the base of the PR and between d180cc6 and 13b9181.


📒 Files selected for processing (2)
  • config/scripts/github-opened-issue-repository.test.ts
  • config/scripts/github-pr-assignee-repository.test.ts

💤 Files with no reviewable changes (2)
  • config/scripts/github-pr-assignee-repository.test.ts
  • config/scripts/github-opened-issue-repository.test.ts

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



📝 Walkthrough

Walkthrough

GitHub routing helpers now derive active runtime settings from source context and repository state. Hostless GitHub sources use the runtime owner of a uniquely matched source repository. Store actions pass full state to the updated settings helpers. Pull request and task page components use the shared repository-routing helper. Tests cover routing behavior for local and runtime sources, including duplicate repository IDs.


Priority: ⬆️ High

Severity of issue fixed: High

Merge Risk: 🟡 Moderate · up to 13b91

Repository routing can return work items from a previous host or send some requests to the wrong host. Resolve these routing paths before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 27 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: PR reads and actions now follow repository ownership routing.
Description check Passed The description follows the required template and clearly explains the user impact, implementation, rationale, linked issue, visual proof, testing, scope, and compatibility considerations. Manual test…
Linked Issues check Passed Issue #7623 requires owner-aware routing for PullRequestPage merge actions and the listed dialog and PR-page read paths. The changed panels now call getGitHubRepoRoutingSettings, including `PullRe…
Out of Scope Changes check Passed The task-page panels, issue draft, and GitHub store source-setting paths apply the same repository-owner routing rule. They prevent related read and action paths from using different routing. The adde…

  • Fix all pre-merge checks with AI
✨ 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.

@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: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49e762e1-b9bd-414d-a7d5-71e56dd663bf
📥 Commits

Reviewing files that changed from the base of the PR and between 3e7ab3f and d180cc6.

📒 Files selected for processing (27)
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsx
  • src/renderer/src/components/github/PRAssigneesPanel.tsx
  • src/renderer/src/components/github/github-work-item-edit-mutations.ts
  • src/renderer/src/components/pull-request-page/actions/panel.tsx
  • src/renderer/src/components/pull-request-page/conversation/tab.tsx
  • src/renderer/src/components/pull-request-page/edit/section.tsx
  • src/renderer/src/components/pull-request-page/reviewers/panel.tsx
  • src/renderer/src/components/task-page/github/AssigneesCell.tsx
  • src/renderer/src/components/task-page/github/MergeCell.tsx
  • src/renderer/src/components/task-page/github/ReviewCell.tsx
  • src/renderer/src/components/task-page/github/StatusCell.tsx
  • src/renderer/src/components/use-task-page-github-issue-draft.ts
  • src/renderer/src/lib/github-source-runtime-context.test.ts
  • src/renderer/src/lib/github-source-runtime-context.ts
  • src/renderer/src/lib/repo-runtime-owner.ts
  • src/renderer/src/store/github/check-actions.ts
  • src/renderer/src/store/github/comment-fetch-actions.ts
  • src/renderer/src/store/github/comment-mutation-actions.ts
  • src/renderer/src/store/github/conversation-comment-actions.ts
  • src/renderer/src/store/github/issue-actions.ts
  • src/renderer/src/store/github/review-thread-actions.ts
  • src/renderer/src/store/github/work-item-aggregate-actions.ts
  • src/renderer/src/store/github/work-item-fetch-actions.ts
  • src/renderer/src/store/github/work-item-routing.test.ts
  • src/renderer/src/store/github/work-item-routing.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.

newIssueTargetRepo.id
const target = getActiveRuntimeTarget(
getGitHubRepoRoutingSettings(
{ repos: [newIssueTargetRepo], settings },

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Pass the complete repository list to the routing helper.

If a local and runtime repository share newIssueTargetRepo.id, [newIssueTargetRepo] hides the duplicate from getHostlessSourceRepoOwnerEnvironmentId. For a hostless GitHub source and a selected runtime row, the new-issue form then selects that runtime instead of applying the duplicate-ID local fallback. Pass repos as the routing state’s repository list; keep newIssueTargetRepo.id as the requested ID. (raw.githubusercontent.com)

state.settings,
sourceHost?.kind === 'runtime'
? sourceHost.environmentId
: getHostlessSourceRepoOwnerEnvironmentId(state.repos, repo?.id)

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

set -e
printf '%s\n' '--- routing diff ---'
git diff --find-renames 3e7ab3f5a10a322a73a15aa37dd61c63af711dec d180cc66be67b3a189f7855824f421a5344a16e6 -- src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- fetch action references ---'
rg -n -F --glob '*.ts' -- 'ownerHostId' src/renderer/src/store/github src/renderer/src | head -120
printf '%s\n' '--- work-item fetch actions ---'
sed -n '1,280p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing helper ---'
sed -n '1,220p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache and invalidation references ---'
rg -n -F --glob '*.ts' -- 'workItem' src/renderer/src/store/github src/renderer/src/store | head -240
rg -n --glob '*.ts' 'invalidate|clear.*cache|cache.*clear|abort|cancel' src/renderer/src/store/github | head -240
printf '%s\n' '--- repository owner fields and updates ---'
rg -n --glob '*.ts' 'executionHostId|connectionId|ownerHostId|repoOwner|repository owner' src/renderer/src/store src/renderer/src/lib | head -300

Repository: stablyai/orca

Length of output: 41900


🏁 Script executed:

set -e
printf '%s\n' '--- routing diff ---'
git diff --find-renames 3e7ab3f5a10a322a73a15aa37dd61c63af711dec d180cc66be67b3a189f7855824f421a5344a16e6 -- src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- fetch action references ---'
rg -n -F --glob '*.ts' -- 'ownerHostId' src/renderer/src/store/github src/renderer/src | head -120
printf '%s\n' '--- work-item fetch actions ---'
sed -n '1,320p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing helper ---'
sed -n '1,240p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache and invalidation references ---'
rg -n -F --glob '*.ts' -- 'workItem' src/renderer/src/store/github src/renderer/src/store | head -240
rg -n --glob '*.ts' 'invalidate|clear.*cache|cache.*clear|abort|cancel' src/renderer/src/store/github | head -240
printf '%s\n' '--- repository owner fields and updates ---'
rg -n --glob '*.ts' 'executionHostId|connectionId|ownerHostId|repoOwner|repository owner' src/renderer/src/store src/renderer/src/lib | head -300

Repository: stablyai/orca

Length of output: 42484


🌐 Web query:

site:github.com/stablyai/orca d180cc66be67b3a189f7855824f421a5344a16e6 work-item-fetch-actions.ts ownerHostId

💡 Result:

I couldn’t verify that commit or locate `work-item-fetch-actions.ts` with `ownerHostId` in the available search results. The results point to Orca’s repository, but don’t establish what the file contains at commit `d180cc66be67b3a189f7855824f421a5344a16e6`. ([github.com](https://github.com/stablyai/orca?utm_source=openai))

The exact commit’s file contents remain unresolved.

Citations:

- 1: https://github.com/stablyai/orca?utm_source=openai

🏁 Script executed:

set -e
printf '%s\n' '--- fetch action core ---'
sed -n '70,205p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing host/cache helpers ---'
sed -n '100,210p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache identity ---'
sed -n '1,220p' src/renderer/src/store/github/cache-identity.ts
printf '%s\n' '--- invalidation references and implementations ---'
rg -n -C 8 --glob '*.ts' 'workItemsInvalidationNonce|invalidateWorkItems|clearWorkItems|workItemsCache' src/renderer/src/store/github src/renderer/src/store/repos src/renderer/src/store/slices
printf '%s\n' '--- repository update owner transition ---'
sed -n '90,225p' src/renderer/src/store/repos/repo-update.ts

Repository: stablyai/orca

Length of output: 42401


Invalidate hostless-source work-item caches when repository ownership changes.

getGitHubWorkItemSourceSettings now routes a hostless source to its repository owner, but the cache scope and ownerHostId still use the unchanged source context. A fresh cache entry can therefore be returned for the previous host, and an older in-flight request can write into the same cache key after the owner changes. The current-host guard does not detect this transition because both values remain hostless.

When the effective owner changes, clear the source-scoped cache and advance the invalidation nonce before allowing new requests. This must also prevent older in-flight requests from repopulating that cache.

return settingsForGitHubTaskSource(state, repo, sourceContext)
}
return settingsForGitHubFocusedRepoOwner(settings, repo)
return settingsForGitHubFocusedRepoOwner(state.settings, repo)

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not use the focused runtime for an unowned work-item repository.

If sourceContext is absent and repo has no recorded owner, settingsForGitHubFocusedRepoOwner returns state.settings unchanged. When the active server is selected, getGitHubWorkItemRequestContext can then target that server for a local repository. Resolve an unowned repository to activeRuntimeEnvironmentId: null on this branch. The PR’s routing rule explicitly excludes the active server as a fallback. (raw.githubusercontent.com)

@OrcaWin
OrcaWin merged commit 3a8f8e1 into main Oct 10, 2026
30 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.

Headless PR merge routing: same #6957 bug in PullRequestPage.PRActionsPanel + read-path siblings (follow-up to #7590)

1 participant